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

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

Issue 2289333003: CSS Lazy Parsing perf jobs (Closed)
Patch Set: CL for src perf tryjob to run blink_style.top_25 benchmark on all-android platform(s) Created 4 years, 2 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * (C) 1999-2003 Lars Knoll (knoll@kde.org) 2 * (C) 1999-2003 Lars Knoll (knoll@kde.org)
3 * Copyright (C) 2004, 2006, 2007, 2012 Apple Inc. All rights reserved. 3 * Copyright (C) 2004, 2006, 2007, 2012 Apple Inc. All rights reserved.
4 * 4 *
5 * This library is free software; you can redistribute it and/or 5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public 6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either 7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version. 8 * version 2 of the License, or (at your option) any later version.
9 * 9 *
10 * This library is distributed in the hope that it will be useful, 10 * This library is distributed in the hope that it will be useful,
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 m_childRules(o.m_childRules.size()), 79 m_childRules(o.m_childRules.size()),
80 m_namespaces(o.m_namespaces), 80 m_namespaces(o.m_namespaces),
81 m_defaultNamespace(o.m_defaultNamespace), 81 m_defaultNamespace(o.m_defaultNamespace),
82 m_hasSyntacticallyValidCSSHeader(o.m_hasSyntacticallyValidCSSHeader), 82 m_hasSyntacticallyValidCSSHeader(o.m_hasSyntacticallyValidCSSHeader),
83 m_didLoadErrorOccur(false), 83 m_didLoadErrorOccur(false),
84 m_isMutable(false), 84 m_isMutable(false),
85 m_hasFontFaceRule(o.m_hasFontFaceRule), 85 m_hasFontFaceRule(o.m_hasFontFaceRule),
86 m_hasMediaQueries(o.m_hasMediaQueries), 86 m_hasMediaQueries(o.m_hasMediaQueries),
87 m_hasSingleOwnerDocument(true), 87 m_hasSingleOwnerDocument(true),
88 m_isUsedFromTextCache(false), 88 m_isUsedFromTextCache(false),
89 m_parserContext(o.m_parserContext) { 89 m_parserContext(o.m_parserContext),
90 m_escapedStrings(o.m_escapedStrings
91 ? new Vector<String>(*o.m_escapedStrings)
92 : nullptr),
93 m_sheetText(o.m_sheetText) {
90 // FIXME: Copy import rules. 94 // FIXME: Copy import rules.
91 ASSERT(o.m_importRules.isEmpty()); 95 ASSERT(o.m_importRules.isEmpty());
92 96
93 for (unsigned i = 0; i < m_childRules.size(); ++i) 97 for (unsigned i = 0; i < m_childRules.size(); ++i)
94 m_childRules[i] = o.m_childRules[i]->copy(); 98 m_childRules[i] = o.m_childRules[i]->copy();
95 } 99 }
96 100
97 StyleSheetContents::~StyleSheetContents() {} 101 StyleSheetContents::~StyleSheetContents() {}
98 102
99 void StyleSheetContents::setHasSyntacticallyValidCSSHeader(bool isValidCss) { 103 void StyleSheetContents::setHasSyntacticallyValidCSSHeader(bool isValidCss) {
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after
333 // |originalURL| is empty when the response is created in the SW. 337 // |originalURL| is empty when the response is created in the SW.
334 if (!originalURL.isEmpty() && !securityOrigin->canRequest(originalURL)) 338 if (!originalURL.isEmpty() && !securityOrigin->canRequest(originalURL))
335 isSameOriginRequest = false; 339 isSameOriginRequest = false;
336 } 340 }
337 341
338 CSSStyleSheetResource::MIMETypeCheck mimeTypeCheck = 342 CSSStyleSheetResource::MIMETypeCheck mimeTypeCheck =
339 isQuirksModeBehavior(m_parserContext.mode()) && isSameOriginRequest 343 isQuirksModeBehavior(m_parserContext.mode()) && isSameOriginRequest
340 ? CSSStyleSheetResource::MIMETypeCheck::Lax 344 ? CSSStyleSheetResource::MIMETypeCheck::Lax
341 : CSSStyleSheetResource::MIMETypeCheck::Strict; 345 : CSSStyleSheetResource::MIMETypeCheck::Strict;
342 String sheetText = cachedStyleSheet->sheetText(mimeTypeCheck); 346 String sheetText = cachedStyleSheet->sheetText(mimeTypeCheck);
347 if (true || RuntimeEnabledFeatures::lazyParseCSSEnabled())
348 m_sheetText = sheetText;
343 349
344 const ResourceResponse& response = cachedStyleSheet->response(); 350 const ResourceResponse& response = cachedStyleSheet->response();
345 m_sourceMapURL = response.httpHeaderField(HTTPNames::SourceMap); 351 m_sourceMapURL = response.httpHeaderField(HTTPNames::SourceMap);
346 if (m_sourceMapURL.isEmpty()) { 352 if (m_sourceMapURL.isEmpty()) {
347 // Try to get deprecated header. 353 // Try to get deprecated header.
348 m_sourceMapURL = response.httpHeaderField(HTTPNames::X_SourceMap); 354 m_sourceMapURL = response.httpHeaderField(HTTPNames::X_SourceMap);
349 } 355 }
350 356
351 CSSParserContext context(parserContext(), UseCounter::getFrom(this)); 357 CSSParserContext context(parserContext(), UseCounter::getFrom(this));
352 CSSParser::parseSheet(context, this, sheetText); 358 CSSParser::parseSheet(context, this, sheetText,
359 true || RuntimeEnabledFeatures::lazyParseCSSEnabled());
353 } 360 }
354 361
355 void StyleSheetContents::parseString(const String& sheetText) { 362 void StyleSheetContents::parseString(const String& sheetText) {
356 parseStringAtPosition(sheetText, TextPosition::minimumPosition()); 363 parseStringAtPosition(sheetText, TextPosition::minimumPosition());
357 } 364 }
358 365
359 void StyleSheetContents::parseStringAtPosition( 366 void StyleSheetContents::parseStringAtPosition(
360 const String& sheetText, 367 const String& sheetText,
361 const TextPosition& startPosition) { 368 const TextPosition& startPosition) {
362 CSSParserContext context(parserContext(), UseCounter::getFrom(this)); 369 CSSParserContext context(parserContext(), UseCounter::getFrom(this));
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
469 StyleSheetContents* root = rootStyleSheet(); 476 StyleSheetContents* root = rootStyleSheet();
470 return root->clientSingleOwnerDocument(); 477 return root->clientSingleOwnerDocument();
471 } 478 }
472 479
473 static bool childRulesHaveFailedOrCanceledSubresources( 480 static bool childRulesHaveFailedOrCanceledSubresources(
474 const HeapVector<Member<StyleRuleBase>>& rules) { 481 const HeapVector<Member<StyleRuleBase>>& rules) {
475 for (unsigned i = 0; i < rules.size(); ++i) { 482 for (unsigned i = 0; i < rules.size(); ++i) {
476 const StyleRuleBase* rule = rules[i].get(); 483 const StyleRuleBase* rule = rules[i].get();
477 switch (rule->type()) { 484 switch (rule->type()) {
478 case StyleRuleBase::Style: 485 case StyleRuleBase::Style:
479 if (toStyleRule(rule)->properties().hasFailedOrCanceledSubresources()) 486 if (toStyleRule(rule)->propertiesHaveFailedOrCanceledSubresources())
480 return true; 487 return true;
481 break; 488 break;
482 case StyleRuleBase::FontFace: 489 case StyleRuleBase::FontFace:
483 if (toStyleRuleFontFace(rule) 490 if (toStyleRuleFontFace(rule)
484 ->properties() 491 ->properties()
485 .hasFailedOrCanceledSubresources()) 492 .hasFailedOrCanceledSubresources())
486 return true; 493 return true;
487 break; 494 break;
488 case StyleRuleBase::Media: 495 case StyleRuleBase::Media:
489 if (childRulesHaveFailedOrCanceledSubresources( 496 if (childRulesHaveFailedOrCanceledSubresources(
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
664 visitor->trace(m_importRules); 671 visitor->trace(m_importRules);
665 visitor->trace(m_namespaceRules); 672 visitor->trace(m_namespaceRules);
666 visitor->trace(m_childRules); 673 visitor->trace(m_childRules);
667 visitor->trace(m_loadingClients); 674 visitor->trace(m_loadingClients);
668 visitor->trace(m_completedClients); 675 visitor->trace(m_completedClients);
669 visitor->trace(m_ruleSet); 676 visitor->trace(m_ruleSet);
670 visitor->trace(m_referencedFromResource); 677 visitor->trace(m_referencedFromResource);
671 } 678 }
672 679
673 } // namespace blink 680 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/css/StyleSheetContents.h ('k') | third_party/WebKit/Source/core/css/parser/CSSParser.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698