Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(208)

Side by Side Diff: third_party/WebKit/Source/platform/graphics/compositing/PaintArtifactCompositor.h

Issue 2380683006: SPv2: Add support for tracking raster paint invalidations in testing. (Closed)
Patch Set: none Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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"
12 #include "platform/graphics/paint/PaintController.h"
10 #include "wtf/Noncopyable.h" 13 #include "wtf/Noncopyable.h"
11 #include "wtf/PtrUtil.h" 14 #include "wtf/PtrUtil.h"
12 #include "wtf/Vector.h" 15 #include "wtf/Vector.h"
13 #include <memory> 16 #include <memory>
14 17
15 namespace cc { 18 namespace cc {
16 class Layer; 19 class Layer;
17 } 20 }
18 21
19 namespace gfx { 22 namespace gfx {
20 class Transform; 23 class Transform;
21 class Vector2dF; 24 class Vector2dF;
22 } 25 }
23 26
24 namespace blink { 27 namespace blink {
25 28
29 class DisplayItemClient;
30 class IntRect;
31 class JSONObject;
26 class PaintArtifact; 32 class PaintArtifact;
27 class WebLayer; 33 class WebLayer;
28 struct PaintChunk; 34 struct PaintChunk;
29 35
30 // Responsible for managing compositing in terms of a PaintArtifact. 36 // Responsible for managing compositing in terms of a PaintArtifact.
31 // 37 //
32 // Owns a subtree of the compositor layer tree, and updates it in response to 38 // Owns a subtree of the compositor layer tree, and updates it in response to
33 // changes in the paint artifact. 39 // changes in the paint artifact.
34 // 40 //
35 // PaintArtifactCompositor is the successor to PaintLayerCompositor, reflecting 41 // PaintArtifactCompositor is the successor to PaintLayerCompositor, reflecting
36 // the new home of compositing decisions after paint in Slimming Paint v2. 42 // the new home of compositing decisions after paint in Slimming Paint v2.
37 class PLATFORM_EXPORT PaintArtifactCompositor { 43 class PLATFORM_EXPORT PaintArtifactCompositor {
38 WTF_MAKE_NONCOPYABLE(PaintArtifactCompositor); 44 WTF_MAKE_NONCOPYABLE(PaintArtifactCompositor);
39 public: 45 public:
40 ~PaintArtifactCompositor(); 46 ~PaintArtifactCompositor();
41 47
42 static std::unique_ptr<PaintArtifactCompositor> create() 48 static std::unique_ptr<PaintArtifactCompositor> create()
43 { 49 {
44 return wrapUnique(new PaintArtifactCompositor()); 50 return wrapUnique(new PaintArtifactCompositor());
45 } 51 }
46 52
47 // Updates the layer tree to match the provided paint artifact. 53 // Updates the layer tree to match the provided paint artifact.
48 void update(const PaintArtifact&); 54 void update(const PaintArtifact&, RasterInvalidationTrackingMap<const PaintC hunk>* paintChunkInvalidations);
49 55
50 // The root layer of the tree managed by this object. 56 // The root layer of the tree managed by this object.
51 cc::Layer* rootLayer() const { return m_rootLayer.get(); } 57 cc::Layer* rootLayer() const { return m_rootLayer.get(); }
52 58
53 // Wraps rootLayer(), so that it can be attached as a child of another 59 // Wraps rootLayer(), so that it can be attached as a child of another
54 // WebLayer. 60 // WebLayer.
55 WebLayer* getWebLayer() const { return m_webLayer.get(); } 61 WebLayer* getWebLayer() const { return m_webLayer.get(); }
56 62
57 // Returns extra information recorded during unit tests. 63 // Returns extra information recorded during unit tests.
58 // While not part of the normal output of this class, this provides a simple 64 // 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 65 // way of locating the layers of interest, since there are still a slew of
60 // placeholder layers required. 66 // placeholder layers required.
61 struct ExtraDataForTesting { 67 struct ExtraDataForTesting {
62 Vector<scoped_refptr<cc::Layer>> contentLayers; 68 Vector<scoped_refptr<cc::Layer>> contentLayers;
63 }; 69 };
64 void enableExtraDataForTesting() { m_extraDataForTestingEnabled = true; } 70 void enableExtraDataForTesting() { m_extraDataForTestingEnabled = true; }
65 ExtraDataForTesting* getExtraDataForTesting() const { return m_extraDataForT esting.get(); } 71 ExtraDataForTesting* getExtraDataForTesting() const { return m_extraDataForT esting.get(); }
66 72
73 void setTracksRasterInvalidations(bool);
74 void resetTrackedRasterInvalidations();
75 bool hasTrackedRasterInvalidations() const;
76
77 std::unique_ptr<JSONObject> layersAsJSON(LayerTreeFlags) const;
78
67 private: 79 private:
68 PaintArtifactCompositor(); 80 PaintArtifactCompositor();
69 81
70 class ContentLayerClientImpl; 82 class ContentLayerClientImpl;
71 83
72 // Builds a leaf layer that represents a single paint chunk. 84 // 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 85 // 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 86 // 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 87 // 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. 88 // 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, 89 scoped_refptr<cc::Layer> layerForPaintChunk(const PaintArtifact&, const Pain tChunk&, gfx::Vector2dF& layerOffset,
78 Vector<std::unique_ptr<ContentLayerClientImpl>>& newContentLayerClients) ; 90 Vector<std::unique_ptr<ContentLayerClientImpl>>& newContentLayerClients, RasterInvalidationTracking*);
79 91
80 // Finds a client among the current vector of clients that matches the paint chunk's id, 92 // Finds a client among the current vector of clients that matches the paint chunk's id,
81 // or otherwise allocates a new one. 93 // or otherwise allocates a new one.
82 std::unique_ptr<ContentLayerClientImpl> clientForPaintChunk(const PaintChunk &); 94 std::unique_ptr<ContentLayerClientImpl> clientForPaintChunk(const PaintChunk &, const PaintArtifact&);
83 95
84 scoped_refptr<cc::Layer> m_rootLayer; 96 scoped_refptr<cc::Layer> m_rootLayer;
85 std::unique_ptr<WebLayer> m_webLayer; 97 std::unique_ptr<WebLayer> m_webLayer;
86 Vector<std::unique_ptr<ContentLayerClientImpl>> m_contentLayerClients; 98 Vector<std::unique_ptr<ContentLayerClientImpl>> m_contentLayerClients;
87 99
88 bool m_extraDataForTestingEnabled = false; 100 bool m_extraDataForTestingEnabled = false;
89 std::unique_ptr<ExtraDataForTesting> m_extraDataForTesting; 101 std::unique_ptr<ExtraDataForTesting> m_extraDataForTesting;
90 friend class StubChromeClientForSPv2; 102 friend class StubChromeClientForSPv2;
103
104 bool m_isTrackingRasterInvalidations;
91 }; 105 };
92 106
93 } // namespace blink 107 } // namespace blink
94 108
95 #endif // PaintArtifactCompositor_h 109 #endif // PaintArtifactCompositor_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698