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

Side by Side Diff: third_party/WebKit/Source/platform/graphics/paint/PaintChunker.cpp

Issue 2480863002: DCHECK that paint properties are never null (Closed)
Patch Set: Fix null paint properties in FrameView scrollbar painting Created 4 years, 1 month 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 #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 PaintChunker::PaintChunker() {} 11 PaintChunker::PaintChunker() {}
12 12
13 PaintChunker::~PaintChunker() {} 13 PaintChunker::~PaintChunker() {}
14 14
15 void PaintChunker::updateCurrentPaintChunkProperties( 15 void PaintChunker::updateCurrentPaintChunkProperties(
16 const PaintChunk::Id* chunkId, 16 const PaintChunk::Id* chunkId,
17 const PaintChunkProperties& properties) { 17 const PaintChunkProperties& properties) {
18 DCHECK(RuntimeEnabledFeatures::slimmingPaintV2Enabled()); 18 DCHECK(RuntimeEnabledFeatures::slimmingPaintV2Enabled());
19 19
20 m_currentChunkId = WTF::nullopt; 20 m_currentChunkId = WTF::nullopt;
21 if (chunkId) 21 if (chunkId)
22 m_currentChunkId.emplace(*chunkId); 22 m_currentChunkId.emplace(*chunkId);
23 m_currentProperties = properties; 23 m_currentProperties = properties;
24 } 24 }
25 25
26 bool PaintChunker::incrementDisplayItemIndex(const DisplayItem& item) { 26 bool PaintChunker::incrementDisplayItemIndex(const DisplayItem& item) {
27 DCHECK(RuntimeEnabledFeatures::slimmingPaintV2Enabled()); 27 DCHECK(RuntimeEnabledFeatures::slimmingPaintV2Enabled());
28 28
29 // Property nodes should never be null because they should either be set to
30 // properties created by a LayoutObject/FrameView, or be set to a non-null
31 // root node. If these DCHECKs are hit we are missing a call to update the
32 // properties. See: ScopedPaintChunkProperties.
33 DCHECK(m_currentProperties.transform);
34 DCHECK(m_currentProperties.clip);
35 DCHECK(m_currentProperties.effect);
36 DCHECK(m_currentProperties.scroll);
37
29 ItemBehavior behavior; 38 ItemBehavior behavior;
30 Optional<PaintChunk::Id> newChunkId; 39 Optional<PaintChunk::Id> newChunkId;
31 if (DisplayItem::isForeignLayerType(item.getType())) { 40 if (DisplayItem::isForeignLayerType(item.getType())) {
32 behavior = RequiresSeparateChunk; 41 behavior = RequiresSeparateChunk;
33 // Use null chunkId if we are skipping cache, so that the chunk will not 42 // Use null chunkId if we are skipping cache, so that the chunk will not
34 // match any old chunk and will be treated as brand new. 43 // match any old chunk and will be treated as brand new.
35 if (!item.skippedCache()) 44 if (!item.skippedCache())
36 newChunkId.emplace(item.getId()); 45 newChunkId.emplace(item.getId());
37 46
38 // Clear m_currentChunkId so that any display items after the foreign layer 47 // Clear m_currentChunkId so that any display items after the foreign layer
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 Vector<PaintChunk> PaintChunker::releasePaintChunks() { 103 Vector<PaintChunk> PaintChunker::releasePaintChunks() {
95 Vector<PaintChunk> chunks; 104 Vector<PaintChunk> chunks;
96 chunks.swap(m_chunks); 105 chunks.swap(m_chunks);
97 m_chunkBehavior.clear(); 106 m_chunkBehavior.clear();
98 m_currentChunkId = WTF::nullopt; 107 m_currentChunkId = WTF::nullopt;
99 m_currentProperties = PaintChunkProperties(); 108 m_currentProperties = PaintChunkProperties();
100 return chunks; 109 return chunks;
101 } 110 }
102 111
103 } // namespace blink 112 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698