| 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 "wtf/PassRefPtr.h" | 8 #include "wtf/PassRefPtr.h" |
| 9 | 9 |
| 10 namespace blink { | 10 namespace blink { |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 }; | 40 }; |
| 41 static const size_t NumCounters = 19; | 41 static const size_t NumCounters = 19; |
| 42 | 42 |
| 43 class Scope { | 43 class Scope { |
| 44 public: | 44 public: |
| 45 explicit Scope(const LayoutObject&); | 45 explicit Scope(const LayoutObject&); |
| 46 ~Scope(); | 46 ~Scope(); |
| 47 | 47 |
| 48 private: | 48 private: |
| 49 const LayoutObject& m_layoutObject; | 49 const LayoutObject& m_layoutObject; |
| 50 LayoutAnalyzer& m_analyzer; | 50 LayoutAnalyzer* m_analyzer; |
| 51 }; | 51 }; |
| 52 | 52 |
| 53 LayoutAnalyzer() { } | 53 LayoutAnalyzer() { } |
| 54 | 54 |
| 55 void reset(); | 55 void reset(); |
| 56 void push(const LayoutObject&); | 56 void push(const LayoutObject&); |
| 57 void pop(const LayoutObject&); | 57 void pop(const LayoutObject&); |
| 58 | 58 |
| 59 void increment(Counter counter, unsigned delta = 1) | 59 void increment(Counter counter, unsigned delta = 1) |
| 60 { | 60 { |
| 61 m_counters[counter] += delta; | 61 m_counters[counter] += delta; |
| 62 } | 62 } |
| 63 | 63 |
| 64 void recordCounters(); | 64 void recordCounters(); |
| 65 | 65 |
| 66 PassRefPtr<TracedValue> toTracedValue(); | 66 PassRefPtr<TracedValue> toTracedValue(); |
| 67 | 67 |
| 68 private: | 68 private: |
| 69 const char* nameForCounter(Counter) const; | 69 const char* nameForCounter(Counter) const; |
| 70 | 70 |
| 71 double m_startMs; | 71 double m_startMs; |
| 72 unsigned m_depth; | 72 unsigned m_depth; |
| 73 unsigned m_counters[NumCounters]; | 73 unsigned m_counters[NumCounters]; |
| 74 }; | 74 }; |
| 75 | 75 |
| 76 } // namespace blink | 76 } // namespace blink |
| 77 | 77 |
| 78 #endif // LayoutAnalyzer_h | 78 #endif // LayoutAnalyzer_h |
| OLD | NEW |