OLD | NEW |
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 SubsequenceRecorder_h | 5 #ifndef SubsequenceRecorder_h |
6 #define SubsequenceRecorder_h | 6 #define SubsequenceRecorder_h |
7 | 7 |
8 #include "platform/graphics/GraphicsContext.h" | 8 #include "platform/graphics/GraphicsContext.h" |
9 #include "platform/graphics/paint/DisplayItem.h" | 9 #include "platform/graphics/paint/DisplayItem.h" |
10 #include "platform/graphics/paint/PaintController.h" | 10 #include "platform/graphics/paint/PaintController.h" |
11 #include "wtf/Allocator.h" | 11 #include "wtf/Allocator.h" |
12 #include "wtf/Noncopyable.h" | 12 #include "wtf/Noncopyable.h" |
13 | 13 |
14 namespace blink { | 14 namespace blink { |
15 | 15 |
16 class GraphicsContext; | 16 class GraphicsContext; |
17 class PaintController; | 17 class PaintController; |
18 | 18 |
19 // SubsequenceRecorder records BeginSubsequenceDisplayItem and EndSubsequenceDis
playItem | 19 // SubsequenceRecorder records BeginSubsequenceDisplayItem and |
20 // sentinels at either end of a continguous sequence of DisplayItems, and suppor
ts | 20 // EndSubsequenceDisplayItem sentinels at either end of a continguous sequence |
21 // caching via a CachedDisplayItem with the CachedSubsequence DisplayItem type. | 21 // of DisplayItems, and supports caching via a CachedDisplayItem with the |
| 22 // CachedSubsequence DisplayItem type. |
22 // | 23 // |
23 // Also note that useCachedSubsequenceIfPossible is not sufficient to determine
whether a | 24 // Also note that useCachedSubsequenceIfPossible is not sufficient to determine |
24 // CachedSubsequence can be used. In particular, the client is responsible for c
hecking that | 25 // whether a CachedSubsequence can be used. In particular, the client is |
25 // none of the DisplayItemClients that contribute to the subsequence have been i
nvalidated. | 26 // responsible for checking that none of the DisplayItemClients that contribute |
| 27 // to the subsequence have been invalidated. |
26 // | 28 // |
27 class PLATFORM_EXPORT SubsequenceRecorder final { | 29 class PLATFORM_EXPORT SubsequenceRecorder final { |
28 DISALLOW_NEW_EXCEPT_PLACEMENT_NEW(); | 30 DISALLOW_NEW_EXCEPT_PLACEMENT_NEW(); |
29 WTF_MAKE_NONCOPYABLE(SubsequenceRecorder); | 31 WTF_MAKE_NONCOPYABLE(SubsequenceRecorder); |
30 | 32 |
31 public: | 33 public: |
32 static bool useCachedSubsequenceIfPossible(GraphicsContext& context, | 34 static bool useCachedSubsequenceIfPossible(GraphicsContext& context, |
33 const DisplayItemClient& client) { | 35 const DisplayItemClient& client) { |
34 return context.getPaintController().useCachedSubsequenceIfPossible(client); | 36 return context.getPaintController().useCachedSubsequenceIfPossible(client); |
35 } | 37 } |
36 | 38 |
37 SubsequenceRecorder(GraphicsContext&, const DisplayItemClient&); | 39 SubsequenceRecorder(GraphicsContext&, const DisplayItemClient&); |
38 ~SubsequenceRecorder(); | 40 ~SubsequenceRecorder(); |
39 | 41 |
40 private: | 42 private: |
41 PaintController& m_paintController; | 43 PaintController& m_paintController; |
42 const DisplayItemClient& m_client; | 44 const DisplayItemClient& m_client; |
43 size_t m_beginSubsequenceIndex; | 45 size_t m_beginSubsequenceIndex; |
44 }; | 46 }; |
45 | 47 |
46 } // namespace blink | 48 } // namespace blink |
47 | 49 |
48 #endif // SubsequenceRecorder_h | 50 #endif // SubsequenceRecorder_h |
OLD | NEW |