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 LayoutAnalyzer_h | 5 #ifndef LayoutAnalyzer_h |
6 #define LayoutAnalyzer_h | 6 #define LayoutAnalyzer_h |
7 | 7 |
8 #include "platform/LayoutUnit.h" | 8 #include "platform/LayoutUnit.h" |
| 9 #include "wtf/Allocator.h" |
| 10 #include "wtf/FastAllocBase.h" |
| 11 #include "wtf/Noncopyable.h" |
9 #include "wtf/PassRefPtr.h" | 12 #include "wtf/PassRefPtr.h" |
10 | 13 |
11 namespace blink { | 14 namespace blink { |
12 | 15 |
13 class LayoutBlock; | 16 class LayoutBlock; |
14 class LayoutObject; | 17 class LayoutObject; |
15 class TracedValue; | 18 class TracedValue; |
16 | 19 |
17 // Observes the performance of layout and reports statistics via a TracedValue. | 20 // Observes the performance of layout and reports statistics via a TracedValue. |
18 // Usage: | 21 // Usage: |
19 // LayoutAnalyzer::Scope analyzer(*this); | 22 // LayoutAnalyzer::Scope analyzer(*this); |
20 class LayoutAnalyzer { | 23 class LayoutAnalyzer { |
| 24 WTF_MAKE_FAST_ALLOCATED(LayoutAnalyzer); |
| 25 WTF_MAKE_NONCOPYABLE(LayoutAnalyzer); |
21 public: | 26 public: |
22 enum Counter { | 27 enum Counter { |
23 LayoutBlockWidthChanged, | 28 LayoutBlockWidthChanged, |
24 LayoutBlockHeightChanged, | 29 LayoutBlockHeightChanged, |
25 LayoutBlockSizeChanged, | 30 LayoutBlockSizeChanged, |
26 LayoutBlockSizeDidNotChange, | 31 LayoutBlockSizeDidNotChange, |
27 LayoutObjectsThatSpecifyColumns, | 32 LayoutObjectsThatSpecifyColumns, |
28 LayoutAnalyzerStackMaximumDepth, | 33 LayoutAnalyzerStackMaximumDepth, |
29 LayoutObjectsThatAreFloating, | 34 LayoutObjectsThatAreFloating, |
30 LayoutObjectsThatHaveALayer, | 35 LayoutObjectsThatHaveALayer, |
31 LayoutInlineObjectsThatAlwaysCreateLineBoxes, | 36 LayoutInlineObjectsThatAlwaysCreateLineBoxes, |
32 LayoutObjectsThatHadNeverHadLayout, | 37 LayoutObjectsThatHadNeverHadLayout, |
33 LayoutObjectsThatAreOutOfFlowPositioned, | 38 LayoutObjectsThatAreOutOfFlowPositioned, |
34 LayoutObjectsThatNeedPositionedMovementLayout, | 39 LayoutObjectsThatNeedPositionedMovementLayout, |
35 PerformLayoutRootLayoutObjects, | 40 PerformLayoutRootLayoutObjects, |
36 LayoutObjectsThatNeedLayoutForThemselves, | 41 LayoutObjectsThatNeedLayoutForThemselves, |
37 LayoutObjectsThatNeedSimplifiedLayout, | 42 LayoutObjectsThatNeedSimplifiedLayout, |
38 LayoutObjectsThatAreTableCells, | 43 LayoutObjectsThatAreTableCells, |
39 LayoutObjectsThatAreTextAndCanNotUseTheSimpleFontCodePath, | 44 LayoutObjectsThatAreTextAndCanNotUseTheSimpleFontCodePath, |
40 CharactersInLayoutObjectsThatAreTextAndCanNotUseTheSimpleFontCodePath, | 45 CharactersInLayoutObjectsThatAreTextAndCanNotUseTheSimpleFontCodePath, |
41 LayoutObjectsThatAreTextAndCanUseTheSimpleFontCodePath, | 46 LayoutObjectsThatAreTextAndCanUseTheSimpleFontCodePath, |
42 CharactersInLayoutObjectsThatAreTextAndCanUseTheSimpleFontCodePath, | 47 CharactersInLayoutObjectsThatAreTextAndCanUseTheSimpleFontCodePath, |
43 TotalLayoutObjectsThatWereLaidOut, | 48 TotalLayoutObjectsThatWereLaidOut, |
44 }; | 49 }; |
45 static const size_t NumCounters = 21; | 50 static const size_t NumCounters = 21; |
46 | 51 |
47 class Scope { | 52 class Scope { |
| 53 STACK_ALLOCATED(); |
48 public: | 54 public: |
49 explicit Scope(const LayoutObject&); | 55 explicit Scope(const LayoutObject&); |
50 ~Scope(); | 56 ~Scope(); |
51 | 57 |
52 private: | 58 private: |
53 const LayoutObject& m_layoutObject; | 59 const LayoutObject& m_layoutObject; |
54 LayoutAnalyzer* m_analyzer; | 60 LayoutAnalyzer* m_analyzer; |
55 }; | 61 }; |
56 | 62 |
57 class BlockScope { | 63 class BlockScope { |
| 64 STACK_ALLOCATED(); |
58 public: | 65 public: |
59 explicit BlockScope(const LayoutBlock&); | 66 explicit BlockScope(const LayoutBlock&); |
60 ~BlockScope(); | 67 ~BlockScope(); |
61 | 68 |
62 private: | 69 private: |
63 const LayoutBlock& m_block; | 70 const LayoutBlock& m_block; |
64 LayoutUnit m_width; | 71 LayoutUnit m_width; |
65 LayoutUnit m_height; | 72 LayoutUnit m_height; |
66 }; | 73 }; |
67 | 74 |
(...skipping 14 matching lines...) Expand all Loading... |
82 const char* nameForCounter(Counter) const; | 89 const char* nameForCounter(Counter) const; |
83 | 90 |
84 double m_startMs; | 91 double m_startMs; |
85 unsigned m_depth; | 92 unsigned m_depth; |
86 unsigned m_counters[NumCounters]; | 93 unsigned m_counters[NumCounters]; |
87 }; | 94 }; |
88 | 95 |
89 } // namespace blink | 96 } // namespace blink |
90 | 97 |
91 #endif // LayoutAnalyzer_h | 98 #endif // LayoutAnalyzer_h |
OLD | NEW |