| 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" | |
| 10 #include "platform/TraceEvent.h" | 9 #include "platform/TraceEvent.h" |
| 11 #include "platform/graphics/paint/DrawingDisplayItem.h" | 10 #include "platform/graphics/paint/DrawingDisplayItem.h" |
| 12 | 11 |
| 13 #if ENABLE(ASSERT) | 12 #if ENABLE(ASSERT) |
| 14 #include "third_party/skia/include/core/SkBitmap.h" | 13 #include "third_party/skia/include/core/SkBitmap.h" |
| 15 #include "third_party/skia/include/core/SkCanvas.h" | 14 #include "third_party/skia/include/core/SkCanvas.h" |
| 16 #include "third_party/skia/include/core/SkData.h" | 15 #include "third_party/skia/include/core/SkData.h" |
| 17 #include "third_party/skia/include/core/SkStream.h" | 16 #include "third_party/skia/include/core/SkStream.h" |
| 18 #endif | 17 #endif |
| 19 | 18 |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 m_scopeStack.append(m_nextScope++); | 104 m_scopeStack.append(m_nextScope++); |
| 106 beginSkippingCache(); | 105 beginSkippingCache(); |
| 107 } | 106 } |
| 108 | 107 |
| 109 void DisplayItemList::endScope() | 108 void DisplayItemList::endScope() |
| 110 { | 109 { |
| 111 m_scopeStack.removeLast(); | 110 m_scopeStack.removeLast(); |
| 112 endSkippingCache(); | 111 endSkippingCache(); |
| 113 } | 112 } |
| 114 | 113 |
| 115 void DisplayItemList::invalidate(DisplayItemClient client) | 114 void DisplayItemList::invalidate(const DisplayItemClientWrapper& client) |
| 115 { |
| 116 invalidateUntracked(client.displayItemClient()); |
| 117 |
| 118 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled() && m_trackedPaintInvali
dationObjects) |
| 119 m_trackedPaintInvalidationObjects->append(client.debugName()); |
| 120 } |
| 121 |
| 122 void DisplayItemList::invalidateUntracked(DisplayItemClient client) |
| 116 { | 123 { |
| 117 ASSERT(RuntimeEnabledFeatures::slimmingPaintEnabled()); | 124 ASSERT(RuntimeEnabledFeatures::slimmingPaintEnabled()); |
| 118 // Can only be called during layout/paintInvalidation, not during painting. | 125 // Can only be called during layout/paintInvalidation, not during painting. |
| 119 ASSERT(m_newDisplayItems.isEmpty()); | 126 ASSERT(m_newDisplayItems.isEmpty()); |
| 120 updateValidlyCachedClientsIfNeeded(); | 127 updateValidlyCachedClientsIfNeeded(); |
| 121 m_validlyCachedClients.remove(client); | 128 m_validlyCachedClients.remove(client); |
| 122 } | 129 } |
| 123 | 130 |
| 124 void DisplayItemList::invalidateAll() | 131 void DisplayItemList::invalidateAll() |
| 125 { | 132 { |
| 126 ASSERT(RuntimeEnabledFeatures::slimmingPaintEnabled()); | 133 ASSERT(RuntimeEnabledFeatures::slimmingPaintEnabled()); |
| 127 // Can only be called during layout/paintInvalidation, not during painting. | 134 // Can only be called during layout/paintInvalidation, not during painting. |
| 128 ASSERT(m_newDisplayItems.isEmpty()); | 135 ASSERT(m_newDisplayItems.isEmpty()); |
| 129 m_currentDisplayItems.clear(); | 136 m_currentDisplayItems.clear(); |
| 130 m_validlyCachedClients.clear(); | 137 m_validlyCachedClients.clear(); |
| 131 m_validlyCachedClientsDirty = false; | 138 m_validlyCachedClientsDirty = false; |
| 139 |
| 140 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled() && m_trackedPaintInvali
dationObjects) |
| 141 m_trackedPaintInvalidationObjects->append("##ALL##"); |
| 132 } | 142 } |
| 133 | 143 |
| 134 bool DisplayItemList::clientCacheIsValid(DisplayItemClient client) const | 144 bool DisplayItemList::clientCacheIsValid(DisplayItemClient client) const |
| 135 { | 145 { |
| 136 if (skippingCache()) | 146 if (skippingCache()) |
| 137 return false; | 147 return false; |
| 138 updateValidlyCachedClientsIfNeeded(); | 148 updateValidlyCachedClientsIfNeeded(); |
| 139 return m_validlyCachedClients.contains(client); | 149 return m_validlyCachedClients.contains(client); |
| 140 } | 150 } |
| 141 | 151 |
| (...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 541 | 551 |
| 542 void DisplayItemList::replay(GraphicsContext& context) | 552 void DisplayItemList::replay(GraphicsContext& context) |
| 543 { | 553 { |
| 544 TRACE_EVENT0("blink,benchmark", "DisplayItemList::replay"); | 554 TRACE_EVENT0("blink,benchmark", "DisplayItemList::replay"); |
| 545 ASSERT(m_newDisplayItems.isEmpty()); | 555 ASSERT(m_newDisplayItems.isEmpty()); |
| 546 for (DisplayItem& displayItem : m_currentDisplayItems) | 556 for (DisplayItem& displayItem : m_currentDisplayItems) |
| 547 displayItem.replay(context); | 557 displayItem.replay(context); |
| 548 } | 558 } |
| 549 | 559 |
| 550 } // namespace blink | 560 } // namespace blink |
| OLD | NEW |