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

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

Issue 847783003: New display item caching (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Update comments Created 5 years, 11 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 CachedDisplayItem_h 5 #ifndef CachedDisplayItem_h
6 #define CachedDisplayItem_h 6 #define CachedDisplayItem_h
7 7
8 #include "platform/geometry/FloatRect.h"
8 #include "platform/graphics/paint/DisplayItem.h" 9 #include "platform/graphics/paint/DisplayItem.h"
9 #include "wtf/Assertions.h" 10 #include "wtf/Assertions.h"
10 11
11 namespace blink { 12 namespace blink {
12 13
13 // A placeholder of DisplayItem in the new paint list of DisplayItemList, to ind icate that 14 // A placeholder of DisplayItem in the new paint list of DisplayItemList, to ind icate that
14 // the DisplayItem has not been changed and should be replaced with the cached D isplayItem 15 // the DisplayItem has not been changed and should be replaced with the cached D isplayItem
15 // when merging new paint list to cached paint list. 16 // when merging new paint list to cached paint list.
16 class PLATFORM_EXPORT CachedDisplayItem : public DisplayItem { 17 class PLATFORM_EXPORT CachedDisplayItem : public DisplayItem {
17 WTF_MAKE_FAST_ALLOCATED; 18 WTF_MAKE_FAST_ALLOCATED;
18 public: 19 public:
19 static PassOwnPtr<CachedDisplayItem> create(DisplayItemClient client, Type t ype) 20 static PassOwnPtr<CachedDisplayItem> create(DisplayItemClient client, Type t ype)
20 { 21 {
21 return adoptPtr(new CachedDisplayItem(client, type)); 22 return adoptPtr(new CachedDisplayItem(client, type));
22 } 23 }
23 24
25 #ifndef NDEBUG
26 static PassOwnPtr<CachedDisplayItem> create(DisplayItemClient client, Type t ype, const FloatRect& bounds)
27 {
28 return adoptPtr(new CachedDisplayItem(client, type, bounds));
29 }
30 #endif
31
24 virtual bool isCached() const { return true; } 32 virtual bool isCached() const { return true; }
25 33
26 private: 34 private:
27 CachedDisplayItem(DisplayItemClient client, Type type) : DisplayItem(client, type) { } 35 CachedDisplayItem(DisplayItemClient client, Type type) : DisplayItem(client, type) { }
28 36
37 #ifdef NDEBUG
29 // CachedDisplayItem is never replayed or appended to WebDisplayItemList. 38 // CachedDisplayItem is never replayed or appended to WebDisplayItemList.
30 virtual void replay(GraphicsContext*) override final { ASSERT_NOT_REACHED(); } 39 virtual void replay(GraphicsContext*) final { ASSERT_NOT_REACHED(); }
31 virtual void appendToWebDisplayItemList(WebDisplayItemList*) const override final { ASSERT_NOT_REACHED(); } 40 virtual void appendToWebDisplayItemList(WebDisplayItemList*) const final { A SSERT_NOT_REACHED(); }
41 #else
42 CachedDisplayItem(DisplayItemClient client, Type type, const FloatRect& boun ds)
43 : DisplayItem(client, type)
44 , m_bounds(bounds) { }
32 45
33 #ifndef NDEBUG 46 // Generates red rectangle to indicate under-invalidation errors.
47 virtual void replay(GraphicsContext*) final;
48 virtual void appendToWebDisplayItemList(WebDisplayItemList*) const final;
49
34 virtual const char* name() const override { return "Cached"; } 50 virtual const char* name() const override { return "Cached"; }
51
52 const FloatRect m_bounds;
35 #endif 53 #endif
36 }; 54 };
37 55
38 } // namespace blink 56 } // namespace blink
39 57
40 #endif // CachedDisplayItem_h 58 #endif // CachedDisplayItem_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698