Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(30)

Side by Side Diff: third_party/WebKit/Source/core/css/parser/CSSParserImpl.cpp

Issue 2533093002: [LazyParseCSS] Add histogram for rule usage % (Closed)
Patch Set: timloh review + add test Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/css/parser/CSSParserImpl.h" 5 #include "core/css/parser/CSSParserImpl.h"
6 6
7 #include "core/css/CSSCustomIdentValue.h" 7 #include "core/css/CSSCustomIdentValue.h"
8 #include "core/css/CSSCustomPropertyDeclaration.h" 8 #include "core/css/CSSCustomPropertyDeclaration.h"
9 #include "core/css/CSSKeyframesRule.h" 9 #include "core/css/CSSKeyframesRule.h"
10 #include "core/css/CSSStyleSheet.h" 10 #include "core/css/CSSStyleSheet.h"
(...skipping 783 matching lines...) Expand 10 before | Expand all | Expand 10 after
794 CSSSelectorParser::parseSelector(prelude, m_context, m_styleSheet); 794 CSSSelectorParser::parseSelector(prelude, m_context, m_styleSheet);
795 if (!selectorList.isValid()) 795 if (!selectorList.isValid())
796 return nullptr; // Parse error, invalid selector list 796 return nullptr; // Parse error, invalid selector list
797 797
798 // TODO(csharrison): How should we lazily parse css that needs the observer? 798 // TODO(csharrison): How should we lazily parse css that needs the observer?
799 if (m_observerWrapper) { 799 if (m_observerWrapper) {
800 observeSelectors(*m_observerWrapper, prelude); 800 observeSelectors(*m_observerWrapper, prelude);
801 } else if (m_lazyState && 801 } else if (m_lazyState &&
802 m_lazyState->shouldLazilyParseProperties(selectorList, block)) { 802 m_lazyState->shouldLazilyParseProperties(selectorList, block)) {
803 DCHECK(m_styleSheet); 803 DCHECK(m_styleSheet);
804 return StyleRule::createLazy( 804 return StyleRule::createLazy(std::move(selectorList),
805 std::move(selectorList), 805 m_lazyState->createLazyParser(block));
806 new CSSLazyPropertyParserImpl(block, m_lazyState));
807 } 806 }
808 consumeDeclarationList(block, StyleRule::Style); 807 consumeDeclarationList(block, StyleRule::Style);
809 808
810 return StyleRule::create( 809 return StyleRule::create(
811 std::move(selectorList), 810 std::move(selectorList),
812 createStylePropertySet(m_parsedProperties, m_context.mode())); 811 createStylePropertySet(m_parsedProperties, m_context.mode()));
813 } 812 }
814 813
815 void CSSParserImpl::consumeDeclarationList(CSSParserTokenRange range, 814 void CSSParserImpl::consumeDeclarationList(CSSParserTokenRange range,
816 StyleRule::RuleType ruleType) { 815 StyleRule::RuleType ruleType) {
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
965 else 964 else
966 return nullptr; // Parser error, invalid value in keyframe selector 965 return nullptr; // Parser error, invalid value in keyframe selector
967 if (range.atEnd()) 966 if (range.atEnd())
968 return result; 967 return result;
969 if (range.consume().type() != CommaToken) 968 if (range.consume().type() != CommaToken)
970 return nullptr; // Parser error 969 return nullptr; // Parser error
971 } 970 }
972 } 971 }
973 972
974 } // namespace blink 973 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698