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 "wtf/Noncopyable.h" | 10 #include "wtf/Noncopyable.h" |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
42 // Updates the layer tree to match the provided paint artifact. | 42 // Updates the layer tree to match the provided paint artifact. |
43 void update(const PaintArtifact&); | 43 void update(const PaintArtifact&); |
44 | 44 |
45 // The root layer of the tree managed by this object. | 45 // The root layer of the tree managed by this object. |
46 cc::Layer* rootLayer() const { return m_rootLayer.get(); } | 46 cc::Layer* rootLayer() const { return m_rootLayer.get(); } |
47 | 47 |
48 // Wraps rootLayer(), so that it can be attached as a child of another | 48 // Wraps rootLayer(), so that it can be attached as a child of another |
49 // WebLayer. | 49 // WebLayer. |
50 WebLayer* getWebLayer() const { return m_webLayer.get(); } | 50 WebLayer* getWebLayer() const { return m_webLayer.get(); } |
51 | 51 |
52 // Returns extra information recorded during unit tests. | |
53 // While not part of the normal output of this class, this provides a simple | |
54 // way of locating the layers of interest, since there are still a slew of | |
55 // placeholder layers required. | |
56 struct ExtraDataForTesting { | |
57 Vector<scoped_refptr<cc::Layer>> contentLayers; | |
jbroman
2016/06/27 20:34:29
I'm not thrilled with this, but I need some way to
| |
58 }; | |
59 void enableExtraDataForTesting() { m_extraDataForTestingEnabled = true; } | |
60 ExtraDataForTesting* getExtraDataForTesting() const { return m_extraDataForT esting.get(); } | |
61 | |
52 private: | 62 private: |
53 class ContentLayerClientImpl; | 63 class ContentLayerClientImpl; |
54 | 64 |
55 void updateInLayerListMode(const PaintArtifact&); | 65 void updateInLayerListMode(const PaintArtifact&); |
56 | 66 |
57 // Builds a leaf layer that represents a single paint chunk. | 67 // Builds a leaf layer that represents a single paint chunk. |
58 // Note: cc::Layer API assumes the layer bounds to start at (0, 0) but the b ounding box of | 68 // Note: cc::Layer API assumes the layer bounds to start at (0, 0) but the b ounding box of |
59 // a paint chunk does not necessarily start at (0, 0) and could even be nega tive. Internally | 69 // a paint chunk does not necessarily start at (0, 0) and could even be nega tive. Internally |
60 // the generated layer translates the paint chunk to align the bounding box to (0, 0) and | 70 // the generated layer translates the paint chunk to align the bounding box to (0, 0) and |
61 // return the actual origin of the paint chunk in output parameter layerOffs et. | 71 // return the actual origin of the paint chunk in output parameter layerOffs et. |
62 scoped_refptr<cc::Layer> layerForPaintChunk(const PaintArtifact&, const Pain tChunk&, gfx::Vector2dF& layerOffset); | 72 scoped_refptr<cc::Layer> layerForPaintChunk(const PaintArtifact&, const Pain tChunk&, gfx::Vector2dF& layerOffset); |
63 | 73 |
64 scoped_refptr<cc::Layer> m_rootLayer; | 74 scoped_refptr<cc::Layer> m_rootLayer; |
65 std::unique_ptr<WebLayer> m_webLayer; | 75 std::unique_ptr<WebLayer> m_webLayer; |
66 Vector<std::unique_ptr<ContentLayerClientImpl>> m_contentLayerClients; | 76 Vector<std::unique_ptr<ContentLayerClientImpl>> m_contentLayerClients; |
77 | |
78 bool m_extraDataForTestingEnabled = false; | |
79 std::unique_ptr<ExtraDataForTesting> m_extraDataForTesting; | |
67 }; | 80 }; |
68 | 81 |
69 } // namespace blink | 82 } // namespace blink |
70 | 83 |
71 #endif // PaintArtifactCompositor_h | 84 #endif // PaintArtifactCompositor_h |
OLD | NEW |