diff --git a/dom/animation/KeyframeEffect.cpp b/dom/animation/KeyframeEffect.cpp index 3a3c533688040..d424c1afbf041 100644 --- a/dom/animation/KeyframeEffect.cpp +++ b/dom/animation/KeyframeEffect.cpp @@ -39,6 +39,7 @@ #include "nsPresContextInlines.h" #include "nsRefreshDriver.h" #include "js/PropertyAndElement.h" // JS_DefineProperty +#include "WindowRenderer.h" namespace mozilla { diff --git a/dom/canvas/CanvasRenderingContext2D.cpp b/dom/canvas/CanvasRenderingContext2D.cpp index a5ce3681228bd..ec2528458c604 100644 --- a/dom/canvas/CanvasRenderingContext2D.cpp +++ b/dom/canvas/CanvasRenderingContext2D.cpp @@ -124,6 +124,7 @@ #include "mozilla/layers/CanvasClient.h" #include "mozilla/layers/WebRenderUserData.h" #include "mozilla/layers/WebRenderCanvasRenderer.h" +#include "WindowRenderer.h" #undef free // apparently defined by some windows header, clashing with a // free() method in SkTypes.h diff --git a/dom/html/HTMLCanvasElement.cpp b/dom/html/HTMLCanvasElement.cpp index 4b9d0ee1d48ec..daa953647e221 100644 --- a/dom/html/HTMLCanvasElement.cpp +++ b/dom/html/HTMLCanvasElement.cpp @@ -51,6 +51,7 @@ #include "CanvasUtils.h" #include "VRManagerChild.h" #include "ClientWebGLContext.h" +#include "WindowRenderer.h" using namespace mozilla::layers; using namespace mozilla::gfx; diff --git a/dom/media/MediaDecoder.cpp b/dom/media/MediaDecoder.cpp index ca1c6bcd8b3e3..791de742298ca 100644 --- a/dom/media/MediaDecoder.cpp +++ b/dom/media/MediaDecoder.cpp @@ -35,6 +35,7 @@ #include "nsPrintfCString.h" #include "nsServiceManagerUtils.h" #include "nsTArray.h" +#include "WindowRenderer.h" #include #include diff --git a/dom/media/mediacapabilities/MediaCapabilities.cpp b/dom/media/mediacapabilities/MediaCapabilities.cpp index 4c25b32f0ee11..029ad7d787872 100644 --- a/dom/media/mediacapabilities/MediaCapabilities.cpp +++ b/dom/media/mediacapabilities/MediaCapabilities.cpp @@ -32,6 +32,7 @@ #include "mozilla/dom/WorkerRef.h" #include "mozilla/layers/KnowsCompositor.h" #include "nsContentUtils.h" +#include "WindowRenderer.h" static mozilla::LazyLogModule sMediaCapabilitiesLog("MediaCapabilities"); diff --git a/gfx/layers/LayerManager.h b/gfx/layers/LayerManager.h deleted file mode 100644 index 8e22c6498cede..0000000000000 --- a/gfx/layers/LayerManager.h +++ /dev/null @@ -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 // for uint32_t, uint64_t, int32_t, uint8_t -#include // for stringstream -#include // for operator new -#include // for unordered_set -#include // 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( - 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& 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 CreateImageContainer( - ImageContainer::Mode flag = ImageContainer::SYNCHRONOUS); - - /** - * Creates a DrawTarget which is optimized for inter-operating with this - * layer manager. - */ - virtual already_AddRefed 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 CreateOptimalMaskDrawTarget( - const IntSize& aSize); - - /** - * Creates a DrawTarget for use with canvas which is optimized for - * inter-operating with this layermanager. - */ - virtual already_AddRefed 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(aKey), aData, - LayerUserDataDestroy); - } - /** - * This can be used anytime. Ownership passes to the caller! - */ - UniquePtr RemoveUserData(void* aKey); - - /** - * This getter can be used anytime. - */ - bool HasUserData(void* aKey) { - return mUserData.Has(static_cast(aKey)); - } - /** - * This getter can be used anytime. Ownership is retained by the layer - * manager. - */ - LayerUserData* GetUserData(void* aKey) const { - return static_cast( - mUserData.Get(static_cast(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> GetPendingScrollInfoUpdate( - ScrollableLayerGuid::ViewID aScrollId); - std::unordered_set - ClearPendingScrollInfoUpdate(); - - protected: - ScrollUpdatesMap mPendingScrollUpdates; -}; - -} // namespace layers -} // namespace mozilla - -#endif /* GFX_LAYERS_H */ diff --git a/gfx/layers/Layers.cpp b/gfx/layers/Layers.cpp index 579bec7a3892d..5c0def830d8d2 100644 --- a/gfx/layers/Layers.cpp +++ b/gfx/layers/Layers.cpp @@ -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) { RefPtr surf = aTarget->Snapshot(); RefPtr dSurf = surf->GetDataSurface(); diff --git a/gfx/layers/Layers.h b/gfx/layers/Layers.h index be761f607cf54..8f01f6324fc47 100644 --- a/gfx/layers/Layers.h +++ b/gfx/layers/Layers.h @@ -32,7 +32,6 @@ #include "mozilla/gfx/UserData.h" // for UserData, UserDataKey (ptr only) #include "mozilla/layers/AnimationInfo.h" // for AnimationInfo #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/BSPTree.h" #include "nsISupports.h" // for NS_INLINE_DECL_REFCOUNTING @@ -124,8 +123,6 @@ void SetAntialiasingFlags(Layer* aLayer, gfx::DrawTarget* aTarget); #ifdef MOZ_DUMP_PAINTING void WriteSnapshotToDumpFile(Layer* aLayer, gfx::DataSourceSurface* aSurf); -void WriteSnapshotToDumpFile(LayerManager* aManager, - gfx::DataSourceSurface* aSurf); void WriteSnapshotToDumpFile(Compositor* aCompositor, gfx::DrawTarget* aTarget); #endif diff --git a/gfx/layers/apz/src/HitTestingTreeNode.h b/gfx/layers/apz/src/HitTestingTreeNode.h index 6ef0338c35ffb..ee44b21ebb0f5 100644 --- a/gfx/layers/apz/src/HitTestingTreeNode.h +++ b/gfx/layers/apz/src/HitTestingTreeNode.h @@ -13,8 +13,8 @@ #include "mozilla/layers/LayersTypes.h" // for EventRegions #include "mozilla/layers/ScrollableLayerGuid.h" // for ScrollableLayerGuid #include "mozilla/Maybe.h" // for Maybe +#include "mozilla/RecursiveMutex.h" // for RecursiveMutexAutoLock #include "mozilla/RefPtr.h" // for nsRefPtr - namespace mozilla { namespace layers { diff --git a/gfx/layers/moz.build b/gfx/layers/moz.build index 24797cf904dff..1d50e9594ae93 100755 --- a/gfx/layers/moz.build +++ b/gfx/layers/moz.build @@ -177,7 +177,6 @@ EXPORTS.mozilla.layers += [ "ipc/VideoBridgeParent.h", "ipc/VideoBridgeUtils.h", "LayerAttributes.h", - "LayerManager.h", "LayersTypes.h", "MemoryPressureObserver.h", "NativeLayer.h", diff --git a/gfx/layers/wr/WebRenderBridgeParent.h b/gfx/layers/wr/WebRenderBridgeParent.h index 02c32afd4cde6..f5984fbe3e673 100644 --- a/gfx/layers/wr/WebRenderBridgeParent.h +++ b/gfx/layers/wr/WebRenderBridgeParent.h @@ -15,7 +15,6 @@ #include "mozilla/DataMutex.h" #include "mozilla/layers/CompositableTransactionParent.h" #include "mozilla/layers/CompositorVsyncSchedulerOwner.h" -#include "mozilla/layers/LayerManager.h" #include "mozilla/layers/PWebRenderBridgeParent.h" #include "mozilla/HashTable.h" #include "mozilla/Maybe.h" diff --git a/gfx/layers/wr/WebRenderLayerManager.h b/gfx/layers/wr/WebRenderLayerManager.h index 2558d4be5f579..35d27f378f04e 100644 --- a/gfx/layers/wr/WebRenderLayerManager.h +++ b/gfx/layers/wr/WebRenderLayerManager.h @@ -23,12 +23,12 @@ #include "mozilla/layers/CompositorTypes.h" // for TextureFactoryIdentifier #include "mozilla/layers/DisplayItemCache.h" // for DisplayItemCache #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/RenderRootStateManager.h" // for RenderRootStateManager #include "mozilla/layers/ScrollableLayerGuid.h" // for ScrollableLayerGuid, ScrollableLayerGuid::ViewID #include "mozilla/layers/WebRenderCommandBuilder.h" // for WebRenderCommandBuilder #include "mozilla/layers/WebRenderScrollData.h" // for WebRenderScrollData +#include "WindowRenderer.h" #include "nsHashKeys.h" // for nsRefPtrHashKey #include "nsRegion.h" // for nsIntRegion #include "nsStringFwd.h" // for nsCString, nsAString @@ -52,6 +52,12 @@ class Layer; class PCompositorBridgeChild; class WebRenderBridgeChild; class WebRenderParentCommand; +class TransactionIdAllocator; +class LayerUserData; +class DidCompositeObserver { + public: + virtual void DidComposite() = 0; +}; class WebRenderLayerManager final : public WindowRenderer { typedef nsTArray> LayerRefArray; diff --git a/gfx/layers/wr/WebRenderUserData.cpp b/gfx/layers/wr/WebRenderUserData.cpp index 51a7eaae6b557..0825cefa8dec9 100644 --- a/gfx/layers/wr/WebRenderUserData.cpp +++ b/gfx/layers/wr/WebRenderUserData.cpp @@ -9,7 +9,6 @@ #include "mozilla/layers/AnimationHelper.h" #include "mozilla/layers/CompositorBridgeChild.h" #include "mozilla/layers/ImageClient.h" -#include "mozilla/layers/LayerManager.h" #include "mozilla/layers/WebRenderBridgeChild.h" #include "mozilla/layers/RenderRootStateManager.h" #include "mozilla/layers/WebRenderMessages.h" diff --git a/gfx/tests/gtest/TestLayers.cpp b/gfx/tests/gtest/TestLayers.cpp deleted file mode 100644 index 77b5e368b0eaf..0000000000000 --- a/gfx/tests/gtest/TestLayers.cpp +++ /dev/null @@ -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(); } -}; diff --git a/gfx/tests/gtest/TestLayers.h b/gfx/tests/gtest/TestLayers.h index 9812a39ff54e0..bcf7049b9ed58 100644 --- a/gfx/tests/gtest/TestLayers.h +++ b/gfx/tests/gtest/TestLayers.h @@ -24,25 +24,4 @@ class TestSurfaceAllocator final : public ISurfaceAllocator { } // namespace layers } // 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 CreateLayerTree( - const char* aLayerTreeDescription, nsIntRegion* aVisibleRegions, - const mozilla::gfx::Matrix4x4* aTransforms, - RefPtr& aLayerManager, - nsTArray >& aLayersOut); - #endif diff --git a/gfx/tests/gtest/moz.build b/gfx/tests/gtest/moz.build index 0d59e5cce0cb3..e2f82bdc725d1 100644 --- a/gfx/tests/gtest/moz.build +++ b/gfx/tests/gtest/moz.build @@ -16,7 +16,6 @@ UNIFIED_SOURCES += [ "TestConfigManager.cpp", "TestCoord.cpp", "TestGfxWidgets.cpp", - "TestLayers.cpp", "TestMatrix.cpp", "TestMoz2D.cpp", "TestPolygon.cpp", diff --git a/image/RasterImage.cpp b/image/RasterImage.cpp index 803284e3b0cf4..377fbd0652e60 100644 --- a/image/RasterImage.cpp +++ b/image/RasterImage.cpp @@ -50,6 +50,7 @@ #include "nsProperties.h" #include "prenv.h" #include "prsystem.h" +#include "WindowRenderer.h" namespace mozilla { diff --git a/layout/base/DisplayPortUtils.cpp b/layout/base/DisplayPortUtils.cpp index 037094866fb92..7dfe71194e11b 100644 --- a/layout/base/DisplayPortUtils.cpp +++ b/layout/base/DisplayPortUtils.cpp @@ -26,6 +26,7 @@ #include "nsPlaceholderFrame.h" #include "nsSubDocumentFrame.h" #include "RetainedDisplayListBuilder.h" +#include "WindowRenderer.h" #include diff --git a/layout/base/PresShell.cpp b/layout/base/PresShell.cpp index 466f8debb0da0..50a2099754a22 100644 --- a/layout/base/PresShell.cpp +++ b/layout/base/PresShell.cpp @@ -6374,8 +6374,8 @@ void PresShell::PaintInternal(nsView* aViewToPaint, PaintInternalFlags aFlags) { if (renderer->EndEmptyTransaction( (aFlags & PaintInternalFlags::PaintComposite) - ? LayerManager::END_DEFAULT - : LayerManager::END_NO_COMPOSITE)) { + ? WindowRenderer::END_DEFAULT + : WindowRenderer::END_NO_COMPOSITE)) { frame->UpdatePaintCountForPaintedPresShells(); return; } diff --git a/layout/generic/nsGfxScrollFrame.cpp b/layout/generic/nsGfxScrollFrame.cpp index 7bd9433ecc480..21e7a8c59bcb6 100644 --- a/layout/generic/nsGfxScrollFrame.cpp +++ b/layout/generic/nsGfxScrollFrame.cpp @@ -93,6 +93,7 @@ #include "mozilla/Unused.h" #include "MobileViewportManager.h" #include "VisualViewport.h" +#include "WindowRenderer.h" #include #include // for std::abs(int/long) #include // for std::abs(float/double) diff --git a/layout/painting/nsDisplayList.cpp b/layout/painting/nsDisplayList.cpp index 57062c5727fc0..b322c3cb4a9a7 100644 --- a/layout/painting/nsDisplayList.cpp +++ b/layout/painting/nsDisplayList.cpp @@ -2235,7 +2235,7 @@ void nsDisplayList::PaintRoot(nsDisplayListBuilder* aBuilder, gfxContext* aCtx, bool temp = aBuilder->SetIsCompositingCheap(renderer->IsCompositingCheap()); fallback->EndTransactionWithList(aBuilder, this, presContext->AppUnitsPerDevPixel(), - LayerManager::END_DEFAULT); + WindowRenderer::END_DEFAULT); if (widgetTransaction || // SVG-as-an-image docs don't paint as part of the retained layer tree, diff --git a/toolkit/components/browser/nsWebBrowser.cpp b/toolkit/components/browser/nsWebBrowser.cpp index 17a583be7e18e..83f86cbd60972 100644 --- a/toolkit/components/browser/nsWebBrowser.cpp +++ b/toolkit/components/browser/nsWebBrowser.cpp @@ -31,6 +31,7 @@ #include "nsComponentManagerUtils.h" #include "nsDocShell.h" #include "nsServiceManagerUtils.h" +#include "WindowRenderer.h" #include "mozilla/dom/Element.h" #include "mozilla/dom/BrowsingContext.h" diff --git a/view/nsViewManager.cpp b/view/nsViewManager.cpp index 1fcd55aa4afbe..6e039e7e9494b 100644 --- a/view/nsViewManager.cpp +++ b/view/nsViewManager.cpp @@ -24,6 +24,7 @@ #include "nsLayoutUtils.h" #include "Layers.h" #include "gfxPlatform.h" +#include "WindowRenderer.h" /** XXX TODO XXX diff --git a/widget/android/nsWindow.cpp b/widget/android/nsWindow.cpp index 8318830d982d8..b68abbed4ea27 100644 --- a/widget/android/nsWindow.cpp +++ b/widget/android/nsWindow.cpp @@ -75,6 +75,7 @@ using mozilla::gfx::SurfaceFormat; #include "GLContext.h" #include "GLContextProvider.h" #include "Layers.h" +#include "WindowRenderer.h" #include "ScopedGLHelpers.h" #include "mozilla/layers/APZEventState.h" #include "mozilla/layers/APZInputBridge.h"