forked from mirrors/gecko-dev
Bug 1736236 - Remove obsolete LayerManager.h. r=gfx-reviewers,lsalzman
This adds a bunch of #include "WindowRenderer.h" in places that were getting it implicitly before. Differential Revision: https://phabricator.services.mozilla.com/D128687
This commit is contained in:
parent
3e6e360d62
commit
f76f41feb4
24 changed files with 22 additions and 500 deletions
|
|
@ -39,6 +39,7 @@
|
||||||
#include "nsPresContextInlines.h"
|
#include "nsPresContextInlines.h"
|
||||||
#include "nsRefreshDriver.h"
|
#include "nsRefreshDriver.h"
|
||||||
#include "js/PropertyAndElement.h" // JS_DefineProperty
|
#include "js/PropertyAndElement.h" // JS_DefineProperty
|
||||||
|
#include "WindowRenderer.h"
|
||||||
|
|
||||||
namespace mozilla {
|
namespace mozilla {
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -124,6 +124,7 @@
|
||||||
#include "mozilla/layers/CanvasClient.h"
|
#include "mozilla/layers/CanvasClient.h"
|
||||||
#include "mozilla/layers/WebRenderUserData.h"
|
#include "mozilla/layers/WebRenderUserData.h"
|
||||||
#include "mozilla/layers/WebRenderCanvasRenderer.h"
|
#include "mozilla/layers/WebRenderCanvasRenderer.h"
|
||||||
|
#include "WindowRenderer.h"
|
||||||
|
|
||||||
#undef free // apparently defined by some windows header, clashing with a
|
#undef free // apparently defined by some windows header, clashing with a
|
||||||
// free() method in SkTypes.h
|
// free() method in SkTypes.h
|
||||||
|
|
|
||||||
|
|
@ -51,6 +51,7 @@
|
||||||
#include "CanvasUtils.h"
|
#include "CanvasUtils.h"
|
||||||
#include "VRManagerChild.h"
|
#include "VRManagerChild.h"
|
||||||
#include "ClientWebGLContext.h"
|
#include "ClientWebGLContext.h"
|
||||||
|
#include "WindowRenderer.h"
|
||||||
|
|
||||||
using namespace mozilla::layers;
|
using namespace mozilla::layers;
|
||||||
using namespace mozilla::gfx;
|
using namespace mozilla::gfx;
|
||||||
|
|
|
||||||
|
|
@ -35,6 +35,7 @@
|
||||||
#include "nsPrintfCString.h"
|
#include "nsPrintfCString.h"
|
||||||
#include "nsServiceManagerUtils.h"
|
#include "nsServiceManagerUtils.h"
|
||||||
#include "nsTArray.h"
|
#include "nsTArray.h"
|
||||||
|
#include "WindowRenderer.h"
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <limits>
|
#include <limits>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -32,6 +32,7 @@
|
||||||
#include "mozilla/dom/WorkerRef.h"
|
#include "mozilla/dom/WorkerRef.h"
|
||||||
#include "mozilla/layers/KnowsCompositor.h"
|
#include "mozilla/layers/KnowsCompositor.h"
|
||||||
#include "nsContentUtils.h"
|
#include "nsContentUtils.h"
|
||||||
|
#include "WindowRenderer.h"
|
||||||
|
|
||||||
static mozilla::LazyLogModule sMediaCapabilitiesLog("MediaCapabilities");
|
static mozilla::LazyLogModule sMediaCapabilitiesLog("MediaCapabilities");
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,424 +0,0 @@
|
||||||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
||||||
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
|
||||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
||||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
||||||
|
|
||||||
#ifndef GFX_LAYERMANAGER_H
|
|
||||||
#define GFX_LAYERMANAGER_H
|
|
||||||
|
|
||||||
#include <cstdint> // for uint32_t, uint64_t, int32_t, uint8_t
|
|
||||||
#include <iosfwd> // for stringstream
|
|
||||||
#include <new> // for operator new
|
|
||||||
#include <unordered_set> // for unordered_set
|
|
||||||
#include <utility> // for forward
|
|
||||||
#include "FrameMetrics.h" // for ScrollUpdatesMap
|
|
||||||
#include "ImageContainer.h" // for ImageContainer, ImageContainer::Mode, ImageContainer::SYNCHRONOUS
|
|
||||||
#include "WindowRenderer.h"
|
|
||||||
#include "mozilla/AlreadyAddRefed.h" // for already_AddRefed
|
|
||||||
#include "mozilla/Maybe.h" // for Maybe
|
|
||||||
#include "mozilla/RefPtr.h" // for RefPtr
|
|
||||||
#include "mozilla/TimeStamp.h" // for TimeStamp
|
|
||||||
#include "mozilla/UniquePtr.h" // for UniquePtr
|
|
||||||
#include "mozilla/dom/Animation.h" // for Animation
|
|
||||||
#include "mozilla/gfx/Point.h" // for IntSize
|
|
||||||
#include "mozilla/gfx/Types.h" // for SurfaceFormat
|
|
||||||
#include "mozilla/gfx/UserData.h" // for UserData, UserDataKey (ptr only)
|
|
||||||
#include "mozilla/layers/CompositorTypes.h" // for TextureFactoryIdentifier
|
|
||||||
#include "mozilla/layers/ScrollableLayerGuid.h" // for ScrollableLayerGuid, ScrollableLayerGuid::ViewID
|
|
||||||
#include "nsHashKeys.h" // for nsUint64HashKey
|
|
||||||
#include "nsISupports.h" // for NS_INLINE_DECL_REFCOUNTING
|
|
||||||
#include "nsIWidget.h" // for nsIWidget
|
|
||||||
#include "nsRefPtrHashtable.h" // for nsRefPtrHashtable
|
|
||||||
#include "nsRegion.h" // for nsIntRegion
|
|
||||||
#include "nsStringFwd.h" // for nsCString, nsAString
|
|
||||||
#include "nsTArray.h" // for nsTArray
|
|
||||||
|
|
||||||
// XXX These includes could be avoided by moving function implementations to the
|
|
||||||
// cpp file
|
|
||||||
#include "mozilla/Assertions.h" // for AssertionConditionType, MOZ_ASSERT, MOZ_A...
|
|
||||||
#include "mozilla/layers/LayersTypes.h" // for CompositionPayload, LayersBackend, TransactionId, DrawRegionClip, LayersBackend:...
|
|
||||||
|
|
||||||
class gfxContext;
|
|
||||||
|
|
||||||
extern uint8_t gLayerManagerLayerBuilder;
|
|
||||||
|
|
||||||
namespace mozilla {
|
|
||||||
|
|
||||||
class FrameLayerBuilder;
|
|
||||||
class LogModule;
|
|
||||||
class ScrollPositionUpdate;
|
|
||||||
|
|
||||||
namespace gfx {
|
|
||||||
class DrawTarget;
|
|
||||||
} // namespace gfx
|
|
||||||
|
|
||||||
namespace layers {
|
|
||||||
|
|
||||||
class AsyncPanZoomController;
|
|
||||||
class ClientLayerManager;
|
|
||||||
class Layer;
|
|
||||||
class CompositorBridgeChild;
|
|
||||||
class ReadbackProcessor;
|
|
||||||
class FocusTarget;
|
|
||||||
class KnowsCompositor;
|
|
||||||
class TransactionIdAllocator;
|
|
||||||
class FrameUniformityData;
|
|
||||||
class PersistentBufferProvider;
|
|
||||||
class GlyphArray;
|
|
||||||
class WebRenderLayerManager;
|
|
||||||
struct AnimData;
|
|
||||||
|
|
||||||
// Defined in LayerUserData.h; please include that file instead.
|
|
||||||
class LayerUserData;
|
|
||||||
|
|
||||||
class DidCompositeObserver {
|
|
||||||
public:
|
|
||||||
virtual void DidComposite() = 0;
|
|
||||||
};
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Motivation: For truly smooth animation and video playback, we need to
|
|
||||||
* be able to compose frames and render them on a dedicated thread (i.e.
|
|
||||||
* off the main thread where DOM manipulation, script execution and layout
|
|
||||||
* induce difficult-to-bound latency). This requires Gecko to construct
|
|
||||||
* some kind of persistent scene structure (graph or tree) that can be
|
|
||||||
* safely transmitted across threads. We have other scenarios (e.g. mobile
|
|
||||||
* browsing) where retaining some rendered data between paints is desired
|
|
||||||
* for performance, so again we need a retained scene structure.
|
|
||||||
*
|
|
||||||
* Our retained scene structure is a layer tree. Each layer represents
|
|
||||||
* content which can be composited onto a destination surface; the root
|
|
||||||
* layer is usually composited into a window, and non-root layers are
|
|
||||||
* composited into their parent layers. Layers have attributes (e.g.
|
|
||||||
* opacity and clipping) that influence their compositing.
|
|
||||||
*
|
|
||||||
* We want to support a variety of layer implementations, including
|
|
||||||
* a simple "immediate mode" implementation that doesn't retain any
|
|
||||||
* rendered data between paints (i.e. uses cairo in just the way that
|
|
||||||
* Gecko used it before layers were introduced). But we also don't want
|
|
||||||
* to have bifurcated "layers"/"non-layers" rendering paths in Gecko.
|
|
||||||
* Therefore the layers API is carefully designed to permit maximally
|
|
||||||
* efficient implementation in an "immediate mode" style. See the
|
|
||||||
* BasicLayerManager for such an implementation.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A LayerManager controls a tree of layers. All layers in the tree
|
|
||||||
* must use the same LayerManager.
|
|
||||||
*
|
|
||||||
* All modifications to a layer tree must happen inside a transaction.
|
|
||||||
* Only the state of the layer tree at the end of a transaction is
|
|
||||||
* rendered. Transactions cannot be nested
|
|
||||||
*
|
|
||||||
* Each transaction has two phases:
|
|
||||||
* 1) Construction: layers are created, inserted, removed and have
|
|
||||||
* properties set on them in this phase.
|
|
||||||
* BeginTransaction and BeginTransactionWithTarget start a transaction in
|
|
||||||
* the Construction phase.
|
|
||||||
* 2) Drawing: PaintedLayers are rendered into in this phase, in tree
|
|
||||||
* order. When the client has finished drawing into the PaintedLayers, it should
|
|
||||||
* call EndTransaction to complete the transaction.
|
|
||||||
*
|
|
||||||
* All layer API calls happen on the main thread.
|
|
||||||
*
|
|
||||||
* Layers are refcounted. The layer manager holds a reference to the
|
|
||||||
* root layer, and each container layer holds a reference to its children.
|
|
||||||
*/
|
|
||||||
class LayerManager : public WindowRenderer {
|
|
||||||
protected:
|
|
||||||
typedef mozilla::gfx::DrawTarget DrawTarget;
|
|
||||||
typedef mozilla::gfx::IntSize IntSize;
|
|
||||||
typedef mozilla::gfx::SurfaceFormat SurfaceFormat;
|
|
||||||
|
|
||||||
public:
|
|
||||||
LayerManager();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Release layers and resources held by this layer manager, and mark
|
|
||||||
* it as destroyed. Should do any cleanup necessary in preparation
|
|
||||||
* for its widget going away. After this call, only user data calls
|
|
||||||
* are valid on the layer manager.
|
|
||||||
*/
|
|
||||||
void Destroy() override;
|
|
||||||
bool IsDestroyed() { return mDestroyed; }
|
|
||||||
|
|
||||||
virtual WebRenderLayerManager* AsWebRenderLayerManager() { return nullptr; }
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns true if this LayerManager is owned by an nsIWidget,
|
|
||||||
* and is used for drawing into the widget.
|
|
||||||
*/
|
|
||||||
virtual bool IsWidgetLayerManager() { return true; }
|
|
||||||
virtual bool IsInactiveLayerManager() { return false; }
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Start a new transaction. Nested transactions are not allowed so
|
|
||||||
* there must be no transaction currently in progress.
|
|
||||||
* This transaction will render the contents of the layer tree to
|
|
||||||
* the given target context. The rendering will be complete when
|
|
||||||
* EndTransaction returns.
|
|
||||||
*/
|
|
||||||
virtual bool BeginTransactionWithTarget(
|
|
||||||
gfxContext* aTarget, const nsCString& aURL = nsCString()) = 0;
|
|
||||||
|
|
||||||
FrameLayerBuilder* GetLayerBuilder() {
|
|
||||||
return reinterpret_cast<FrameLayerBuilder*>(
|
|
||||||
GetUserData(&gLayerManagerLayerBuilder));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Schedule a composition with the remote Compositor, if one exists
|
|
||||||
* for this LayerManager. Useful in conjunction with the
|
|
||||||
* END_NO_REMOTE_COMPOSITE flag to EndTransaction.
|
|
||||||
*/
|
|
||||||
virtual void ScheduleComposite() {}
|
|
||||||
|
|
||||||
virtual void SetNeedsComposite(bool aNeedsComposite) {}
|
|
||||||
virtual bool NeedsComposite() const { return false; }
|
|
||||||
|
|
||||||
virtual bool HasShadowManagerInternal() const { return false; }
|
|
||||||
bool HasShadowManager() const { return HasShadowManagerInternal(); }
|
|
||||||
virtual void StorePluginWidgetConfigurations(
|
|
||||||
const nsTArray<nsIWidget::Configuration>& aConfigurations) {}
|
|
||||||
bool IsSnappingEffectiveTransforms() { return mSnapEffectiveTransforms; }
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns true if this LayerManager always requires an intermediate surface
|
|
||||||
* to render blend operations.
|
|
||||||
*/
|
|
||||||
virtual bool BlendingRequiresIntermediateSurface() { return false; }
|
|
||||||
|
|
||||||
/**
|
|
||||||
* CONSTRUCTION PHASE ONLY
|
|
||||||
* Set the root layer. The root layer is initially null. If there is
|
|
||||||
* no root layer, EndTransaction won't draw anything.
|
|
||||||
*/
|
|
||||||
virtual void SetRoot(Layer* aLayer) = 0;
|
|
||||||
/**
|
|
||||||
* Can be called anytime
|
|
||||||
*/
|
|
||||||
Layer* GetRoot() { return nullptr; }
|
|
||||||
|
|
||||||
/**
|
|
||||||
* CONSTRUCTION PHASE ONLY
|
|
||||||
* Called when a managee has mutated.
|
|
||||||
* Subclasses overriding this method must first call their
|
|
||||||
* superclass's impl
|
|
||||||
*/
|
|
||||||
virtual void Mutated(Layer* aLayer) {}
|
|
||||||
virtual void MutatedSimple(Layer* aLayer) {}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Can be called anytime, from any thread.
|
|
||||||
*
|
|
||||||
* Creates an Image container which forwards its images to the compositor
|
|
||||||
* within layer transactions on the main thread or asynchronously using the
|
|
||||||
* ImageBridge IPDL protocol. In the case of asynchronous, If the protocol is
|
|
||||||
* not available, the returned ImageContainer will forward images within layer
|
|
||||||
* transactions.
|
|
||||||
*/
|
|
||||||
static already_AddRefed<ImageContainer> CreateImageContainer(
|
|
||||||
ImageContainer::Mode flag = ImageContainer::SYNCHRONOUS);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Creates a DrawTarget which is optimized for inter-operating with this
|
|
||||||
* layer manager.
|
|
||||||
*/
|
|
||||||
virtual already_AddRefed<DrawTarget> CreateOptimalDrawTarget(
|
|
||||||
const IntSize& aSize, SurfaceFormat imageFormat);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Creates a DrawTarget for alpha masks which is optimized for inter-
|
|
||||||
* operating with this layer manager. In contrast to CreateOptimalDrawTarget,
|
|
||||||
* this surface is optimised for drawing alpha only and we assume that
|
|
||||||
* drawing the mask is fairly simple.
|
|
||||||
*/
|
|
||||||
virtual already_AddRefed<DrawTarget> CreateOptimalMaskDrawTarget(
|
|
||||||
const IntSize& aSize);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Creates a DrawTarget for use with canvas which is optimized for
|
|
||||||
* inter-operating with this layermanager.
|
|
||||||
*/
|
|
||||||
virtual already_AddRefed<mozilla::gfx::DrawTarget> CreateDrawTarget(
|
|
||||||
const mozilla::gfx::IntSize& aSize, mozilla::gfx::SurfaceFormat aFormat);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This setter can be used anytime. The user data for all keys is
|
|
||||||
* initially null. Ownership pases to the layer manager.
|
|
||||||
*/
|
|
||||||
void SetUserData(void* aKey, LayerUserData* aData) {
|
|
||||||
mUserData.Add(static_cast<gfx::UserDataKey*>(aKey), aData,
|
|
||||||
LayerUserDataDestroy);
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* This can be used anytime. Ownership passes to the caller!
|
|
||||||
*/
|
|
||||||
UniquePtr<LayerUserData> RemoveUserData(void* aKey);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This getter can be used anytime.
|
|
||||||
*/
|
|
||||||
bool HasUserData(void* aKey) {
|
|
||||||
return mUserData.Has(static_cast<gfx::UserDataKey*>(aKey));
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* This getter can be used anytime. Ownership is retained by the layer
|
|
||||||
* manager.
|
|
||||||
*/
|
|
||||||
LayerUserData* GetUserData(void* aKey) const {
|
|
||||||
return static_cast<LayerUserData*>(
|
|
||||||
mUserData.Get(static_cast<gfx::UserDataKey*>(aKey)));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Must be called outside of a layers transaction.
|
|
||||||
*
|
|
||||||
* For the subtree rooted at |aSubtree|, this attempts to free up
|
|
||||||
* any free-able resources like retained buffers, but may do nothing
|
|
||||||
* at all. After this call, the layer tree is left in an undefined
|
|
||||||
* state; the layers in |aSubtree|'s subtree may no longer have
|
|
||||||
* buffers with valid content and may no longer be able to draw
|
|
||||||
* their visible and valid regions.
|
|
||||||
*
|
|
||||||
* In general, a painting or forwarding transaction on |this| must
|
|
||||||
* complete on the tree before it returns to a valid state.
|
|
||||||
*
|
|
||||||
* Resource freeing begins from |aSubtree| or |mRoot| if |aSubtree|
|
|
||||||
* is null. |aSubtree|'s manager must be this.
|
|
||||||
*/
|
|
||||||
virtual void ClearCachedResources(Layer* aSubtree = nullptr) {}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Flag the next paint as the first for a document.
|
|
||||||
*/
|
|
||||||
virtual void SetIsFirstPaint() {}
|
|
||||||
virtual bool GetIsFirstPaint() const { return false; }
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the current focus target to be sent with the next paint.
|
|
||||||
*/
|
|
||||||
virtual void SetFocusTarget(const FocusTarget& aFocusTarget) {}
|
|
||||||
|
|
||||||
virtual void SendInvalidRegion(const nsIntRegion& aRegion) {}
|
|
||||||
|
|
||||||
virtual const char* Name() const { return "???"; }
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Dump information about this layer manager and its managed tree to
|
|
||||||
* aStream.
|
|
||||||
*/
|
|
||||||
void Dump(std::stringstream& aStream, const char* aPrefix = "",
|
|
||||||
bool aDumpHtml = false, bool aSorted = false);
|
|
||||||
/**
|
|
||||||
* Dump information about just this layer manager itself to aStream
|
|
||||||
*/
|
|
||||||
void DumpSelf(std::stringstream& aStream, const char* aPrefix = "",
|
|
||||||
bool aSorted = false);
|
|
||||||
void Dump(bool aSorted = false);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Log information about this layer manager and its managed tree to
|
|
||||||
* the NSPR log (if enabled for "Layers").
|
|
||||||
*/
|
|
||||||
void Log(const char* aPrefix = "");
|
|
||||||
/**
|
|
||||||
* Log information about just this layer manager itself to the NSPR
|
|
||||||
* log (if enabled for "Layers").
|
|
||||||
*/
|
|
||||||
void LogSelf(const char* aPrefix = "");
|
|
||||||
|
|
||||||
static bool IsLogEnabled();
|
|
||||||
static mozilla::LogModule* GetLog();
|
|
||||||
|
|
||||||
bool IsInTransaction() const { return mInTransaction; }
|
|
||||||
|
|
||||||
virtual void SetRegionToClear(const nsIntRegion& aRegion) {
|
|
||||||
mRegionToClear = aRegion;
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual float RequestProperty(const nsAString& property) { return -1; }
|
|
||||||
|
|
||||||
virtual bool AsyncPanZoomEnabled() const { return false; }
|
|
||||||
|
|
||||||
static void LayerUserDataDestroy(void* data);
|
|
||||||
|
|
||||||
void AddPaintedPixelCount(int32_t aCount) { mPaintedPixelCount += aCount; }
|
|
||||||
|
|
||||||
uint32_t GetAndClearPaintedPixelCount() {
|
|
||||||
uint32_t count = mPaintedPixelCount;
|
|
||||||
mPaintedPixelCount = 0;
|
|
||||||
return count;
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual void SetLayersObserverEpoch(LayersObserverEpoch aEpoch) {}
|
|
||||||
|
|
||||||
virtual void DidComposite(TransactionId aTransactionId,
|
|
||||||
const mozilla::TimeStamp& aCompositeStart,
|
|
||||||
const mozilla::TimeStamp& aCompositeEnd) {}
|
|
||||||
|
|
||||||
virtual void AddDidCompositeObserver(DidCompositeObserver* aObserver) {
|
|
||||||
MOZ_CRASH("GFX: LayerManager");
|
|
||||||
}
|
|
||||||
virtual void RemoveDidCompositeObserver(DidCompositeObserver* aObserver) {
|
|
||||||
MOZ_CRASH("GFX: LayerManager");
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual void UpdateTextureFactoryIdentifier(
|
|
||||||
const TextureFactoryIdentifier& aNewIdentifier) {}
|
|
||||||
|
|
||||||
virtual TextureFactoryIdentifier GetTextureFactoryIdentifier() {
|
|
||||||
return TextureFactoryIdentifier();
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual void SetTransactionIdAllocator(TransactionIdAllocator* aAllocator) {}
|
|
||||||
|
|
||||||
virtual TransactionId GetLastTransactionId() { return TransactionId{0}; }
|
|
||||||
|
|
||||||
void SetContainsSVG(bool aContainsSVG) { mContainsSVG = aContainsSVG; }
|
|
||||||
|
|
||||||
protected:
|
|
||||||
gfx::UserData mUserData;
|
|
||||||
bool mDestroyed;
|
|
||||||
bool mSnapEffectiveTransforms;
|
|
||||||
|
|
||||||
nsIntRegion mRegionToClear;
|
|
||||||
|
|
||||||
// Protected destructor, to discourage deletion outside of Release():
|
|
||||||
virtual ~LayerManager();
|
|
||||||
|
|
||||||
// Print interesting information about this into aStreamo. Internally
|
|
||||||
// used to implement Dump*() and Log*().
|
|
||||||
virtual void PrintInfo(std::stringstream& aStream, const char* aPrefix);
|
|
||||||
|
|
||||||
uint64_t mId;
|
|
||||||
bool mInTransaction;
|
|
||||||
|
|
||||||
// Used for tracking CONTENT_FRAME_TIME_WITH_SVG
|
|
||||||
bool mContainsSVG;
|
|
||||||
// The count of pixels that were painted in the current transaction.
|
|
||||||
uint32_t mPaintedPixelCount;
|
|
||||||
|
|
||||||
public:
|
|
||||||
/*
|
|
||||||
* Methods to store/get/clear a "pending scroll info update" object on a
|
|
||||||
* per-scrollid basis. This is used for empty transactions that push over
|
|
||||||
* scroll position updates to the APZ code.
|
|
||||||
*/
|
|
||||||
virtual bool AddPendingScrollUpdateForNextTransaction(
|
|
||||||
ScrollableLayerGuid::ViewID aScrollId,
|
|
||||||
const ScrollPositionUpdate& aUpdateInfo) override;
|
|
||||||
Maybe<nsTArray<ScrollPositionUpdate>> GetPendingScrollInfoUpdate(
|
|
||||||
ScrollableLayerGuid::ViewID aScrollId);
|
|
||||||
std::unordered_set<ScrollableLayerGuid::ViewID>
|
|
||||||
ClearPendingScrollInfoUpdate();
|
|
||||||
|
|
||||||
protected:
|
|
||||||
ScrollUpdatesMap mPendingScrollUpdates;
|
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace layers
|
|
||||||
} // namespace mozilla
|
|
||||||
|
|
||||||
#endif /* GFX_LAYERS_H */
|
|
||||||
|
|
@ -78,10 +78,6 @@ void WriteSnapshotToDumpFile_internal(T* aObj, DataSourceSurface* aSurf) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void WriteSnapshotToDumpFile(LayerManager* aManager, DataSourceSurface* aSurf) {
|
|
||||||
WriteSnapshotToDumpFile_internal(aManager, aSurf);
|
|
||||||
}
|
|
||||||
|
|
||||||
void WriteSnapshotToDumpFile(Compositor* aCompositor, DrawTarget* aTarget) {
|
void WriteSnapshotToDumpFile(Compositor* aCompositor, DrawTarget* aTarget) {
|
||||||
RefPtr<SourceSurface> surf = aTarget->Snapshot();
|
RefPtr<SourceSurface> surf = aTarget->Snapshot();
|
||||||
RefPtr<DataSourceSurface> dSurf = surf->GetDataSurface();
|
RefPtr<DataSourceSurface> dSurf = surf->GetDataSurface();
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,6 @@
|
||||||
#include "mozilla/gfx/UserData.h" // for UserData, UserDataKey (ptr only)
|
#include "mozilla/gfx/UserData.h" // for UserData, UserDataKey (ptr only)
|
||||||
#include "mozilla/layers/AnimationInfo.h" // for AnimationInfo
|
#include "mozilla/layers/AnimationInfo.h" // for AnimationInfo
|
||||||
#include "mozilla/layers/LayerAttributes.h" // for SimpleLayerAttributes, ScrollbarData (ptr only)
|
#include "mozilla/layers/LayerAttributes.h" // for SimpleLayerAttributes, ScrollbarData (ptr only)
|
||||||
#include "mozilla/layers/LayerManager.h" // for LayerManager
|
|
||||||
#include "mozilla/layers/ScrollableLayerGuid.h" // for ScrollableLayerGuid, ScrollableLayerGuid::ViewID
|
#include "mozilla/layers/ScrollableLayerGuid.h" // for ScrollableLayerGuid, ScrollableLayerGuid::ViewID
|
||||||
#include "mozilla/layers/BSPTree.h"
|
#include "mozilla/layers/BSPTree.h"
|
||||||
#include "nsISupports.h" // for NS_INLINE_DECL_REFCOUNTING
|
#include "nsISupports.h" // for NS_INLINE_DECL_REFCOUNTING
|
||||||
|
|
@ -124,8 +123,6 @@ void SetAntialiasingFlags(Layer* aLayer, gfx::DrawTarget* aTarget);
|
||||||
|
|
||||||
#ifdef MOZ_DUMP_PAINTING
|
#ifdef MOZ_DUMP_PAINTING
|
||||||
void WriteSnapshotToDumpFile(Layer* aLayer, gfx::DataSourceSurface* aSurf);
|
void WriteSnapshotToDumpFile(Layer* aLayer, gfx::DataSourceSurface* aSurf);
|
||||||
void WriteSnapshotToDumpFile(LayerManager* aManager,
|
|
||||||
gfx::DataSourceSurface* aSurf);
|
|
||||||
void WriteSnapshotToDumpFile(Compositor* aCompositor, gfx::DrawTarget* aTarget);
|
void WriteSnapshotToDumpFile(Compositor* aCompositor, gfx::DrawTarget* aTarget);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -13,8 +13,8 @@
|
||||||
#include "mozilla/layers/LayersTypes.h" // for EventRegions
|
#include "mozilla/layers/LayersTypes.h" // for EventRegions
|
||||||
#include "mozilla/layers/ScrollableLayerGuid.h" // for ScrollableLayerGuid
|
#include "mozilla/layers/ScrollableLayerGuid.h" // for ScrollableLayerGuid
|
||||||
#include "mozilla/Maybe.h" // for Maybe
|
#include "mozilla/Maybe.h" // for Maybe
|
||||||
|
#include "mozilla/RecursiveMutex.h" // for RecursiveMutexAutoLock
|
||||||
#include "mozilla/RefPtr.h" // for nsRefPtr
|
#include "mozilla/RefPtr.h" // for nsRefPtr
|
||||||
|
|
||||||
namespace mozilla {
|
namespace mozilla {
|
||||||
namespace layers {
|
namespace layers {
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -177,7 +177,6 @@ EXPORTS.mozilla.layers += [
|
||||||
"ipc/VideoBridgeParent.h",
|
"ipc/VideoBridgeParent.h",
|
||||||
"ipc/VideoBridgeUtils.h",
|
"ipc/VideoBridgeUtils.h",
|
||||||
"LayerAttributes.h",
|
"LayerAttributes.h",
|
||||||
"LayerManager.h",
|
|
||||||
"LayersTypes.h",
|
"LayersTypes.h",
|
||||||
"MemoryPressureObserver.h",
|
"MemoryPressureObserver.h",
|
||||||
"NativeLayer.h",
|
"NativeLayer.h",
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,6 @@
|
||||||
#include "mozilla/DataMutex.h"
|
#include "mozilla/DataMutex.h"
|
||||||
#include "mozilla/layers/CompositableTransactionParent.h"
|
#include "mozilla/layers/CompositableTransactionParent.h"
|
||||||
#include "mozilla/layers/CompositorVsyncSchedulerOwner.h"
|
#include "mozilla/layers/CompositorVsyncSchedulerOwner.h"
|
||||||
#include "mozilla/layers/LayerManager.h"
|
|
||||||
#include "mozilla/layers/PWebRenderBridgeParent.h"
|
#include "mozilla/layers/PWebRenderBridgeParent.h"
|
||||||
#include "mozilla/HashTable.h"
|
#include "mozilla/HashTable.h"
|
||||||
#include "mozilla/Maybe.h"
|
#include "mozilla/Maybe.h"
|
||||||
|
|
|
||||||
|
|
@ -23,12 +23,12 @@
|
||||||
#include "mozilla/layers/CompositorTypes.h" // for TextureFactoryIdentifier
|
#include "mozilla/layers/CompositorTypes.h" // for TextureFactoryIdentifier
|
||||||
#include "mozilla/layers/DisplayItemCache.h" // for DisplayItemCache
|
#include "mozilla/layers/DisplayItemCache.h" // for DisplayItemCache
|
||||||
#include "mozilla/layers/FocusTarget.h" // for FocusTarget
|
#include "mozilla/layers/FocusTarget.h" // for FocusTarget
|
||||||
#include "mozilla/layers/LayerManager.h" // for DidCompositeObserver (ptr only), LayerManager::END_DEFAULT, LayerManager::En...
|
|
||||||
#include "mozilla/layers/LayersTypes.h" // for TransactionId, LayersBackend, CompositionPayload (ptr only), LayersBackend::...
|
#include "mozilla/layers/LayersTypes.h" // for TransactionId, LayersBackend, CompositionPayload (ptr only), LayersBackend::...
|
||||||
#include "mozilla/layers/RenderRootStateManager.h" // for RenderRootStateManager
|
#include "mozilla/layers/RenderRootStateManager.h" // for RenderRootStateManager
|
||||||
#include "mozilla/layers/ScrollableLayerGuid.h" // for ScrollableLayerGuid, ScrollableLayerGuid::ViewID
|
#include "mozilla/layers/ScrollableLayerGuid.h" // for ScrollableLayerGuid, ScrollableLayerGuid::ViewID
|
||||||
#include "mozilla/layers/WebRenderCommandBuilder.h" // for WebRenderCommandBuilder
|
#include "mozilla/layers/WebRenderCommandBuilder.h" // for WebRenderCommandBuilder
|
||||||
#include "mozilla/layers/WebRenderScrollData.h" // for WebRenderScrollData
|
#include "mozilla/layers/WebRenderScrollData.h" // for WebRenderScrollData
|
||||||
|
#include "WindowRenderer.h"
|
||||||
#include "nsHashKeys.h" // for nsRefPtrHashKey
|
#include "nsHashKeys.h" // for nsRefPtrHashKey
|
||||||
#include "nsRegion.h" // for nsIntRegion
|
#include "nsRegion.h" // for nsIntRegion
|
||||||
#include "nsStringFwd.h" // for nsCString, nsAString
|
#include "nsStringFwd.h" // for nsCString, nsAString
|
||||||
|
|
@ -52,6 +52,12 @@ class Layer;
|
||||||
class PCompositorBridgeChild;
|
class PCompositorBridgeChild;
|
||||||
class WebRenderBridgeChild;
|
class WebRenderBridgeChild;
|
||||||
class WebRenderParentCommand;
|
class WebRenderParentCommand;
|
||||||
|
class TransactionIdAllocator;
|
||||||
|
class LayerUserData;
|
||||||
|
class DidCompositeObserver {
|
||||||
|
public:
|
||||||
|
virtual void DidComposite() = 0;
|
||||||
|
};
|
||||||
|
|
||||||
class WebRenderLayerManager final : public WindowRenderer {
|
class WebRenderLayerManager final : public WindowRenderer {
|
||||||
typedef nsTArray<RefPtr<Layer>> LayerRefArray;
|
typedef nsTArray<RefPtr<Layer>> LayerRefArray;
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,6 @@
|
||||||
#include "mozilla/layers/AnimationHelper.h"
|
#include "mozilla/layers/AnimationHelper.h"
|
||||||
#include "mozilla/layers/CompositorBridgeChild.h"
|
#include "mozilla/layers/CompositorBridgeChild.h"
|
||||||
#include "mozilla/layers/ImageClient.h"
|
#include "mozilla/layers/ImageClient.h"
|
||||||
#include "mozilla/layers/LayerManager.h"
|
|
||||||
#include "mozilla/layers/WebRenderBridgeChild.h"
|
#include "mozilla/layers/WebRenderBridgeChild.h"
|
||||||
#include "mozilla/layers/RenderRootStateManager.h"
|
#include "mozilla/layers/RenderRootStateManager.h"
|
||||||
#include "mozilla/layers/WebRenderMessages.h"
|
#include "mozilla/layers/WebRenderMessages.h"
|
||||||
|
|
|
||||||
|
|
@ -1,39 +0,0 @@
|
||||||
/* vim:set ts=2 sw=2 sts=2 et: */
|
|
||||||
/* Any copyright is dedicated to the Public Domain.
|
|
||||||
* http://creativecommons.org/publicdomain/zero/1.0/
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "TestLayers.h"
|
|
||||||
#include "gfxPlatform.h"
|
|
||||||
#include "gtest/gtest.h"
|
|
||||||
#include "gmock/gmock.h"
|
|
||||||
#include "LayerUserData.h"
|
|
||||||
#include "mozilla/layers/CompositorBridgeParent.h"
|
|
||||||
|
|
||||||
using namespace mozilla;
|
|
||||||
using namespace mozilla::gfx;
|
|
||||||
using namespace mozilla::layers;
|
|
||||||
|
|
||||||
class TestLayerManager : public LayerManager {
|
|
||||||
public:
|
|
||||||
TestLayerManager() : LayerManager() {}
|
|
||||||
|
|
||||||
virtual bool EndEmptyTransaction(EndTransactionFlags aFlags = END_DEFAULT) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
virtual void GetBackendName(nsAString& aName) {}
|
|
||||||
virtual LayersBackend GetBackendType() { return LayersBackend::LAYERS_BASIC; }
|
|
||||||
virtual bool BeginTransaction(const nsCString& = nsCString()) { return true; }
|
|
||||||
virtual void SetRoot(Layer* aLayer) {}
|
|
||||||
virtual bool BeginTransactionWithTarget(gfxContext* aTarget,
|
|
||||||
const nsCString& = nsCString()) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
virtual int32_t GetMaxTextureSize() const { return 0; }
|
|
||||||
};
|
|
||||||
|
|
||||||
class TestUserData : public LayerUserData {
|
|
||||||
public:
|
|
||||||
MOCK_METHOD0(Die, void());
|
|
||||||
virtual ~TestUserData() { Die(); }
|
|
||||||
};
|
|
||||||
|
|
@ -24,25 +24,4 @@ class TestSurfaceAllocator final : public ISurfaceAllocator {
|
||||||
} // namespace layers
|
} // namespace layers
|
||||||
} // namespace mozilla
|
} // namespace mozilla
|
||||||
|
|
||||||
/* Create layer tree from a simple layer tree description syntax.
|
|
||||||
* Each index is either the first letter of the layer type or
|
|
||||||
* a '(',')' to indicate the start/end of the child layers.
|
|
||||||
* The aim of this function is to remove hard to read
|
|
||||||
* layer tree creation code.
|
|
||||||
*
|
|
||||||
* Example "c(c(c(tt)t))" would yield:
|
|
||||||
* c
|
|
||||||
* |
|
|
||||||
* c
|
|
||||||
* / \
|
|
||||||
* c t
|
|
||||||
* / \
|
|
||||||
* t t
|
|
||||||
*/
|
|
||||||
already_AddRefed<mozilla::layers::Layer> CreateLayerTree(
|
|
||||||
const char* aLayerTreeDescription, nsIntRegion* aVisibleRegions,
|
|
||||||
const mozilla::gfx::Matrix4x4* aTransforms,
|
|
||||||
RefPtr<mozilla::layers::LayerManager>& aLayerManager,
|
|
||||||
nsTArray<RefPtr<mozilla::layers::Layer> >& aLayersOut);
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,6 @@ UNIFIED_SOURCES += [
|
||||||
"TestConfigManager.cpp",
|
"TestConfigManager.cpp",
|
||||||
"TestCoord.cpp",
|
"TestCoord.cpp",
|
||||||
"TestGfxWidgets.cpp",
|
"TestGfxWidgets.cpp",
|
||||||
"TestLayers.cpp",
|
|
||||||
"TestMatrix.cpp",
|
"TestMatrix.cpp",
|
||||||
"TestMoz2D.cpp",
|
"TestMoz2D.cpp",
|
||||||
"TestPolygon.cpp",
|
"TestPolygon.cpp",
|
||||||
|
|
|
||||||
|
|
@ -50,6 +50,7 @@
|
||||||
#include "nsProperties.h"
|
#include "nsProperties.h"
|
||||||
#include "prenv.h"
|
#include "prenv.h"
|
||||||
#include "prsystem.h"
|
#include "prsystem.h"
|
||||||
|
#include "WindowRenderer.h"
|
||||||
|
|
||||||
namespace mozilla {
|
namespace mozilla {
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -26,6 +26,7 @@
|
||||||
#include "nsPlaceholderFrame.h"
|
#include "nsPlaceholderFrame.h"
|
||||||
#include "nsSubDocumentFrame.h"
|
#include "nsSubDocumentFrame.h"
|
||||||
#include "RetainedDisplayListBuilder.h"
|
#include "RetainedDisplayListBuilder.h"
|
||||||
|
#include "WindowRenderer.h"
|
||||||
|
|
||||||
#include <ostream>
|
#include <ostream>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6374,8 +6374,8 @@ void PresShell::PaintInternal(nsView* aViewToPaint, PaintInternalFlags aFlags) {
|
||||||
|
|
||||||
if (renderer->EndEmptyTransaction(
|
if (renderer->EndEmptyTransaction(
|
||||||
(aFlags & PaintInternalFlags::PaintComposite)
|
(aFlags & PaintInternalFlags::PaintComposite)
|
||||||
? LayerManager::END_DEFAULT
|
? WindowRenderer::END_DEFAULT
|
||||||
: LayerManager::END_NO_COMPOSITE)) {
|
: WindowRenderer::END_NO_COMPOSITE)) {
|
||||||
frame->UpdatePaintCountForPaintedPresShells();
|
frame->UpdatePaintCountForPaintedPresShells();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -93,6 +93,7 @@
|
||||||
#include "mozilla/Unused.h"
|
#include "mozilla/Unused.h"
|
||||||
#include "MobileViewportManager.h"
|
#include "MobileViewportManager.h"
|
||||||
#include "VisualViewport.h"
|
#include "VisualViewport.h"
|
||||||
|
#include "WindowRenderer.h"
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <cstdlib> // for std::abs(int/long)
|
#include <cstdlib> // for std::abs(int/long)
|
||||||
#include <cmath> // for std::abs(float/double)
|
#include <cmath> // for std::abs(float/double)
|
||||||
|
|
|
||||||
|
|
@ -2235,7 +2235,7 @@ void nsDisplayList::PaintRoot(nsDisplayListBuilder* aBuilder, gfxContext* aCtx,
|
||||||
bool temp = aBuilder->SetIsCompositingCheap(renderer->IsCompositingCheap());
|
bool temp = aBuilder->SetIsCompositingCheap(renderer->IsCompositingCheap());
|
||||||
fallback->EndTransactionWithList(aBuilder, this,
|
fallback->EndTransactionWithList(aBuilder, this,
|
||||||
presContext->AppUnitsPerDevPixel(),
|
presContext->AppUnitsPerDevPixel(),
|
||||||
LayerManager::END_DEFAULT);
|
WindowRenderer::END_DEFAULT);
|
||||||
|
|
||||||
if (widgetTransaction ||
|
if (widgetTransaction ||
|
||||||
// SVG-as-an-image docs don't paint as part of the retained layer tree,
|
// SVG-as-an-image docs don't paint as part of the retained layer tree,
|
||||||
|
|
|
||||||
|
|
@ -31,6 +31,7 @@
|
||||||
#include "nsComponentManagerUtils.h"
|
#include "nsComponentManagerUtils.h"
|
||||||
#include "nsDocShell.h"
|
#include "nsDocShell.h"
|
||||||
#include "nsServiceManagerUtils.h"
|
#include "nsServiceManagerUtils.h"
|
||||||
|
#include "WindowRenderer.h"
|
||||||
|
|
||||||
#include "mozilla/dom/Element.h"
|
#include "mozilla/dom/Element.h"
|
||||||
#include "mozilla/dom/BrowsingContext.h"
|
#include "mozilla/dom/BrowsingContext.h"
|
||||||
|
|
|
||||||
|
|
@ -24,6 +24,7 @@
|
||||||
#include "nsLayoutUtils.h"
|
#include "nsLayoutUtils.h"
|
||||||
#include "Layers.h"
|
#include "Layers.h"
|
||||||
#include "gfxPlatform.h"
|
#include "gfxPlatform.h"
|
||||||
|
#include "WindowRenderer.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
XXX TODO XXX
|
XXX TODO XXX
|
||||||
|
|
|
||||||
|
|
@ -75,6 +75,7 @@ using mozilla::gfx::SurfaceFormat;
|
||||||
#include "GLContext.h"
|
#include "GLContext.h"
|
||||||
#include "GLContextProvider.h"
|
#include "GLContextProvider.h"
|
||||||
#include "Layers.h"
|
#include "Layers.h"
|
||||||
|
#include "WindowRenderer.h"
|
||||||
#include "ScopedGLHelpers.h"
|
#include "ScopedGLHelpers.h"
|
||||||
#include "mozilla/layers/APZEventState.h"
|
#include "mozilla/layers/APZEventState.h"
|
||||||
#include "mozilla/layers/APZInputBridge.h"
|
#include "mozilla/layers/APZInputBridge.h"
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue