Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(62)

Side by Side Diff: Source/platform/graphics/paint/DisplayItemList.h

Issue 1287093004: Slimming Paint phase 2 compositing algorithm plumbing (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Address reviewer comments Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/ContiguousContainer.h" 9 #include "platform/graphics/ContiguousContainer.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/Alignment.h" 12 #include "wtf/Alignment.h"
13 #include "wtf/HashMap.h" 13 #include "wtf/HashMap.h"
14 #include "wtf/PassOwnPtr.h" 14 #include "wtf/PassOwnPtr.h"
15 #include "wtf/Utility.h" 15 #include "wtf/Utility.h"
16 #include "wtf/Vector.h" 16 #include "wtf/Vector.h"
17 17
18 namespace blink { 18 namespace blink {
19 19
20 class GraphicsContext; 20 class GraphicsContext;
21 21
22 // kDisplayItemAlignment must be a multiple of alignof(derived display item) for 22 // kDisplayItemAlignment must be a multiple of alignof(derived display item) for
23 // each derived display item; the ideal value is the least common multiple. 23 // each derived display item; the ideal value is the least common multiple.
24 // Currently the limiting factor is TransformtionMatrix (in 24 // Currently the limiting factor is TransformtionMatrix (in
25 // BeginTransform3DDisplayItem), which requests 16-byte alignment. 25 // BeginTransform3DDisplayItem), which requests 16-byte alignment.
26 static const size_t kDisplayItemAlignment = WTF_ALIGN_OF(BeginTransform3DDisplay Item); 26 static const size_t kDisplayItemAlignment = WTF_ALIGN_OF(BeginTransform3DDisplay Item);
27 static const size_t kInitialDisplayItemsCapacity = 64; 27 static const size_t kInitialDisplayItemsCapacity = 64;
28 static const size_t kMaximumDisplayItemSize = sizeof(BeginTransform3DDisplayItem ); 28 static const size_t kMaximumDisplayItemSize = sizeof(BeginTransform3DDisplayItem );
29 29
30 // Map from SimpleLayer.startPoint to the DrawingDisplayItems within its range
31 // which were invalidated on this frame and do not change SimpleLayers.
32 using DisplayListDiff = HashMap<DisplayItemClient, DisplayItem*>;
33
30 using DisplayItems = ContiguousContainer<DisplayItem, kDisplayItemAlignment>; 34 using DisplayItems = ContiguousContainer<DisplayItem, kDisplayItemAlignment>;
31 35
32 class PLATFORM_EXPORT DisplayItemList { 36 class PLATFORM_EXPORT DisplayItemList {
33 WTF_MAKE_NONCOPYABLE(DisplayItemList); 37 WTF_MAKE_NONCOPYABLE(DisplayItemList);
34 WTF_MAKE_FAST_ALLOCATED(DisplayItemList); 38 WTF_MAKE_FAST_ALLOCATED(DisplayItemList);
35 public: 39 public:
36 static PassOwnPtr<DisplayItemList> create() 40 static PassOwnPtr<DisplayItemList> create()
37 { 41 {
38 return adoptPtr(new DisplayItemList()); 42 return adoptPtr(new DisplayItemList());
39 } 43 }
(...skipping 23 matching lines...) Expand all
63 void endScope(); 67 void endScope();
64 68
65 // True if the last display item is a begin that doesn't draw content. 69 // True if the last display item is a begin that doesn't draw content.
66 bool lastDisplayItemIsNoopBegin() const; 70 bool lastDisplayItemIsNoopBegin() const;
67 void removeLastDisplayItem(); 71 void removeLastDisplayItem();
68 72
69 void beginSkippingCache() { ++m_skippingCacheCount; } 73 void beginSkippingCache() { ++m_skippingCacheCount; }
70 void endSkippingCache() { ASSERT(m_skippingCacheCount > 0); --m_skippingCach eCount; } 74 void endSkippingCache() { ASSERT(m_skippingCacheCount > 0); --m_skippingCach eCount; }
71 bool skippingCache() const { return m_skippingCacheCount; } 75 bool skippingCache() const { return m_skippingCacheCount; }
72 76
73 // Must be called when a painting is finished. 77 // Must be called when a painting is finished. If passed, a DisplayListDiff
74 void commitNewDisplayItems(); 78 // is initialized and created.
79 void commitNewDisplayItems(DisplayListDiff* = 0);
75 80
76 // Returns the approximate memory usage, excluding memory likely to be 81 // Returns the approximate memory usage, excluding memory likely to be
77 // shared with the embedder after copying to WebDisplayItemList. 82 // shared with the embedder after copying to WebDisplayItemList.
78 // Should only be called right after commitNewDisplayItems. 83 // Should only be called right after commitNewDisplayItems.
79 size_t approximateUnsharedMemoryUsage() const; 84 size_t approximateUnsharedMemoryUsage() const;
80 85
81 // Get the paint list generated after the last painting. 86 // Get the paint list generated after the last painting.
82 const DisplayItems& displayItems() const; 87 const DisplayItems& displayItems() const;
83 88
84 bool clientCacheIsValid(DisplayItemClient) const; 89 bool clientCacheIsValid(DisplayItemClient) const;
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 // This is used to check duplicated ids during add(). We could also check du ring 176 // This is used to check duplicated ids during add(). We could also check du ring
172 // updatePaintList(), but checking during add() helps developer easily find where 177 // updatePaintList(), but checking during add() helps developer easily find where
173 // the duplicated ids are from. 178 // the duplicated ids are from.
174 DisplayItemIndicesByClientMap m_newDisplayItemIndicesByClient; 179 DisplayItemIndicesByClientMap m_newDisplayItemIndicesByClient;
175 #endif 180 #endif
176 }; 181 };
177 182
178 } // namespace blink 183 } // namespace blink
179 184
180 #endif // DisplayItemList_h 185 #endif // DisplayItemList_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698