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

Unified Diff: third_party/WebKit/Source/core/css/parser/CSSLazyParsingState.cpp

Issue 2711853003: [LazyParseCSS] WIP Implement token discarding
Patch Set: lookup in escape string pool Created 3 years, 10 months 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/css/parser/CSSLazyParsingState.cpp
diff --git a/third_party/WebKit/Source/core/css/parser/CSSLazyParsingState.cpp b/third_party/WebKit/Source/core/css/parser/CSSLazyParsingState.cpp
index ecac1b8441bce38613c39208877c01c42ce4d74e..94fb52a8d7d7eff7b971e091bd4d0c6e4874ea98 100644
--- a/third_party/WebKit/Source/core/css/parser/CSSLazyParsingState.cpp
+++ b/third_party/WebKit/Source/core/css/parser/CSSLazyParsingState.cpp
@@ -16,14 +16,18 @@ CSSLazyParsingState::CSSLazyParsingState(const CSSParserContext* context,
const String& sheetText,
StyleSheetContents* contents)
: m_context(context),
- m_escapedStrings(std::move(escapedStrings)),
m_sheetText(sheetText),
m_owningContents(contents),
m_parsedStyleRules(0),
m_totalStyleRules(0),
m_styleRulesNeededForNextMilestone(0),
m_usage(UsageGe0),
- m_shouldUseCount(m_context->isUseCounterRecordingEnabled()) {}
+ m_shouldUseCount(m_context->isUseCounterRecordingEnabled()) {
+ m_escapedStrings.reserveCapacityForSize(escapedStrings.size());
+ for (const auto& escapedString : escapedStrings) {
+ m_escapedStrings.insert(escapedString.impl()->bytes(), escapedString);
+ }
+}
void CSSLazyParsingState::finishInitialParsing() {
recordUsageMetrics();
@@ -89,6 +93,11 @@ bool CSSLazyParsingState::shouldLazilyParseProperties(
return true;
}
+bool CSSLazyParsingState::tokenBackingUsesEscapedString(
+ const void* tokenBackingBytes) {
+ return m_escapedStrings.contains(tokenBackingBytes);
+}
+
void CSSLazyParsingState::recordUsageMetrics() {
DEFINE_STATIC_LOCAL(EnumerationHistogram, usageHistogram,
("Style.LazyUsage.Percent", UsageLastValue));

Powered by Google App Engine
This is Rietveld 408576698