| 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/HashSet.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 { |
| 21 WTF_MAKE_NONCOPYABLE(DisplayItemList); | 21 WTF_MAKE_NONCOPYABLE(DisplayItemList); |
| 22 WTF_MAKE_FAST_ALLOCATED; | 22 WTF_MAKE_FAST_ALLOCATED; |
| 23 public: | 23 public: |
| 24 static PassOwnPtr<DisplayItemList> create() { return adoptPtr(new DisplayIte
mList); } | 24 static PassOwnPtr<DisplayItemList> create() { return adoptPtr(new DisplayIte
mList); } |
| 25 | 25 |
| 26 void beginNewPaints(); |
| 27 void endNewPaints(); |
| 28 |
| 26 const PaintList& paintList(); | 29 const PaintList& paintList(); |
| 27 void add(WTF::PassOwnPtr<DisplayItem>); | 30 void add(WTF::PassOwnPtr<DisplayItem>); |
| 28 | 31 |
| 29 void invalidate(DisplayItemClient); | 32 void invalidate(DisplayItemClient); |
| 30 void invalidateAll(); | 33 void invalidateAll(); |
| 31 bool clientCacheIsValid(DisplayItemClient client) const { return m_cachedCli
ents.contains(client); } | 34 bool clientCacheIsValid(DisplayItemClient) const; |
| 32 | 35 |
| 33 // Plays back the current PaintList() into the given context. | 36 // Plays back the current PaintList() into the given context. |
| 34 void replay(GraphicsContext*); | 37 void replay(GraphicsContext*); |
| 35 | 38 |
| 36 #ifndef NDEBUG | 39 #ifndef NDEBUG |
| 37 void showDebugData() const; | 40 void showDebugData() const; |
| 38 #endif | 41 #endif |
| 39 | 42 |
| 40 protected: | 43 protected: |
| 41 DisplayItemList() { }; | 44 DisplayItemList() : m_doingNewPaints(false) { }; |
| 42 | 45 |
| 43 private: | 46 private: |
| 44 PaintList::iterator findNextMatchingCachedItem(PaintList::iterator, const Di
splayItem&); | 47 PaintList::iterator findNextMatchingCachedItem(PaintList::iterator, const Di
splayItem&); |
| 45 bool wasInvalidated(const DisplayItem&) const; | 48 bool wasInvalidated(const DisplayItem&) const; |
| 46 void updatePaintList(); | 49 void updatePaintList(); |
| 47 | 50 |
| 48 #ifndef NDEBUG | 51 #ifndef NDEBUG |
| 49 WTF::String paintListAsDebugString(const PaintList&) const; | 52 WTF::String paintListAsDebugString(const PaintList&) const; |
| 50 #endif | 53 #endif |
| 51 | 54 |
| 52 PaintList m_paintList; | 55 PaintList m_paintList; |
| 53 HashSet<DisplayItemClient> m_cachedClients; | 56 HashSet<DisplayItemClient> m_cachedClients; |
| 57 bool m_doingNewPaints; |
| 54 PaintList m_newPaints; | 58 PaintList m_newPaints; |
| 55 }; | 59 }; |
| 56 | 60 |
| 57 } // namespace blink | 61 } // namespace blink |
| 58 | 62 |
| 59 #endif // DisplayItemList_h | 63 #endif // DisplayItemList_h |
| OLD | NEW |