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 #include "core/layout/LayoutAnalyzer.h" | 5 #include "core/layout/LayoutAnalyzer.h" |
6 | 6 |
7 #include "core/frame/FrameView.h" | 7 #include "core/frame/FrameView.h" |
8 #include "core/layout/LayoutBlock.h" | 8 #include "core/layout/LayoutBlock.h" |
9 #include "core/layout/LayoutObject.h" | 9 #include "core/layout/LayoutObject.h" |
10 #include "core/layout/LayoutText.h" | 10 #include "core/layout/LayoutText.h" |
11 #include "platform/TracedValue.h" | 11 #include "platform/TracedValue.h" |
| 12 #include <memory> |
12 | 13 |
13 namespace blink { | 14 namespace blink { |
14 | 15 |
15 LayoutAnalyzer::Scope::Scope(const LayoutObject& o) | 16 LayoutAnalyzer::Scope::Scope(const LayoutObject& o) |
16 : m_layoutObject(o) | 17 : m_layoutObject(o) |
17 , m_analyzer(o.frameView()->layoutAnalyzer()) | 18 , m_analyzer(o.frameView()->layoutAnalyzer()) |
18 { | 19 { |
19 if (m_analyzer) | 20 if (m_analyzer) |
20 m_analyzer->push(o); | 21 m_analyzer->push(o); |
21 } | 22 } |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 // stack recursion depth, not layout tree depth or DOM tree depth. | 98 // stack recursion depth, not layout tree depth or DOM tree depth. |
98 m_counters[LayoutAnalyzerStackMaximumDepth] = max(m_counters[LayoutAnalyzerS
tackMaximumDepth], m_depth); | 99 m_counters[LayoutAnalyzerStackMaximumDepth] = max(m_counters[LayoutAnalyzerS
tackMaximumDepth], m_depth); |
99 } | 100 } |
100 | 101 |
101 void LayoutAnalyzer::pop(const LayoutObject& o) | 102 void LayoutAnalyzer::pop(const LayoutObject& o) |
102 { | 103 { |
103 ASSERT(m_depth > 0); | 104 ASSERT(m_depth > 0); |
104 --m_depth; | 105 --m_depth; |
105 } | 106 } |
106 | 107 |
107 PassOwnPtr<TracedValue> LayoutAnalyzer::toTracedValue() | 108 std::unique_ptr<TracedValue> LayoutAnalyzer::toTracedValue() |
108 { | 109 { |
109 OwnPtr<TracedValue> tracedValue(TracedValue::create()); | 110 std::unique_ptr<TracedValue> tracedValue(TracedValue::create()); |
110 for (size_t i = 0; i < NumCounters; ++i) { | 111 for (size_t i = 0; i < NumCounters; ++i) { |
111 if (m_counters[i] > 0) | 112 if (m_counters[i] > 0) |
112 tracedValue->setInteger(nameForCounter(static_cast<Counter>(i)), m_c
ounters[i]); | 113 tracedValue->setInteger(nameForCounter(static_cast<Counter>(i)), m_c
ounters[i]); |
113 } | 114 } |
114 return tracedValue; | 115 return tracedValue; |
115 } | 116 } |
116 | 117 |
117 const char* LayoutAnalyzer::nameForCounter(Counter counter) const | 118 const char* LayoutAnalyzer::nameForCounter(Counter counter) const |
118 { | 119 { |
119 switch (counter) { | 120 switch (counter) { |
(...skipping 17 matching lines...) Expand all Loading... |
137 case CharactersInLayoutObjectsThatAreTextAndCanNotUseTheSimpleFontCodePath:
return "CharactersInLayoutObjectsThatAreTextAndCanNotUseTheSimpleFontCodePath"; | 138 case CharactersInLayoutObjectsThatAreTextAndCanNotUseTheSimpleFontCodePath:
return "CharactersInLayoutObjectsThatAreTextAndCanNotUseTheSimpleFontCodePath"; |
138 case LayoutObjectsThatAreTextAndCanUseTheSimpleFontCodePath: return "LayoutO
bjectsThatAreTextAndCanUseTheSimpleFontCodePath"; | 139 case LayoutObjectsThatAreTextAndCanUseTheSimpleFontCodePath: return "LayoutO
bjectsThatAreTextAndCanUseTheSimpleFontCodePath"; |
139 case CharactersInLayoutObjectsThatAreTextAndCanUseTheSimpleFontCodePath: ret
urn "CharactersInLayoutObjectsThatAreTextAndCanUseTheSimpleFontCodePath"; | 140 case CharactersInLayoutObjectsThatAreTextAndCanUseTheSimpleFontCodePath: ret
urn "CharactersInLayoutObjectsThatAreTextAndCanUseTheSimpleFontCodePath"; |
140 case TotalLayoutObjectsThatWereLaidOut: return "TotalLayoutObjectsThatWereLa
idOut"; | 141 case TotalLayoutObjectsThatWereLaidOut: return "TotalLayoutObjectsThatWereLa
idOut"; |
141 } | 142 } |
142 ASSERT_NOT_REACHED(); | 143 ASSERT_NOT_REACHED(); |
143 return ""; | 144 return ""; |
144 } | 145 } |
145 | 146 |
146 } // namespace blink | 147 } // namespace blink |
OLD | NEW |