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 "wtf/HashSet.h" | 10 #include "wtf/HashMap.h" |
11 #include "wtf/PassOwnPtr.h" | 11 #include "wtf/PassOwnPtr.h" |
12 #include "wtf/Vector.h" | 12 #include "wtf/Vector.h" |
13 | 13 |
14 namespace blink { | 14 namespace blink { |
15 | 15 |
16 class GraphicsContext; | 16 class GraphicsContext; |
17 | 17 |
18 typedef Vector<OwnPtr<DisplayItem>> PaintList; | 18 typedef Vector<OwnPtr<DisplayItem>> PaintList; |
19 | 19 |
20 class PLATFORM_EXPORT DisplayItemList { | 20 class PLATFORM_EXPORT DisplayItemList { |
(...skipping 15 matching lines...) Expand all Loading... | |
36 void replay(GraphicsContext*); | 36 void replay(GraphicsContext*); |
37 | 37 |
38 #ifndef NDEBUG | 38 #ifndef NDEBUG |
39 void showDebugData() const; | 39 void showDebugData() const; |
40 #endif | 40 #endif |
41 | 41 |
42 protected: | 42 protected: |
43 DisplayItemList() { }; | 43 DisplayItemList() { }; |
44 | 44 |
45 private: | 45 private: |
46 PaintList::iterator findNextMatchingCachedItem(PaintList::iterator, const Di splayItem&); | 46 friend class ViewDisplayListTest; |
47 bool wasInvalidated(const DisplayItem&) const; | 47 friend class DrawingRecorderTest; |
48 | |
48 void updatePaintList(); | 49 void updatePaintList(); |
49 | 50 |
50 #ifndef NDEBUG | 51 #ifndef NDEBUG |
51 WTF::String paintListAsDebugString(const PaintList&) const; | 52 WTF::String paintListAsDebugString(const PaintList&) const; |
52 #endif | 53 #endif |
53 | 54 |
55 struct DisplayItemIndices { | |
56 // Indices into PaintList of all DrawingDisplayItems of a client. | |
pdr.
2015/02/05 03:35:57
Do we need to track these separately or can we jus
Xianzhu
2015/02/05 17:57:03
Thought to reduce the number of items of each vect
| |
57 Vector<size_t> drawingDisplayItemIndices; | |
58 // Indices into PaintList of all BeginSubtreeDisplayItems of a client. | |
59 Vector<size_t> beginSubtreeDisplayItemIndices; | |
60 }; | |
61 typedef HashMap<DisplayItemClient, DisplayItemIndices> DisplayItemIndicesByC lientMap; | |
62 | |
63 size_t findMatchingCachedItem(const DisplayItem&); | |
64 static void appendDisplayItem(PaintList&, DisplayItemIndicesByClientMap&, WT F::PassOwnPtr<DisplayItem>); | |
65 void copyCachedSubtree(const DisplayItem&, PaintList&, DisplayItemIndicesByC lientMap&); | |
66 | |
54 PaintList m_paintList; | 67 PaintList m_paintList; |
55 HashSet<DisplayItemClient> m_cachedClients; | 68 DisplayItemIndicesByClientMap m_cachedDisplayItemIndicesByClient; |
56 PaintList m_newPaints; | 69 PaintList m_newPaints; |
57 }; | 70 }; |
58 | 71 |
59 } // namespace blink | 72 } // namespace blink |
60 | 73 |
61 #endif // DisplayItemList_h | 74 #endif // DisplayItemList_h |
OLD | NEW |