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

Side by Side Diff: third_party/WebKit/Source/platform/graphics/paint/DisplayItemClient.h

Issue 1508223005: Client side display item cache flag (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@ScrollbarTheme
Patch Set: Created 4 years, 12 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 DisplayItemClient_h 5 #ifndef DisplayItemClient_h
6 #define DisplayItemClient_h 6 #define DisplayItemClient_h
7 7
8 #include "platform/PlatformExport.h" 8 #include "platform/PlatformExport.h"
9 #include "platform/geometry/IntRect.h" 9 #include "platform/geometry/IntRect.h"
10 #include "wtf/text/WTFString.h" 10 #include "wtf/text/WTFString.h"
(...skipping 12 matching lines...) Expand all
23 virtual ~DisplayItemClient(); 23 virtual ~DisplayItemClient();
24 #else 24 #else
25 virtual ~DisplayItemClient() { } 25 virtual ~DisplayItemClient() { }
26 #endif 26 #endif
27 27
28 virtual String debugName() const = 0; 28 virtual String debugName() const = 0;
29 29
30 // The visual rect of this DisplayItemClient, in the space of its containing GraphicsLayer. 30 // The visual rect of this DisplayItemClient, in the space of its containing GraphicsLayer.
31 virtual IntRect visualRect() const = 0; 31 virtual IntRect visualRect() const = 0;
32 32
33 static const unsigned kInvalidCacheGeneration = 0;
34
35 virtual bool displayItemsAreCached(unsigned cacheGeneration) const = 0;
36 virtual void setDisplayItemsCached(unsigned cacheGeneration) const = 0;
37
33 #if ENABLE(ASSERT) 38 #if ENABLE(ASSERT)
34 // Tests if a DisplayItemClient object has been created and has not been del eted yet. 39 // Tests if a DisplayItemClient object has been created and has not been del eted yet.
35 static bool isAlive(const DisplayItemClient&); 40 static bool isAlive(const DisplayItemClient&);
36 #endif 41 #endif
42
43 protected:
44 // To make m_displayItemCacheGeneration (in DISPLAY_ITEM_CACHE_STATUS_IMPLEM ENTATION)
45 // automatically initialized.
46 struct DisplayItemCacheGeneration {
47 DisplayItemCacheGeneration() : value(kInvalidCacheGeneration) { }
48 unsigned value;
49 };
37 }; 50 };
38 51
52 #define DISPLAY_ITEM_CACHE_STATUS_IMPLEMENTATION \
53 bool displayItemsAreCached(unsigned cacheGeneration) const final { return ca cheGeneration != kInvalidCacheGeneration && m_displayItemCacheGeneration.value = = cacheGeneration; } \
54 void setDisplayItemsCached(unsigned cacheGeneration) const final { m_display ItemCacheGeneration.value = cacheGeneration; } \
55 mutable DisplayItemCacheGeneration m_displayItemCacheGeneration;
56
57 #define DISPLAY_ITEM_CACHE_STATUS_UNCACHEABLE_IMPLEMENTATION \
58 bool displayItemsAreCached(unsigned cacheGeneration) const final { return fa lse; } \
59 void setDisplayItemsCached(unsigned cacheGeneration) const final { }
60
39 inline bool operator==(const DisplayItemClient& client1, const DisplayItemClient & client2) { return &client1 == &client2; } 61 inline bool operator==(const DisplayItemClient& client1, const DisplayItemClient & client2) { return &client1 == &client2; }
40 inline bool operator!=(const DisplayItemClient& client1, const DisplayItemClient & client2) { return &client1 != &client2; } 62 inline bool operator!=(const DisplayItemClient& client1, const DisplayItemClient & client2) { return &client1 != &client2; }
41 63
42 } 64 } // namespace blink
43 65
44 #endif // DisplayItemClient_h 66 #endif // DisplayItemClient_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698