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

Unified Diff: third_party/WebKit/Source/core/css/StyleSheetContents.cpp

Issue 2315923002: Lazy Parse CSS (Closed)
Patch Set: plug leaks Created 4 years, 3 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/StyleSheetContents.cpp
diff --git a/third_party/WebKit/Source/core/css/StyleSheetContents.cpp b/third_party/WebKit/Source/core/css/StyleSheetContents.cpp
index 9ad890082c3cc4b20fc52366b5317ba5fd16ad06..640048b5a2fd716da2783dee1199e76e6c8ed2cc 100644
--- a/third_party/WebKit/Source/core/css/StyleSheetContents.cpp
+++ b/third_party/WebKit/Source/core/css/StyleSheetContents.cpp
@@ -333,6 +333,8 @@ void StyleSheetContents::parseAuthorStyleSheet(const CSSStyleSheetResource* cach
CSSStyleSheetResource::MIMETypeCheck mimeTypeCheck = isQuirksModeBehavior(m_parserContext.mode()) && isSameOriginRequest ? CSSStyleSheetResource::MIMETypeCheck::Lax : CSSStyleSheetResource::MIMETypeCheck::Strict;
String sheetText = cachedStyleSheet->sheetText(mimeTypeCheck);
+ if (RuntimeEnabledFeatures::lazyParseCSSEnabled())
+ m_sheetText = sheetText;
const ResourceResponse& response = cachedStyleSheet->response();
m_sourceMapURL = response.httpHeaderField(HTTPNames::SourceMap);
@@ -341,8 +343,9 @@ void StyleSheetContents::parseAuthorStyleSheet(const CSSStyleSheetResource* cach
m_sourceMapURL = response.httpHeaderField(HTTPNames::X_SourceMap);
}
- CSSParserContext context(parserContext(), UseCounter::getFrom(this));
Timothy Loh 2016/09/26 05:18:00 Presumably there was some reason for this to be wr
Charlie Harrison 2016/09/26 22:14:45 After looking through the code I think you're righ
- CSSParser::parseSheet(context, this, sheetText);
+ // Note: pass the member context here, as lazy parsing requires retaining a
+ // reference to it.
+ CSSParser::parseSheet(parserContext(), this, sheetText, RuntimeEnabledFeatures::lazyParseCSSEnabled());
}
void StyleSheetContents::parseString(const String& sheetText)
@@ -474,7 +477,7 @@ static bool childRulesHaveFailedOrCanceledSubresources(const HeapVector<Member<S
const StyleRuleBase* rule = rules[i].get();
switch (rule->type()) {
case StyleRuleBase::Style:
- if (toStyleRule(rule)->properties().hasFailedOrCanceledSubresources())
+ if (toStyleRule(rule)->propertiesHaveFailedOrCanceledSubresources())
return true;
break;
case StyleRuleBase::FontFace:

Powered by Google App Engine
This is Rietveld 408576698