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

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

Issue 1157653005: Move use of DisplayItemList's vector behind an explicit DisplayItems interface. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: DisplayItems must be noncopyable (Windows build fix) Created 5 years, 6 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 | Annotate | Revision Log
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/paint/DisplayItem.h" 9 #include "platform/graphics/paint/DisplayItem.h"
10 #include "platform/graphics/paint/DisplayItems.h"
10 #include "wtf/HashMap.h" 11 #include "wtf/HashMap.h"
11 #include "wtf/PassOwnPtr.h" 12 #include "wtf/PassOwnPtr.h"
12 #include "wtf/Vector.h" 13 #include "wtf/Vector.h"
13 14
14 namespace blink { 15 namespace blink {
15 16
16 class GraphicsContext; 17 class GraphicsContext;
17 18
18 typedef Vector<OwnPtr<DisplayItem>> DisplayItems;
19
20 class PLATFORM_EXPORT DisplayItemList { 19 class PLATFORM_EXPORT DisplayItemList {
21 WTF_MAKE_NONCOPYABLE(DisplayItemList); 20 WTF_MAKE_NONCOPYABLE(DisplayItemList);
22 WTF_MAKE_FAST_ALLOCATED(DisplayItemList); 21 WTF_MAKE_FAST_ALLOCATED(DisplayItemList);
23 public: 22 public:
24 static PassOwnPtr<DisplayItemList> create() 23 static PassOwnPtr<DisplayItemList> create()
25 { 24 {
26 return adoptPtr(new DisplayItemList()); 25 return adoptPtr(new DisplayItemList());
27 } 26 }
28 27
29 // These methods are called during paint invalidation. 28 // These methods are called during paint invalidation.
(...skipping 17 matching lines...) Expand all
47 46
48 bool clientCacheIsValid(DisplayItemClient) const; 47 bool clientCacheIsValid(DisplayItemClient) const;
49 48
50 // Commits the new display items and plays back the updated display items in to the given context. 49 // Commits the new display items and plays back the updated display items in to the given context.
51 void commitNewDisplayItemsAndReplay(GraphicsContext& context) 50 void commitNewDisplayItemsAndReplay(GraphicsContext& context)
52 { 51 {
53 commitNewDisplayItems(); 52 commitNewDisplayItems();
54 replay(context); 53 replay(context);
55 } 54 }
56 55
56 void commitNewDisplayItemsAndAppendToWebDisplayItemList(WebDisplayItemList*) ;
57
57 bool displayItemConstructionIsDisabled() const { return m_constructionDisabl ed; } 58 bool displayItemConstructionIsDisabled() const { return m_constructionDisabl ed; }
58 void setDisplayItemConstructionIsDisabled(const bool disable) { m_constructi onDisabled = disable; } 59 void setDisplayItemConstructionIsDisabled(const bool disable) { m_constructi onDisabled = disable; }
59 60
60 #if ENABLE(ASSERT) 61 #if ENABLE(ASSERT)
61 size_t newDisplayItemsSize() const { return m_newDisplayItems.size(); } 62 size_t newDisplayItemsSize() const { return m_newDisplayItems.size(); }
62 #endif 63 #endif
63 64
64 #ifndef NDEBUG 65 #ifndef NDEBUG
65 void showDebugData() const; 66 void showDebugData() const;
66 #endif 67 #endif
(...skipping 12 matching lines...) Expand all
79 void updateValidlyCachedClientsIfNeeded() const; 80 void updateValidlyCachedClientsIfNeeded() const;
80 81
81 #ifndef NDEBUG 82 #ifndef NDEBUG
82 WTF::String displayItemsAsDebugString(const DisplayItems&) const; 83 WTF::String displayItemsAsDebugString(const DisplayItems&) const;
83 #endif 84 #endif
84 85
85 // Indices into PaintList of all DrawingDisplayItems and BeginSubtreeDisplay Items of each client. 86 // Indices into PaintList of all DrawingDisplayItems and BeginSubtreeDisplay Items of each client.
86 // Temporarily used during merge to find out-of-order display items. 87 // Temporarily used during merge to find out-of-order display items.
87 using DisplayItemIndicesByClientMap = HashMap<DisplayItemClient, Vector<size _t>>; 88 using DisplayItemIndicesByClientMap = HashMap<DisplayItemClient, Vector<size _t>>;
88 89
89 static size_t findMatchingItemFromIndex(const DisplayItem&, DisplayItem::Typ e matchingType, const DisplayItemIndicesByClientMap&, const DisplayItems&); 90 static size_t findMatchingItemFromIndex(const DisplayItem::Id&, DisplayItem: :Type matchingType, const DisplayItemIndicesByClientMap&, const DisplayItems&);
90 static void addItemToIndex(const DisplayItem&, size_t index, DisplayItemIndi cesByClientMap&); 91 static void addItemToIndex(DisplayItemClient, DisplayItem::Type, size_t inde x, DisplayItemIndicesByClientMap&);
91 size_t findOutOfOrderCachedItem(size_t& currentDisplayItemsIndex, const Disp layItem&, DisplayItem::Type, DisplayItemIndicesByClientMap&); 92 DisplayItems::Iterator findOutOfOrderCachedItem(DisplayItems::Iterator& curr entIt, const DisplayItem::Id&, DisplayItem::Type, DisplayItemIndicesByClientMap& );
92 size_t findOutOfOrderCachedItemForward(size_t& currentDisplayItemsIndex, con st DisplayItem&, DisplayItem::Type, DisplayItemIndicesByClientMap&); 93 DisplayItems::Iterator findOutOfOrderCachedItemForward(DisplayItems::Iterato r& currentIt, const DisplayItem::Id&, DisplayItem::Type, DisplayItemIndicesByCli entMap&);
93 94
94 #if ENABLE(ASSERT) 95 #if ENABLE(ASSERT)
95 // The following two methods are for checking under-invalidations 96 // The following two methods are for checking under-invalidations
96 // (when RuntimeEnabledFeatures::slimmingPaintUnderInvalidationCheckingEnabl ed). 97 // (when RuntimeEnabledFeatures::slimmingPaintUnderInvalidationCheckingEnabl ed).
97 void checkCachedDisplayItemIsUnchanged(const DisplayItem&, DisplayItemIndice sByClientMap&); 98 void checkCachedDisplayItemIsUnchanged(const DisplayItems::ItemHandle&, Disp layItemIndicesByClientMap&);
98 void checkNoRemainingCachedDisplayItems(); 99 void checkNoRemainingCachedDisplayItems();
99 #endif 100 #endif
100 101
101 void replay(GraphicsContext&) const; 102 void replay(GraphicsContext&) const;
102 103
103 DisplayItems m_currentDisplayItems; 104 DisplayItems m_currentDisplayItems;
104 DisplayItems m_newDisplayItems; 105 DisplayItems m_newDisplayItems;
105 106
106 // Contains all clients having valid cached paintings if updated. 107 // Contains all clients having valid cached paintings if updated.
107 // It's lazily updated in updateValidlyCachedClientsIfNeeded(). 108 // It's lazily updated in updateValidlyCachedClientsIfNeeded().
(...skipping 24 matching lines...) Expand all
132 // This is used to check duplicated ids during add(). We could also check du ring 133 // This is used to check duplicated ids during add(). We could also check du ring
133 // updatePaintList(), but checking during add() helps developer easily find where 134 // updatePaintList(), but checking during add() helps developer easily find where
134 // the duplicated ids are from. 135 // the duplicated ids are from.
135 DisplayItemIndicesByClientMap m_newDisplayItemIndicesByClient; 136 DisplayItemIndicesByClientMap m_newDisplayItemIndicesByClient;
136 #endif 137 #endif
137 }; 138 };
138 139
139 } // namespace blink 140 } // namespace blink
140 141
141 #endif // DisplayItemList_h 142 #endif // DisplayItemList_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698