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 #include "platform/graphics/paint/PaintChunker.h" | 5 #include "platform/graphics/paint/PaintChunker.h" |
6 | 6 |
7 #include "platform/RuntimeEnabledFeatures.h" | 7 #include "platform/RuntimeEnabledFeatures.h" |
8 | 8 |
9 namespace blink { | 9 namespace blink { |
10 | 10 |
11 #if DCHECK_IS_ON() | |
12 static bool gNullPaintPropertyChecksDisabled = false; | |
13 DisableNullPaintPropertyChecks::DisableNullPaintPropertyChecks() | |
14 : m_disabler(&gNullPaintPropertyChecksDisabled, true) {} | |
15 #endif | |
16 | |
17 PaintChunker::PaintChunker() {} | 11 PaintChunker::PaintChunker() {} |
18 | 12 |
19 PaintChunker::~PaintChunker() {} | 13 PaintChunker::~PaintChunker() {} |
20 | 14 |
21 void PaintChunker::updateCurrentPaintChunkProperties( | 15 void PaintChunker::updateCurrentPaintChunkProperties( |
22 const PaintChunk::Id* chunkId, | 16 const PaintChunk::Id* chunkId, |
23 const PaintChunkProperties& properties) { | 17 const PaintChunkProperties& properties) { |
24 DCHECK(RuntimeEnabledFeatures::slimmingPaintV2Enabled()); | 18 DCHECK(RuntimeEnabledFeatures::slimmingPaintV2Enabled()); |
25 | 19 |
26 m_currentChunkId = WTF::nullopt; | 20 m_currentChunkId = WTF::nullopt; |
27 if (chunkId) | 21 if (chunkId) |
28 m_currentChunkId.emplace(*chunkId); | 22 m_currentChunkId.emplace(*chunkId); |
29 m_currentProperties = properties; | 23 m_currentProperties = properties; |
30 } | 24 } |
31 | 25 |
32 bool PaintChunker::incrementDisplayItemIndex(const DisplayItem& item) { | 26 bool PaintChunker::incrementDisplayItemIndex(const DisplayItem& item) { |
33 DCHECK(RuntimeEnabledFeatures::slimmingPaintV2Enabled()); | 27 DCHECK(RuntimeEnabledFeatures::slimmingPaintV2Enabled()); |
34 | 28 |
35 #if DCHECK_IS_ON() | 29 #if DCHECK_IS_ON() |
36 if (!gNullPaintPropertyChecksDisabled) { | 30 // Property nodes should never be null because they should either be set to |
37 // Property nodes should never be null because they should either be set to | 31 // properties created by a LayoutObject/FrameView, or be set to a non-null |
38 // properties created by a LayoutObject/FrameView, or be set to a non-null | 32 // root node. If these DCHECKs are hit we are missing a call to update the |
39 // root node. If these DCHECKs are hit we are missing a call to update the | 33 // properties. See: ScopedPaintChunkProperties. |
40 // properties. See: ScopedPaintChunkProperties. | 34 DCHECK(m_currentProperties.propertyTreeState.transform()); |
41 DCHECK(m_currentProperties.propertyTreeState.transform()); | 35 DCHECK(m_currentProperties.propertyTreeState.clip()); |
42 DCHECK(m_currentProperties.propertyTreeState.clip()); | 36 DCHECK(m_currentProperties.propertyTreeState.effect()); |
43 DCHECK(m_currentProperties.propertyTreeState.effect()); | |
44 } | |
45 #endif | 37 #endif |
46 | 38 |
47 ItemBehavior behavior; | 39 ItemBehavior behavior; |
48 Optional<PaintChunk::Id> newChunkId; | 40 Optional<PaintChunk::Id> newChunkId; |
49 if (DisplayItem::isForeignLayerType(item.getType())) { | 41 if (DisplayItem::isForeignLayerType(item.getType())) { |
50 behavior = RequiresSeparateChunk; | 42 behavior = RequiresSeparateChunk; |
51 // Use null chunkId if we are skipping cache, so that the chunk will not | 43 // Use null chunkId if we are skipping cache, so that the chunk will not |
52 // match any old chunk and will be treated as brand new. | 44 // match any old chunk and will be treated as brand new. |
53 if (!item.skippedCache()) | 45 if (!item.skippedCache()) |
54 newChunkId.emplace(item.getId()); | 46 newChunkId.emplace(item.getId()); |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 Vector<PaintChunk> PaintChunker::releasePaintChunks() { | 104 Vector<PaintChunk> PaintChunker::releasePaintChunks() { |
113 Vector<PaintChunk> chunks; | 105 Vector<PaintChunk> chunks; |
114 chunks.swap(m_chunks); | 106 chunks.swap(m_chunks); |
115 m_chunkBehavior.clear(); | 107 m_chunkBehavior.clear(); |
116 m_currentChunkId = WTF::nullopt; | 108 m_currentChunkId = WTF::nullopt; |
117 m_currentProperties = PaintChunkProperties(); | 109 m_currentProperties = PaintChunkProperties(); |
118 return chunks; | 110 return chunks; |
119 } | 111 } |
120 | 112 |
121 } // namespace blink | 113 } // namespace blink |
OLD | NEW |