| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef PaintArtifactCompositor_h | 5 #ifndef PaintArtifactCompositor_h |
| 6 #define PaintArtifactCompositor_h | 6 #define PaintArtifactCompositor_h |
| 7 | 7 |
| 8 #include <memory> |
| 8 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
| 9 #include "platform/PlatformExport.h" | 10 #include "platform/PlatformExport.h" |
| 10 #include "platform/RuntimeEnabledFeatures.h" | 11 #include "platform/RuntimeEnabledFeatures.h" |
| 11 #include "platform/graphics/GraphicsLayerClient.h" | 12 #include "platform/graphics/GraphicsLayerClient.h" |
| 12 #include "platform/graphics/paint/PaintController.h" | 13 #include "platform/graphics/paint/PaintController.h" |
| 14 #include "wtf/HashSet.h" |
| 13 #include "wtf/Noncopyable.h" | 15 #include "wtf/Noncopyable.h" |
| 14 #include "wtf/PtrUtil.h" | 16 #include "wtf/PtrUtil.h" |
| 15 #include "wtf/Vector.h" | 17 #include "wtf/Vector.h" |
| 16 #include <memory> | |
| 17 | 18 |
| 18 namespace cc { | 19 namespace cc { |
| 19 class Layer; | 20 class Layer; |
| 20 } | 21 } |
| 21 | 22 |
| 22 namespace gfx { | 23 namespace gfx { |
| 23 class Vector2dF; | 24 class Vector2dF; |
| 24 } | 25 } |
| 25 | 26 |
| 26 namespace blink { | 27 namespace blink { |
| 27 | 28 |
| 28 class GeometryMapper; | 29 class GeometryMapper; |
| 29 class JSONObject; | 30 class JSONObject; |
| 30 class PaintArtifact; | 31 class PaintArtifact; |
| 31 class WebLayer; | 32 class WebLayer; |
| 32 struct PaintChunk; | 33 struct PaintChunk; |
| 33 | 34 |
| 35 using CompositorElementIdSet = HashSet<CompositorElementId, |
| 36 CompositorElementIdHash, |
| 37 CompositorElementIdHashTraits>; |
| 38 |
| 34 // Responsible for managing compositing in terms of a PaintArtifact. | 39 // Responsible for managing compositing in terms of a PaintArtifact. |
| 35 // | 40 // |
| 36 // Owns a subtree of the compositor layer tree, and updates it in response to | 41 // Owns a subtree of the compositor layer tree, and updates it in response to |
| 37 // changes in the paint artifact. | 42 // changes in the paint artifact. |
| 38 // | 43 // |
| 39 // PaintArtifactCompositor is the successor to PaintLayerCompositor, reflecting | 44 // PaintArtifactCompositor is the successor to PaintLayerCompositor, reflecting |
| 40 // the new home of compositing decisions after paint in Slimming Paint v2. | 45 // the new home of compositing decisions after paint in Slimming Paint v2. |
| 41 class PLATFORM_EXPORT PaintArtifactCompositor { | 46 class PLATFORM_EXPORT PaintArtifactCompositor { |
| 42 WTF_MAKE_NONCOPYABLE(PaintArtifactCompositor); | 47 WTF_MAKE_NONCOPYABLE(PaintArtifactCompositor); |
| 43 | 48 |
| 44 public: | 49 public: |
| 45 ~PaintArtifactCompositor(); | 50 ~PaintArtifactCompositor(); |
| 46 | 51 |
| 47 static std::unique_ptr<PaintArtifactCompositor> create() { | 52 static std::unique_ptr<PaintArtifactCompositor> create() { |
| 48 return WTF::wrapUnique(new PaintArtifactCompositor()); | 53 return WTF::wrapUnique(new PaintArtifactCompositor()); |
| 49 } | 54 } |
| 50 | 55 |
| 51 // Updates the layer tree to match the provided paint artifact. | 56 // Updates the layer tree to match the provided paint artifact. |
| 57 // |
| 58 // Populates |compositedAnimationElementIds| with the CompositorElementId of |
| 59 // all animations for which we saw a paint chunk and created a layer. |
| 60 // |
| 52 // If |storeDebugInfo| is true, stores detailed debugging information in | 61 // If |storeDebugInfo| is true, stores detailed debugging information in |
| 53 // the layers that will be output as part of a call to layersAsJSON | 62 // the layers that will be output as part of a call to layersAsJSON |
| 54 // (if LayerTreeIncludesDebugInfo is specified). | 63 // (if LayerTreeIncludesDebugInfo is specified). |
| 55 void update( | 64 void update( |
| 56 const PaintArtifact&, | 65 const PaintArtifact&, |
| 57 RasterInvalidationTrackingMap<const PaintChunk>* paintChunkInvalidations, | 66 RasterInvalidationTrackingMap<const PaintChunk>* paintChunkInvalidations, |
| 58 bool storeDebugInfo, | 67 bool storeDebugInfo, |
| 59 GeometryMapper&); | 68 GeometryMapper&, |
| 69 CompositorElementIdSet& compositedAnimationElementIds); |
| 60 | 70 |
| 61 // The root layer of the tree managed by this object. | 71 // The root layer of the tree managed by this object. |
| 62 cc::Layer* rootLayer() const { return m_rootLayer.get(); } | 72 cc::Layer* rootLayer() const { return m_rootLayer.get(); } |
| 63 | 73 |
| 64 // Wraps rootLayer(), so that it can be attached as a child of another | 74 // Wraps rootLayer(), so that it can be attached as a child of another |
| 65 // WebLayer. | 75 // WebLayer. |
| 66 WebLayer* getWebLayer() const { return m_webLayer.get(); } | 76 WebLayer* getWebLayer() const { return m_webLayer.get(); } |
| 67 | 77 |
| 68 // Returns extra information recorded during unit tests. | 78 // Returns extra information recorded during unit tests. |
| 69 // While not part of the normal output of this class, this provides a simple | 79 // While not part of the normal output of this class, this provides a simple |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 218 PendingLayer); | 228 PendingLayer); |
| 219 FRIEND_TEST_ALL_PREFIXES(PaintArtifactCompositorTestWithPropertyTrees, | 229 FRIEND_TEST_ALL_PREFIXES(PaintArtifactCompositorTestWithPropertyTrees, |
| 220 PendingLayerWithGeometry); | 230 PendingLayerWithGeometry); |
| 221 FRIEND_TEST_ALL_PREFIXES(PaintArtifactCompositorTestWithPropertyTrees, | 231 FRIEND_TEST_ALL_PREFIXES(PaintArtifactCompositorTestWithPropertyTrees, |
| 222 PendingLayerKnownOpaque_DISABLED); | 232 PendingLayerKnownOpaque_DISABLED); |
| 223 }; | 233 }; |
| 224 | 234 |
| 225 } // namespace blink | 235 } // namespace blink |
| 226 | 236 |
| 227 #endif // PaintArtifactCompositor_h | 237 #endif // PaintArtifactCompositor_h |
| OLD | NEW |