| 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 #include "platform/TraceEvent.h" | 10 #include "platform/TraceEvent.h" |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 } | 140 } |
| 141 | 141 |
| 142 size_t DisplayItemList::findMatchingItemFromIndex(const DisplayItem::Id& id, con
st DisplayItemIndicesByClientMap& displayItemIndicesByClient, const DisplayItems
& list) | 142 size_t DisplayItemList::findMatchingItemFromIndex(const DisplayItem::Id& id, con
st DisplayItemIndicesByClientMap& displayItemIndicesByClient, const DisplayItems
& list) |
| 143 { | 143 { |
| 144 DisplayItemIndicesByClientMap::const_iterator it = displayItemIndicesByClien
t.find(id.client); | 144 DisplayItemIndicesByClientMap::const_iterator it = displayItemIndicesByClien
t.find(id.client); |
| 145 if (it == displayItemIndicesByClient.end()) | 145 if (it == displayItemIndicesByClient.end()) |
| 146 return kNotFound; | 146 return kNotFound; |
| 147 | 147 |
| 148 const Vector<size_t>& indices = it->value; | 148 const Vector<size_t>& indices = it->value; |
| 149 for (size_t index : indices) { | 149 for (size_t index : indices) { |
| 150 // TODO(pdr): elementAt is not cheap so this should be refactored (See c
rbug.com/505965). | |
| 151 const DisplayItem& existingItem = list[index]; | 150 const DisplayItem& existingItem = list[index]; |
| 152 ASSERT(!existingItem.isValid() || existingItem.client() == id.client); | 151 ASSERT(!existingItem.isValid() || existingItem.client() == id.client); |
| 153 if (existingItem.isValid() && id.matches(existingItem)) | 152 if (existingItem.isValid() && id.matches(existingItem)) |
| 154 return index; | 153 return index; |
| 155 } | 154 } |
| 156 | 155 |
| 157 return kNotFound; | 156 return kNotFound; |
| 158 } | 157 } |
| 159 | 158 |
| 160 void DisplayItemList::addItemToIndexIfNeeded(const DisplayItem& displayItem, siz
e_t index, DisplayItemIndicesByClientMap& displayItemIndicesByClient) | 159 void DisplayItemList::addItemToIndexIfNeeded(const DisplayItem& displayItem, siz
e_t index, DisplayItemIndicesByClientMap& displayItemIndicesByClient) |
| (...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 546 | 545 |
| 547 void DisplayItemList::replay(GraphicsContext& context) | 546 void DisplayItemList::replay(GraphicsContext& context) |
| 548 { | 547 { |
| 549 TRACE_EVENT0("blink,benchmark", "DisplayItemList::replay"); | 548 TRACE_EVENT0("blink,benchmark", "DisplayItemList::replay"); |
| 550 ASSERT(m_newDisplayItems.isEmpty()); | 549 ASSERT(m_newDisplayItems.isEmpty()); |
| 551 for (DisplayItem& displayItem : m_currentDisplayItems) | 550 for (DisplayItem& displayItem : m_currentDisplayItems) |
| 552 displayItem.replay(context); | 551 displayItem.replay(context); |
| 553 } | 552 } |
| 554 | 553 |
| 555 } // namespace blink | 554 } // namespace blink |
| OLD | NEW |