| 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 "config.h" | 5 #include "config.h" |
| 6 #include "core/layout/LayoutAnalyzer.h" | 6 #include "core/layout/LayoutAnalyzer.h" |
| 7 | 7 |
| 8 #include "core/frame/FrameView.h" | 8 #include "core/frame/FrameView.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 "public/platform/Platform.h" | 12 #include "public/platform/Platform.h" |
| 13 | 13 |
| 14 namespace blink { | 14 namespace blink { |
| 15 | 15 |
| 16 LayoutAnalyzer::Scope::Scope(const LayoutObject& o) | 16 LayoutAnalyzer::Scope::Scope(const LayoutObject& o) |
| 17 : m_layoutObject(o) | 17 : m_layoutObject(o) |
| 18 , m_analyzer(o.frameView()->layoutAnalyzer()) | 18 , m_analyzer(o.frameView()->layoutAnalyzer()) |
| 19 { | 19 { |
| 20 m_analyzer.push(o); | 20 if (m_analyzer) |
| 21 m_analyzer->push(o); |
| 21 } | 22 } |
| 22 | 23 |
| 23 LayoutAnalyzer::Scope::~Scope() | 24 LayoutAnalyzer::Scope::~Scope() |
| 24 { | 25 { |
| 25 m_analyzer.pop(m_layoutObject); | 26 if (m_analyzer) |
| 27 m_analyzer->pop(m_layoutObject); |
| 26 } | 28 } |
| 27 | 29 |
| 28 void LayoutAnalyzer::reset() | 30 void LayoutAnalyzer::reset() |
| 29 { | 31 { |
| 30 m_startMs = currentTimeMS(); | 32 m_startMs = currentTimeMS(); |
| 31 m_depth = 0; | 33 m_depth = 0; |
| 32 for (size_t i = 0; i < NumCounters; ++i) { | 34 for (size_t i = 0; i < NumCounters; ++i) { |
| 33 m_counters[i] = 0; | 35 m_counters[i] = 0; |
| 34 } | 36 } |
| 35 } | 37 } |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 case CharactersInLayoutObjectsThatAreTextAndCanNotUseTheSimpleFontCodePath:
return "CharactersInLayoutObjectsThatAreTextAndCanNotUseTheSimpleFontCodePath"; | 136 case CharactersInLayoutObjectsThatAreTextAndCanNotUseTheSimpleFontCodePath:
return "CharactersInLayoutObjectsThatAreTextAndCanNotUseTheSimpleFontCodePath"; |
| 135 case LayoutObjectsThatAreTextAndCanUseTheSimpleFontCodePath: return "LayoutO
bjectsThatAreTextAndCanUseTheSimpleFontCodePath"; | 137 case LayoutObjectsThatAreTextAndCanUseTheSimpleFontCodePath: return "LayoutO
bjectsThatAreTextAndCanUseTheSimpleFontCodePath"; |
| 136 case CharactersInLayoutObjectsThatAreTextAndCanUseTheSimpleFontCodePath: ret
urn "CharactersInLayoutObjectsThatAreTextAndCanUseTheSimpleFontCodePath"; | 138 case CharactersInLayoutObjectsThatAreTextAndCanUseTheSimpleFontCodePath: ret
urn "CharactersInLayoutObjectsThatAreTextAndCanUseTheSimpleFontCodePath"; |
| 137 case TotalLayoutObjectsThatWereLaidOut: return "TotalLayoutObjectsThatWereLa
idOut"; | 139 case TotalLayoutObjectsThatWereLaidOut: return "TotalLayoutObjectsThatWereLa
idOut"; |
| 138 } | 140 } |
| 139 ASSERT_NOT_REACHED(); | 141 ASSERT_NOT_REACHED(); |
| 140 return ""; | 142 return ""; |
| 141 } | 143 } |
| 142 | 144 |
| 143 } // namespace blink | 145 } // namespace blink |
| OLD | NEW |