| 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 "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
| 9 #include "platform/PlatformExport.h" | 9 #include "platform/PlatformExport.h" |
| 10 #include "platform/RuntimeEnabledFeatures.h" |
| 11 #include "platform/graphics/GraphicsLayerClient.h" |
| 10 #include "wtf/Noncopyable.h" | 12 #include "wtf/Noncopyable.h" |
| 11 #include "wtf/PtrUtil.h" | 13 #include "wtf/PtrUtil.h" |
| 12 #include "wtf/Vector.h" | 14 #include "wtf/Vector.h" |
| 13 #include <memory> | 15 #include <memory> |
| 14 | 16 |
| 15 namespace cc { | 17 namespace cc { |
| 16 class Layer; | 18 class Layer; |
| 17 } | 19 } |
| 18 | 20 |
| 19 namespace gfx { | 21 namespace gfx { |
| 20 class Transform; | 22 class Transform; |
| 21 class Vector2dF; | 23 class Vector2dF; |
| 22 } | 24 } |
| 23 | 25 |
| 24 namespace blink { | 26 namespace blink { |
| 25 | 27 |
| 28 class DisplayItemClient; |
| 29 class IntRect; |
| 30 class JSONObject; |
| 26 class PaintArtifact; | 31 class PaintArtifact; |
| 27 class WebLayer; | 32 class WebLayer; |
| 28 struct PaintChunk; | 33 struct PaintChunk; |
| 29 | 34 |
| 30 // Responsible for managing compositing in terms of a PaintArtifact. | 35 // Responsible for managing compositing in terms of a PaintArtifact. |
| 31 // | 36 // |
| 32 // Owns a subtree of the compositor layer tree, and updates it in response to | 37 // Owns a subtree of the compositor layer tree, and updates it in response to |
| 33 // changes in the paint artifact. | 38 // changes in the paint artifact. |
| 34 // | 39 // |
| 35 // PaintArtifactCompositor is the successor to PaintLayerCompositor, reflecting | 40 // PaintArtifactCompositor is the successor to PaintLayerCompositor, reflecting |
| (...skipping 21 matching lines...) Expand all Loading... |
| 57 // Returns extra information recorded during unit tests. | 62 // Returns extra information recorded during unit tests. |
| 58 // While not part of the normal output of this class, this provides a simple | 63 // While not part of the normal output of this class, this provides a simple |
| 59 // way of locating the layers of interest, since there are still a slew of | 64 // way of locating the layers of interest, since there are still a slew of |
| 60 // placeholder layers required. | 65 // placeholder layers required. |
| 61 struct ExtraDataForTesting { | 66 struct ExtraDataForTesting { |
| 62 Vector<scoped_refptr<cc::Layer>> contentLayers; | 67 Vector<scoped_refptr<cc::Layer>> contentLayers; |
| 63 }; | 68 }; |
| 64 void enableExtraDataForTesting() { m_extraDataForTestingEnabled = true; } | 69 void enableExtraDataForTesting() { m_extraDataForTestingEnabled = true; } |
| 65 ExtraDataForTesting* getExtraDataForTesting() const { return m_extraDataForT
esting.get(); } | 70 ExtraDataForTesting* getExtraDataForTesting() const { return m_extraDataForT
esting.get(); } |
| 66 | 71 |
| 72 void setTracksPaintInvalidations(bool); |
| 73 void resetTrackedPaintInvalidations(); |
| 74 bool hasTrackedPaintInvalidations() const; |
| 75 |
| 76 std::unique_ptr<JSONObject> layersAsJSON(LayerTreeFlags) const; |
| 77 |
| 67 private: | 78 private: |
| 68 PaintArtifactCompositor(); | 79 PaintArtifactCompositor(); |
| 69 | 80 |
| 70 class ContentLayerClientImpl; | 81 class ContentLayerClientImpl; |
| 71 | 82 |
| 72 // Builds a leaf layer that represents a single paint chunk. | 83 // Builds a leaf layer that represents a single paint chunk. |
| 73 // Note: cc::Layer API assumes the layer bounds to start at (0, 0) but the b
ounding box of | 84 // Note: cc::Layer API assumes the layer bounds to start at (0, 0) but the b
ounding box of |
| 74 // a paint chunk does not necessarily start at (0, 0) and could even be nega
tive. Internally | 85 // a paint chunk does not necessarily start at (0, 0) and could even be nega
tive. Internally |
| 75 // the generated layer translates the paint chunk to align the bounding box
to (0, 0) and | 86 // the generated layer translates the paint chunk to align the bounding box
to (0, 0) and |
| 76 // return the actual origin of the paint chunk in output parameter layerOffs
et. | 87 // return the actual origin of the paint chunk in output parameter layerOffs
et. |
| 77 scoped_refptr<cc::Layer> layerForPaintChunk(const PaintArtifact&, const Pain
tChunk&, gfx::Vector2dF& layerOffset, | 88 scoped_refptr<cc::Layer> layerForPaintChunk(const PaintArtifact&, const Pain
tChunk&, gfx::Vector2dF& layerOffset, |
| 78 Vector<std::unique_ptr<ContentLayerClientImpl>>& newContentLayerClients)
; | 89 Vector<std::unique_ptr<ContentLayerClientImpl>>& newContentLayerClients)
; |
| 79 | 90 |
| 80 // Finds a client among the current vector of clients that matches the paint
chunk's id, | 91 // Finds a client among the current vector of clients that matches the paint
chunk's id, |
| 81 // or otherwise allocates a new one. | 92 // or otherwise allocates a new one. |
| 82 std::unique_ptr<ContentLayerClientImpl> clientForPaintChunk(const PaintChunk
&); | 93 std::unique_ptr<ContentLayerClientImpl> clientForPaintChunk(const PaintChunk
&, const PaintArtifact&); |
| 83 | 94 |
| 84 scoped_refptr<cc::Layer> m_rootLayer; | 95 scoped_refptr<cc::Layer> m_rootLayer; |
| 85 std::unique_ptr<WebLayer> m_webLayer; | 96 std::unique_ptr<WebLayer> m_webLayer; |
| 86 Vector<std::unique_ptr<ContentLayerClientImpl>> m_contentLayerClients; | 97 Vector<std::unique_ptr<ContentLayerClientImpl>> m_contentLayerClients; |
| 87 | 98 |
| 88 bool m_extraDataForTestingEnabled = false; | 99 bool m_extraDataForTestingEnabled = false; |
| 89 std::unique_ptr<ExtraDataForTesting> m_extraDataForTesting; | 100 std::unique_ptr<ExtraDataForTesting> m_extraDataForTesting; |
| 90 friend class StubChromeClientForSPv2; | 101 friend class StubChromeClientForSPv2; |
| 102 |
| 103 bool m_isTrackingPaintInvalidations; |
| 91 }; | 104 }; |
| 92 | 105 |
| 93 } // namespace blink | 106 } // namespace blink |
| 94 | 107 |
| 95 #endif // PaintArtifactCompositor_h | 108 #endif // PaintArtifactCompositor_h |
| OLD | NEW |