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 SubtreeRecorder_h | 5 #ifndef SubtreeRecorder_h |
6 #define SubtreeRecorder_h | 6 #define SubtreeRecorder_h |
7 | 7 |
8 #include "core/paint/PaintPhase.h" | 8 #include "core/paint/PaintPhase.h" |
9 #include "wtf/PassOwnPtr.h" | 9 #include "wtf/PassOwnPtr.h" |
10 | 10 |
11 namespace blink { | 11 namespace blink { |
12 | 12 |
13 class DisplayItem; | 13 class DisplayItem; |
14 class DisplayItemList; | 14 class DisplayItemList; |
15 class GraphicsContext; | 15 class GraphicsContext; |
16 class LayoutObject; | 16 class LayoutObject; |
17 | 17 |
18 // Records subtree information during painting. The recorder's life span covers | 18 // Records subtree information during painting. The recorder's life span covers |
19 // all painting operations executed during the root of the subtree's paint metho
d | 19 // all painting operations executed during the root of the subtree's paint metho
d |
20 // for the paint phase. | 20 // for the paint phase. |
21 class SubtreeRecorder { | 21 class SubtreeRecorder { |
22 public: | 22 public: |
23 SubtreeRecorder(GraphicsContext&, const LayoutObject& root, PaintPhase); | 23 SubtreeRecorder(GraphicsContext&, const LayoutObject& root, PaintPhase); |
24 | |
25 ~SubtreeRecorder(); | 24 ~SubtreeRecorder(); |
26 | 25 |
27 // This method should be called before we actually paint the subtree, then w
e'll | 26 bool canUseCache() const; |
28 // issue a pair of BeginSubtree/EndSubtree display items to enclose all disp
lay | |
29 // items when we paint the subtree. | |
30 // Omit this call if we skip painting of the whole subtree (when e.g. the su
btree | |
31 // is out of the viewport, or the whole subtree is not invalidated), then we
'll | |
32 // issue a SubtreeCached display item. | |
33 void begin(); | |
34 | 27 |
35 private: | 28 private: |
36 DisplayItemList* m_displayItemList; | 29 DisplayItemList* m_displayItemList; |
37 const LayoutObject& m_subtreeRoot; | 30 const LayoutObject& m_subtreeRoot; |
38 const PaintPhase m_paintPhase; | 31 const PaintPhase m_paintPhase; |
39 bool m_begun; | 32 bool m_canUseCache; |
| 33 #if ENABLE(ASSERT) |
| 34 mutable bool m_checkedCanUseCache; |
| 35 #endif |
40 }; | 36 }; |
41 | 37 |
42 } // namespace blink | 38 } // namespace blink |
43 | 39 |
44 #endif // SubtreeRecorder_h | 40 #endif // SubtreeRecorder_h |
OLD | NEW |