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" | 9 #include "wtf/Allocator.h" |
10 #include "wtf/Noncopyable.h" | 10 #include "wtf/Noncopyable.h" |
11 #include "wtf/PassOwnPtr.h" | 11 #include <memory> |
12 | 12 |
13 namespace blink { | 13 namespace blink { |
14 | 14 |
15 class LayoutBlock; | 15 class LayoutBlock; |
16 class LayoutObject; | 16 class LayoutObject; |
17 class TracedValue; | 17 class TracedValue; |
18 | 18 |
19 // Observes the performance of layout and reports statistics via a TracedValue. | 19 // Observes the performance of layout and reports statistics via a TracedValue. |
20 // Usage: | 20 // Usage: |
21 // LayoutAnalyzer::Scope analyzer(*this); | 21 // LayoutAnalyzer::Scope analyzer(*this); |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 | 75 |
76 void reset(); | 76 void reset(); |
77 void push(const LayoutObject&); | 77 void push(const LayoutObject&); |
78 void pop(const LayoutObject&); | 78 void pop(const LayoutObject&); |
79 | 79 |
80 void increment(Counter counter, unsigned delta = 1) | 80 void increment(Counter counter, unsigned delta = 1) |
81 { | 81 { |
82 m_counters[counter] += delta; | 82 m_counters[counter] += delta; |
83 } | 83 } |
84 | 84 |
85 PassOwnPtr<TracedValue> toTracedValue(); | 85 std::unique_ptr<TracedValue> toTracedValue(); |
86 | 86 |
87 private: | 87 private: |
88 const char* nameForCounter(Counter) const; | 88 const char* nameForCounter(Counter) const; |
89 | 89 |
90 double m_startMs; | 90 double m_startMs; |
91 unsigned m_depth; | 91 unsigned m_depth; |
92 unsigned m_counters[NumCounters]; | 92 unsigned m_counters[NumCounters]; |
93 }; | 93 }; |
94 | 94 |
95 } // namespace blink | 95 } // namespace blink |
96 | 96 |
97 #endif // LayoutAnalyzer_h | 97 #endif // LayoutAnalyzer_h |
OLD | NEW |