OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "config.h" | 5 #include "config.h" |
6 #include "platform/graphics/paint/DisplayItemList.h" | 6 #include "platform/graphics/paint/DisplayItemList.h" |
7 | 7 |
8 #include "platform/NotImplemented.h" | 8 #include "platform/NotImplemented.h" |
9 #include "platform/RuntimeEnabledFeatures.h" | 9 #include "platform/RuntimeEnabledFeatures.h" |
10 #ifndef NDEBUG | 10 #ifndef NDEBUG |
11 #include "platform/graphics/paint/DisplayItem.h" | 11 #include "platform/graphics/paint/DisplayItem.h" |
12 #include "wtf/text/StringBuilder.h" | 12 #include "wtf/text/StringBuilder.h" |
13 #include <stdio.h> | 13 #include <stdio.h> |
14 #endif | 14 #endif |
15 | 15 |
16 namespace blink { | 16 namespace blink { |
17 | 17 |
18 const PaintList& DisplayItemList::paintList() | 18 const PaintList& DisplayItemList::paintList() |
19 { | 19 { |
20 ASSERT(RuntimeEnabledFeatures::slimmingPaintEnabled()); | 20 ASSERT(RuntimeEnabledFeatures::slimmingPaintEnabled()); |
21 ASSERT(m_newPaints.isEmpty()); | 21 ASSERT(m_newPaints.isEmpty()); |
22 return m_paintList; | 22 return m_paintList; |
23 } | 23 } |
24 | 24 |
25 void DisplayItemList::add(WTF::PassOwnPtr<DisplayItem> displayItem) | 25 void DisplayItemList::add(WTF::PassOwnPtr<DisplayItem> displayItem) |
26 { | 26 { |
27 ASSERT(RuntimeEnabledFeatures::slimmingPaintEnabled()); | 27 ASSERT(RuntimeEnabledFeatures::slimmingPaintEnabled()); |
| 28 |
| 29 if (displayItem->isEnd()) { |
| 30 ASSERT(!m_newPaints.isEmpty()); |
| 31 if (m_newPaints.last()->isBegin()) { |
| 32 ASSERT(displayItem->isEndAndPairedWith(*m_newPaints.last())); |
| 33 // Remove empty pairs. |
| 34 m_newPaints.removeLast(); |
| 35 return; |
| 36 } |
| 37 } |
28 m_newPaints.append(displayItem); | 38 m_newPaints.append(displayItem); |
29 } | 39 } |
30 | 40 |
31 void DisplayItemList::invalidate(DisplayItemClient client) | 41 void DisplayItemList::invalidate(DisplayItemClient client) |
32 { | 42 { |
33 ASSERT(RuntimeEnabledFeatures::slimmingPaintEnabled()); | 43 ASSERT(RuntimeEnabledFeatures::slimmingPaintEnabled()); |
34 m_cachedClients.remove(client); | 44 m_cachedClients.remove(client); |
35 } | 45 } |
36 | 46 |
37 void DisplayItemList::invalidateAll() | 47 void DisplayItemList::invalidateAll() |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
156 #endif | 166 #endif |
157 | 167 |
158 void DisplayItemList::replay(GraphicsContext* context) | 168 void DisplayItemList::replay(GraphicsContext* context) |
159 { | 169 { |
160 updatePaintList(); | 170 updatePaintList(); |
161 for (auto& displayItem : m_paintList) | 171 for (auto& displayItem : m_paintList) |
162 displayItem->replay(context); | 172 displayItem->replay(context); |
163 } | 173 } |
164 | 174 |
165 } // namespace blink | 175 } // namespace blink |
OLD | NEW |