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