| 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 #ifndef DisplayItemList_h | 5 #ifndef DisplayItemList_h |
| 6 #define DisplayItemList_h | 6 #define DisplayItemList_h |
| 7 | 7 |
| 8 #include "platform/PlatformExport.h" | 8 #include "platform/PlatformExport.h" |
| 9 #include "platform/graphics/paint/DisplayItem.h" | 9 #include "platform/graphics/paint/DisplayItem.h" |
| 10 #include "platform/graphics/paint/DisplayItems.h" | 10 #include "platform/graphics/paint/DisplayItems.h" |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 #endif | 67 #endif |
| 68 | 68 |
| 69 #ifndef NDEBUG | 69 #ifndef NDEBUG |
| 70 void showDebugData() const; | 70 void showDebugData() const; |
| 71 #endif | 71 #endif |
| 72 | 72 |
| 73 protected: | 73 protected: |
| 74 DisplayItemList() | 74 DisplayItemList() |
| 75 : m_validlyCachedClientsDirty(false) | 75 : m_validlyCachedClientsDirty(false) |
| 76 , m_constructionDisabled(false) | 76 , m_constructionDisabled(false) |
| 77 , m_skippingCacheCount(0) { } | 77 , m_skippingCacheCount(0) |
| 78 , m_numCachedItems(0) { } |
| 78 | 79 |
| 79 private: | 80 private: |
| 80 friend class DisplayItemListTest; | 81 friend class DisplayItemListTest; |
| 81 friend class DisplayItemListPaintTest; | 82 friend class DisplayItemListPaintTest; |
| 82 friend class LayoutObjectDrawingRecorderTest; | 83 friend class LayoutObjectDrawingRecorderTest; |
| 83 | 84 |
| 84 void updateValidlyCachedClientsIfNeeded() const; | 85 void updateValidlyCachedClientsIfNeeded() const; |
| 85 | 86 |
| 86 #ifndef NDEBUG | 87 #ifndef NDEBUG |
| 87 WTF::String displayItemsAsDebugString(const DisplayItems&) const; | 88 WTF::String displayItemsAsDebugString(const DisplayItems&) const; |
| (...skipping 26 matching lines...) Expand all Loading... |
| 114 // to avoid the cost of building and querying the hash table. | 115 // to avoid the cost of building and querying the hash table. |
| 115 mutable HashSet<DisplayItemClient> m_validlyCachedClients; | 116 mutable HashSet<DisplayItemClient> m_validlyCachedClients; |
| 116 mutable bool m_validlyCachedClientsDirty; | 117 mutable bool m_validlyCachedClientsDirty; |
| 117 | 118 |
| 118 // Allow display item construction to be disabled to isolate the costs of co
nstruction | 119 // Allow display item construction to be disabled to isolate the costs of co
nstruction |
| 119 // in performance metrics. | 120 // in performance metrics. |
| 120 bool m_constructionDisabled; | 121 bool m_constructionDisabled; |
| 121 | 122 |
| 122 int m_skippingCacheCount; | 123 int m_skippingCacheCount; |
| 123 | 124 |
| 125 int m_numCachedItems; |
| 126 |
| 124 // Scope ids are allocated per client to ensure that the ids are stable for
non-invalidated | 127 // Scope ids are allocated per client to ensure that the ids are stable for
non-invalidated |
| 125 // clients between frames, so that we can use the id to match new display it
ems to cached | 128 // clients between frames, so that we can use the id to match new display it
ems to cached |
| 126 // display items. | 129 // display items. |
| 127 struct Scope { | 130 struct Scope { |
| 128 Scope(DisplayItemClient c, int i) : client(c), id(i) { } | 131 Scope(DisplayItemClient c, int i) : client(c), id(i) { } |
| 129 DisplayItemClient client; | 132 DisplayItemClient client; |
| 130 int id; | 133 int id; |
| 131 }; | 134 }; |
| 132 typedef HashMap<DisplayItemClient, int> ClientScopeIdMap; | 135 typedef HashMap<DisplayItemClient, int> ClientScopeIdMap; |
| 133 ClientScopeIdMap m_clientScopeIdMap; | 136 ClientScopeIdMap m_clientScopeIdMap; |
| 134 Vector<Scope> m_scopeStack; | 137 Vector<Scope> m_scopeStack; |
| 135 | 138 |
| 136 #if ENABLE(ASSERT) | 139 #if ENABLE(ASSERT) |
| 137 // This is used to check duplicated ids during add(). We could also check du
ring | 140 // This is used to check duplicated ids during add(). We could also check du
ring |
| 138 // updatePaintList(), but checking during add() helps developer easily find
where | 141 // updatePaintList(), but checking during add() helps developer easily find
where |
| 139 // the duplicated ids are from. | 142 // the duplicated ids are from. |
| 140 DisplayItemIndicesByClientMap m_newDisplayItemIndicesByClient; | 143 DisplayItemIndicesByClientMap m_newDisplayItemIndicesByClient; |
| 141 #endif | 144 #endif |
| 142 }; | 145 }; |
| 143 | 146 |
| 144 } // namespace blink | 147 } // namespace blink |
| 145 | 148 |
| 146 #endif // DisplayItemList_h | 149 #endif // DisplayItemList_h |
| OLD | NEW |