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

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

Issue 2533783003: Add metrics for style update time before FCP. (Closed)
Patch Set: value_or(base::TimeDelta()) 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 /* 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 310 matching lines...) Expand 10 before | Expand all | Expand 10 after
321 const AtomicString& StyleSheetContents::namespaceURIFromPrefix( 321 const AtomicString& StyleSheetContents::namespaceURIFromPrefix(
322 const AtomicString& prefix) { 322 const AtomicString& prefix) {
323 return m_namespaces.get(prefix); 323 return m_namespaces.get(prefix);
324 } 324 }
325 325
326 void StyleSheetContents::parseAuthorStyleSheet( 326 void StyleSheetContents::parseAuthorStyleSheet(
327 const CSSStyleSheetResource* cachedStyleSheet, 327 const CSSStyleSheetResource* cachedStyleSheet,
328 const SecurityOrigin* securityOrigin) { 328 const SecurityOrigin* securityOrigin) {
329 TRACE_EVENT1("blink,devtools.timeline", "ParseAuthorStyleSheet", "data", 329 TRACE_EVENT1("blink,devtools.timeline", "ParseAuthorStyleSheet", "data",
330 InspectorParseAuthorStyleSheetEvent::data(cachedStyleSheet)); 330 InspectorParseAuthorStyleSheetEvent::data(cachedStyleSheet));
331 double startTimeMS = monotonicallyIncreasingTimeMS(); 331 double startTime = monotonicallyIncreasingTime();
332 332
333 bool isSameOriginRequest = 333 bool isSameOriginRequest =
334 securityOrigin && securityOrigin->canRequest(baseURL()); 334 securityOrigin && securityOrigin->canRequest(baseURL());
335 335
336 // When the response was fetched via the Service Worker, the original URL may 336 // When the response was fetched via the Service Worker, the original URL may
337 // not be same as the base URL. 337 // not be same as the base URL.
338 // TODO(horo): When we will use the original URL as the base URL, we can 338 // TODO(horo): When we will use the original URL as the base URL, we can
339 // remove this check. crbug.com/553535 339 // remove this check. crbug.com/553535
340 if (cachedStyleSheet->response().wasFetchedViaServiceWorker()) { 340 if (cachedStyleSheet->response().wasFetchedViaServiceWorker()) {
341 const KURL originalURL( 341 const KURL originalURL(
(...skipping 15 matching lines...) Expand all
357 // Try to get deprecated header. 357 // Try to get deprecated header.
358 m_sourceMapURL = response.httpHeaderField(HTTPNames::X_SourceMap); 358 m_sourceMapURL = response.httpHeaderField(HTTPNames::X_SourceMap);
359 } 359 }
360 360
361 CSSParserContext context(parserContext(), UseCounter::getFrom(this)); 361 CSSParserContext context(parserContext(), UseCounter::getFrom(this));
362 CSSParser::parseSheet(context, this, sheetText, 362 CSSParser::parseSheet(context, this, sheetText,
363 RuntimeEnabledFeatures::lazyParseCSSEnabled()); 363 RuntimeEnabledFeatures::lazyParseCSSEnabled());
364 364
365 DEFINE_STATIC_LOCAL(CustomCountHistogram, parseHistogram, 365 DEFINE_STATIC_LOCAL(CustomCountHistogram, parseHistogram,
366 ("Style.AuthorStyleSheet.ParseTime", 0, 10000000, 50)); 366 ("Style.AuthorStyleSheet.ParseTime", 0, 10000000, 50));
367 double parseDurationMS = (monotonicallyIncreasingTimeMS() - startTimeMS); 367 double parseDurationSeconds = (monotonicallyIncreasingTime() - startTime);
368 parseHistogram.count(parseDurationMS * 1000); 368 parseHistogram.count(parseDurationSeconds * 1000 * 1000);
369 if (Document* document = singleOwnerDocument()) { 369 if (Document* document = singleOwnerDocument()) {
370 // CSSTiming expects time in seconds. 370 CSSTiming::from(*document).recordAuthorStyleSheetParseTime(
371 CSSTiming::from(*document).recordAuthorStyleSheetParseTime(parseDurationMS / 371 parseDurationSeconds);
372 1000);
373 } 372 }
374 } 373 }
375 374
376 void StyleSheetContents::parseString(const String& sheetText) { 375 void StyleSheetContents::parseString(const String& sheetText) {
377 parseStringAtPosition(sheetText, TextPosition::minimumPosition()); 376 parseStringAtPosition(sheetText, TextPosition::minimumPosition());
378 } 377 }
379 378
380 void StyleSheetContents::parseStringAtPosition( 379 void StyleSheetContents::parseStringAtPosition(
381 const String& sheetText, 380 const String& sheetText,
382 const TextPosition& startPosition) { 381 const TextPosition& startPosition) {
(...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after
685 visitor->trace(m_importRules); 684 visitor->trace(m_importRules);
686 visitor->trace(m_namespaceRules); 685 visitor->trace(m_namespaceRules);
687 visitor->trace(m_childRules); 686 visitor->trace(m_childRules);
688 visitor->trace(m_loadingClients); 687 visitor->trace(m_loadingClients);
689 visitor->trace(m_completedClients); 688 visitor->trace(m_completedClients);
690 visitor->trace(m_ruleSet); 689 visitor->trace(m_ruleSet);
691 visitor->trace(m_referencedFromResource); 690 visitor->trace(m_referencedFromResource);
692 } 691 }
693 692
694 } // namespace blink 693 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/css/CSSTiming.cpp ('k') | third_party/WebKit/Source/core/dom/Document.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698