Chromium Code Reviews| 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" | 10 #include "platform/RuntimeEnabledFeatures.h" |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 85 std::unique_ptr<JSONObject> layersAsJSON(LayerTreeFlags) const; | 85 std::unique_ptr<JSONObject> layersAsJSON(LayerTreeFlags) const; |
| 86 | 86 |
| 87 #ifndef NDEBUG | 87 #ifndef NDEBUG |
| 88 void showDebugData(); | 88 void showDebugData(); |
| 89 #endif | 89 #endif |
| 90 | 90 |
| 91 private: | 91 private: |
| 92 // A pending layer is a collection of paint chunks that will end up in | 92 // A pending layer is a collection of paint chunks that will end up in |
| 93 // the same cc::Layer. | 93 // the same cc::Layer. |
| 94 struct PLATFORM_EXPORT PendingLayer { | 94 struct PLATFORM_EXPORT PendingLayer { |
| 95 PendingLayer(const PaintChunk& firstPaintChunk); | 95 PendingLayer(const PaintChunk& firstPaintChunk, |
| 96 void add(const PaintChunk&, GeometryMapper*); | 96 bool chunkIsForeign, |
| 97 GeometryMapper&); | |
| 98 void merge(const PendingLayer&, GeometryMapper&); | |
| 99 void upcast(const PropertyTreeState&, GeometryMapper&); | |
|
chrishtr
2017/02/28 22:50:35
Document these methods.
trchen
2017/03/01 01:26:11
Acknowledged.
trchen
2017/03/07 01:41:24
Done.
| |
| 97 FloatRect bounds; | 100 FloatRect bounds; |
| 98 Vector<const PaintChunk*> paintChunks; | 101 Vector<const PaintChunk*> paintChunks; |
| 99 bool knownToBeOpaque; | 102 bool knownToBeOpaque; |
| 100 bool backfaceHidden; | 103 bool backfaceHidden; |
| 101 PropertyTreeState propertyTreeState; | 104 PropertyTreeState propertyTreeState; |
| 105 bool isForeign; | |
| 102 }; | 106 }; |
| 103 | 107 |
| 104 PaintArtifactCompositor(); | 108 PaintArtifactCompositor(); |
| 105 | 109 |
| 106 class ContentLayerClientImpl; | 110 class ContentLayerClientImpl; |
| 107 | 111 |
| 108 // Collects the PaintChunks into groups which will end up in the same | 112 // Collects the PaintChunks into groups which will end up in the same |
| 109 // cc layer. This includes testing PaintChunks for "merge" compatibility (e.g. | 113 // cc layer. This includes testing PaintChunks for "merge" compatibility (e.g. |
| 110 // directly composited property tree states are separately composited) | 114 // directly composited property tree states are separately composited) |
| 111 // and overlap testing (PaintChunks that overlap existing PaintLayers they | 115 // and overlap testing (PaintChunks that overlap existing PaintLayers they |
| (...skipping 23 matching lines...) Expand all Loading... | |
| 135 const PaintChunk&, | 139 const PaintChunk&, |
| 136 const PaintArtifact&); | 140 const PaintArtifact&); |
| 137 | 141 |
| 138 // This method is an implementation of Algorithm step 4 from goo.gl/6xP8Oe. | 142 // This method is an implementation of Algorithm step 4 from goo.gl/6xP8Oe. |
| 139 static scoped_refptr<cc::DisplayItemList> recordPendingLayer( | 143 static scoped_refptr<cc::DisplayItemList> recordPendingLayer( |
| 140 const PaintArtifact&, | 144 const PaintArtifact&, |
| 141 const PendingLayer&, | 145 const PendingLayer&, |
| 142 const gfx::Rect& combinedBounds, | 146 const gfx::Rect& combinedBounds, |
| 143 GeometryMapper&); | 147 GeometryMapper&); |
| 144 | 148 |
| 145 static bool canMergeInto(const PaintArtifact&, | 149 static void layerizeGroup(const PaintArtifact&, |
|
chrishtr
2017/02/28 22:50:35
Document this method.
trchen
2017/03/01 01:26:11
Acknowledged.
trchen
2017/03/07 01:41:24
Done.
| |
| 146 const PaintChunk& newChunk, | 150 Vector<PendingLayer>& pendingLayers, |
| 147 const PendingLayer& candidatePendingLayer); | 151 GeometryMapper&, |
| 148 | 152 const EffectPaintPropertyNode&, |
| 149 // Returns true if |newChunk| might overlap |candidatePendingLayer| in the | 153 Vector<PaintChunk>::const_iterator& chunkCursor); |
| 150 // root property tree space. If it does overlap, it will always return true. | |
| 151 // If it doesn't overlap, it might return true in cases were we can't | |
| 152 // efficiently determine a false value, or the truth depends on | |
| 153 // compositor animations. | |
| 154 static bool mightOverlap(const PaintChunk& newChunk, | |
| 155 const PendingLayer& candidatePendingLayer, | |
| 156 GeometryMapper&); | |
| 157 | 154 |
| 158 scoped_refptr<cc::Layer> m_rootLayer; | 155 scoped_refptr<cc::Layer> m_rootLayer; |
| 159 std::unique_ptr<WebLayer> m_webLayer; | 156 std::unique_ptr<WebLayer> m_webLayer; |
| 160 Vector<std::unique_ptr<ContentLayerClientImpl>> m_contentLayerClients; | 157 Vector<std::unique_ptr<ContentLayerClientImpl>> m_contentLayerClients; |
| 161 | 158 |
| 162 bool m_extraDataForTestingEnabled = false; | 159 bool m_extraDataForTestingEnabled = false; |
| 163 std::unique_ptr<ExtraDataForTesting> m_extraDataForTesting; | 160 std::unique_ptr<ExtraDataForTesting> m_extraDataForTesting; |
| 164 friend class StubChromeClientForSPv2; | 161 friend class StubChromeClientForSPv2; |
| 165 | 162 |
| 166 bool m_isTrackingRasterInvalidations; | 163 bool m_isTrackingRasterInvalidations; |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 203 PendingLayer); | 200 PendingLayer); |
| 204 FRIEND_TEST_ALL_PREFIXES(PaintArtifactCompositorTestWithPropertyTrees, | 201 FRIEND_TEST_ALL_PREFIXES(PaintArtifactCompositorTestWithPropertyTrees, |
| 205 PendingLayerWithGeometry); | 202 PendingLayerWithGeometry); |
| 206 FRIEND_TEST_ALL_PREFIXES(PaintArtifactCompositorTestWithPropertyTrees, | 203 FRIEND_TEST_ALL_PREFIXES(PaintArtifactCompositorTestWithPropertyTrees, |
| 207 PendingLayerKnownOpaque); | 204 PendingLayerKnownOpaque); |
| 208 }; | 205 }; |
| 209 | 206 |
| 210 } // namespace blink | 207 } // namespace blink |
| 211 | 208 |
| 212 #endif // PaintArtifactCompositor_h | 209 #endif // PaintArtifactCompositor_h |
| OLD | NEW |