| 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/ListContainer.h" | 9 #include "platform/graphics/ListContainer.h" |
| 10 #include "platform/graphics/paint/DisplayItem.h" | 10 #include "platform/graphics/paint/DisplayItem.h" |
| 11 #include "platform/graphics/paint/Transform3DDisplayItem.h" | 11 #include "platform/graphics/paint/Transform3DDisplayItem.h" |
| 12 #include "wtf/HashMap.h" | 12 #include "wtf/HashMap.h" |
| 13 #include "wtf/PassOwnPtr.h" | 13 #include "wtf/PassOwnPtr.h" |
| 14 #include "wtf/Utility.h" | 14 #include "wtf/Utility.h" |
| 15 #include "wtf/Vector.h" | 15 #include "wtf/Vector.h" |
| 16 | 16 |
| 17 namespace blink { | 17 namespace blink { |
| 18 | 18 |
| 19 class GraphicsContext; | 19 class GraphicsContext; |
| 20 | 20 |
| 21 using DisplayItems = ListContainer<DisplayItem>; | 21 using DisplayItems = ListContainer<DisplayItem>; |
| 22 | 22 |
| 23 static const size_t kInitialDisplayItemsCapacity = 64; | 23 static const size_t kInitialDisplayItemsCapacity = 64; |
| 24 static const size_t kMaximumDisplayItemSize = sizeof(BeginTransform3DDisplayItem
); | 24 static const size_t kMaximumDisplayItemSize = sizeof(BeginTransform3DDisplayItem
); |
| 25 | 25 |
| 26 class DisplayListDiff { |
| 27 Vector<int> diffOffsets; |
| 28 }; |
| 29 |
| 26 class PLATFORM_EXPORT DisplayItemList { | 30 class PLATFORM_EXPORT DisplayItemList { |
| 27 WTF_MAKE_NONCOPYABLE(DisplayItemList); | 31 WTF_MAKE_NONCOPYABLE(DisplayItemList); |
| 28 WTF_MAKE_FAST_ALLOCATED(DisplayItemList); | 32 WTF_MAKE_FAST_ALLOCATED(DisplayItemList); |
| 29 public: | 33 public: |
| 30 static PassOwnPtr<DisplayItemList> create() | 34 static PassOwnPtr<DisplayItemList> create() |
| 31 { | 35 { |
| 32 return adoptPtr(new DisplayItemList()); | 36 return adoptPtr(new DisplayItemList()); |
| 33 } | 37 } |
| 34 | 38 |
| 35 // These methods are called during paint invalidation. | 39 // These methods are called during paint invalidation. |
| (...skipping 17 matching lines...) Expand all Loading... |
| 53 void endScope(DisplayItemClient); | 57 void endScope(DisplayItemClient); |
| 54 | 58 |
| 55 // True if the last display item is a begin that doesn't draw content. | 59 // True if the last display item is a begin that doesn't draw content. |
| 56 bool lastDisplayItemIsNoopBegin() const; | 60 bool lastDisplayItemIsNoopBegin() const; |
| 57 void removeLastDisplayItem(); | 61 void removeLastDisplayItem(); |
| 58 | 62 |
| 59 void beginSkippingCache() { ++m_skippingCacheCount; } | 63 void beginSkippingCache() { ++m_skippingCacheCount; } |
| 60 void endSkippingCache() { ASSERT(m_skippingCacheCount > 0); --m_skippingCach
eCount; } | 64 void endSkippingCache() { ASSERT(m_skippingCacheCount > 0); --m_skippingCach
eCount; } |
| 61 bool skippingCache() const { return m_skippingCacheCount; } | 65 bool skippingCache() const { return m_skippingCacheCount; } |
| 62 | 66 |
| 63 // Must be called when a painting is finished. | 67 // Must be called when a painting is finished. If passed, the diff is initia
lized |
| 64 void commitNewDisplayItems(); | 68 // to the difference of the new display list from the last time commitNewDis
playItems() was called. |
| 69 void commitNewDisplayItems(DisplayListDiff* = 0); |
| 65 | 70 |
| 66 // Returns the approximate memory usage, excluding memory likely to be | 71 // Returns the approximate memory usage, excluding memory likely to be |
| 67 // shared with the embedder after copying to WebDisplayItemList. | 72 // shared with the embedder after copying to WebDisplayItemList. |
| 68 // Should only be called right after commitNewDisplayItems. | 73 // Should only be called right after commitNewDisplayItems. |
| 69 size_t approximateUnsharedMemoryUsage() const; | 74 size_t approximateUnsharedMemoryUsage() const; |
| 70 | 75 |
| 71 // Get the paint list generated after the last painting. | 76 // Get the paint list generated after the last painting. |
| 72 const DisplayItems& displayItems() const; | 77 const DisplayItems& displayItems() const; |
| 73 | 78 |
| 74 bool clientCacheIsValid(DisplayItemClient) const; | 79 bool clientCacheIsValid(DisplayItemClient) const; |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 169 // This is used to check duplicated ids during add(). We could also check du
ring | 174 // This is used to check duplicated ids during add(). We could also check du
ring |
| 170 // updatePaintList(), but checking during add() helps developer easily find
where | 175 // updatePaintList(), but checking during add() helps developer easily find
where |
| 171 // the duplicated ids are from. | 176 // the duplicated ids are from. |
| 172 DisplayItemIndicesByClientMap m_newDisplayItemIndicesByClient; | 177 DisplayItemIndicesByClientMap m_newDisplayItemIndicesByClient; |
| 173 #endif | 178 #endif |
| 174 }; | 179 }; |
| 175 | 180 |
| 176 } // namespace blink | 181 } // namespace blink |
| 177 | 182 |
| 178 #endif // DisplayItemList_h | 183 #endif // DisplayItemList_h |
| OLD | NEW |