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 |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 m_currentChunkId = WTF::nullopt; | 60 m_currentChunkId = WTF::nullopt; |
61 } else { | 61 } else { |
62 behavior = DefaultBehavior; | 62 behavior = DefaultBehavior; |
63 if (!item.skippedCache() && m_currentChunkId) | 63 if (!item.skippedCache() && m_currentChunkId) |
64 newChunkId.emplace(*m_currentChunkId); | 64 newChunkId.emplace(*m_currentChunkId); |
65 } | 65 } |
66 | 66 |
67 if (m_chunks.isEmpty()) { | 67 if (m_chunks.isEmpty()) { |
68 PaintChunk newChunk(0, 1, newChunkId ? &*newChunkId : nullptr, | 68 PaintChunk newChunk(0, 1, newChunkId ? &*newChunkId : nullptr, |
69 m_currentProperties); | 69 m_currentProperties); |
70 m_chunks.append(newChunk); | 70 m_chunks.push_back(newChunk); |
71 m_chunkBehavior.append(behavior); | 71 m_chunkBehavior.push_back(behavior); |
72 return true; | 72 return true; |
73 } | 73 } |
74 | 74 |
75 auto& lastChunk = m_chunks.back(); | 75 auto& lastChunk = m_chunks.back(); |
76 bool canContinueChunk = m_currentProperties == lastChunk.properties && | 76 bool canContinueChunk = m_currentProperties == lastChunk.properties && |
77 behavior != RequiresSeparateChunk && | 77 behavior != RequiresSeparateChunk && |
78 m_chunkBehavior.back() != RequiresSeparateChunk; | 78 m_chunkBehavior.back() != RequiresSeparateChunk; |
79 if (canContinueChunk) { | 79 if (canContinueChunk) { |
80 lastChunk.endIndex++; | 80 lastChunk.endIndex++; |
81 return false; | 81 return false; |
82 } | 82 } |
83 | 83 |
84 PaintChunk newChunk(lastChunk.endIndex, lastChunk.endIndex + 1, | 84 PaintChunk newChunk(lastChunk.endIndex, lastChunk.endIndex + 1, |
85 newChunkId ? &*newChunkId : nullptr, m_currentProperties); | 85 newChunkId ? &*newChunkId : nullptr, m_currentProperties); |
86 m_chunks.append(newChunk); | 86 m_chunks.push_back(newChunk); |
87 m_chunkBehavior.append(behavior); | 87 m_chunkBehavior.push_back(behavior); |
88 return true; | 88 return true; |
89 } | 89 } |
90 | 90 |
91 bool PaintChunker::decrementDisplayItemIndex() { | 91 bool PaintChunker::decrementDisplayItemIndex() { |
92 DCHECK(RuntimeEnabledFeatures::slimmingPaintV2Enabled()); | 92 DCHECK(RuntimeEnabledFeatures::slimmingPaintV2Enabled()); |
93 DCHECK(!m_chunks.isEmpty()); | 93 DCHECK(!m_chunks.isEmpty()); |
94 | 94 |
95 auto& lastChunk = m_chunks.back(); | 95 auto& lastChunk = m_chunks.back(); |
96 if ((lastChunk.endIndex - lastChunk.beginIndex) > 1) { | 96 if ((lastChunk.endIndex - lastChunk.beginIndex) > 1) { |
97 lastChunk.endIndex--; | 97 lastChunk.endIndex--; |
(...skipping 15 matching lines...) Expand all Loading... |
113 Vector<PaintChunk> PaintChunker::releasePaintChunks() { | 113 Vector<PaintChunk> PaintChunker::releasePaintChunks() { |
114 Vector<PaintChunk> chunks; | 114 Vector<PaintChunk> chunks; |
115 chunks.swap(m_chunks); | 115 chunks.swap(m_chunks); |
116 m_chunkBehavior.clear(); | 116 m_chunkBehavior.clear(); |
117 m_currentChunkId = WTF::nullopt; | 117 m_currentChunkId = WTF::nullopt; |
118 m_currentProperties = PaintChunkProperties(); | 118 m_currentProperties = PaintChunkProperties(); |
119 return chunks; | 119 return chunks; |
120 } | 120 } |
121 | 121 |
122 } // namespace blink | 122 } // namespace blink |
OLD | NEW |