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

Side by Side Diff: third_party/WebKit/Source/core/dom/Document.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 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2001 Dirk Mueller (mueller@kde.org) 4 * (C) 2001 Dirk Mueller (mueller@kde.org)
5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org) 5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org)
6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2012 Apple Inc. All 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2012 Apple Inc. All
7 * rights reserved. 7 * rights reserved.
8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. 8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved.
9 * (http://www.torchmobile.com/) 9 * (http://www.torchmobile.com/)
10 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved. 10 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved.
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 #include "core/SVGElementFactory.h" 49 #include "core/SVGElementFactory.h"
50 #include "core/SVGNames.h" 50 #include "core/SVGNames.h"
51 #include "core/XMLNSNames.h" 51 #include "core/XMLNSNames.h"
52 #include "core/XMLNames.h" 52 #include "core/XMLNames.h"
53 #include "core/animation/CompositorPendingAnimations.h" 53 #include "core/animation/CompositorPendingAnimations.h"
54 #include "core/animation/DocumentAnimations.h" 54 #include "core/animation/DocumentAnimations.h"
55 #include "core/animation/DocumentTimeline.h" 55 #include "core/animation/DocumentTimeline.h"
56 #include "core/css/CSSFontSelector.h" 56 #include "core/css/CSSFontSelector.h"
57 #include "core/css/CSSStyleDeclaration.h" 57 #include "core/css/CSSStyleDeclaration.h"
58 #include "core/css/CSSStyleSheet.h" 58 #include "core/css/CSSStyleSheet.h"
59 #include "core/css/CSSTiming.h"
59 #include "core/css/FontFaceSet.h" 60 #include "core/css/FontFaceSet.h"
60 #include "core/css/MediaQueryMatcher.h" 61 #include "core/css/MediaQueryMatcher.h"
61 #include "core/css/PropertyRegistry.h" 62 #include "core/css/PropertyRegistry.h"
62 #include "core/css/StylePropertySet.h" 63 #include "core/css/StylePropertySet.h"
63 #include "core/css/StyleSheetContents.h" 64 #include "core/css/StyleSheetContents.h"
64 #include "core/css/StyleSheetList.h" 65 #include "core/css/StyleSheetList.h"
65 #include "core/css/invalidation/StyleInvalidator.h" 66 #include "core/css/invalidation/StyleInvalidator.h"
66 #include "core/css/parser/CSSParser.h" 67 #include "core/css/parser/CSSParser.h"
67 #include "core/css/resolver/FontBuilder.h" 68 #include "core/css/resolver/FontBuilder.h"
68 #include "core/css/resolver/StyleResolver.h" 69 #include "core/css/resolver/StyleResolver.h"
(...skipping 1933 matching lines...) Expand 10 before | Expand all | Expand 10 after
2002 void Document::updateActiveStyle() { 2003 void Document::updateActiveStyle() {
2003 DCHECK(isActive()); 2004 DCHECK(isActive());
2004 DCHECK(isMainThread()); 2005 DCHECK(isMainThread());
2005 TRACE_EVENT0("blink", "Document::updateActiveStyle"); 2006 TRACE_EVENT0("blink", "Document::updateActiveStyle");
2006 styleEngine().updateActiveStyle(); 2007 styleEngine().updateActiveStyle();
2007 } 2008 }
2008 2009
2009 void Document::updateStyle() { 2010 void Document::updateStyle() {
2010 DCHECK(!view()->shouldThrottleRendering()); 2011 DCHECK(!view()->shouldThrottleRendering());
2011 TRACE_EVENT_BEGIN0("blink,blink_style", "Document::updateStyle"); 2012 TRACE_EVENT_BEGIN0("blink,blink_style", "Document::updateStyle");
2012 SCOPED_BLINK_UMA_HISTOGRAM_TIMER("Style.UpdateTime"); 2013 double startTime = monotonicallyIncreasingTime();
2013 2014
2014 unsigned initialElementCount = styleEngine().styleForElementCount(); 2015 unsigned initialElementCount = styleEngine().styleForElementCount();
2015 2016
2016 HTMLFrameOwnerElement::UpdateSuspendScope suspendWidgetHierarchyUpdates; 2017 HTMLFrameOwnerElement::UpdateSuspendScope suspendWidgetHierarchyUpdates;
2017 m_lifecycle.advanceTo(DocumentLifecycle::InStyleRecalc); 2018 m_lifecycle.advanceTo(DocumentLifecycle::InStyleRecalc);
2018 2019
2019 StyleRecalcChange change = NoChange; 2020 StyleRecalcChange change = NoChange;
2020 if (getStyleChangeType() >= SubtreeStyleChange) 2021 if (getStyleChangeType() >= SubtreeStyleChange)
2021 change = Force; 2022 change = Force;
2022 2023
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
2074 if (shouldRecordStats) { 2075 if (shouldRecordStats) {
2075 TRACE_EVENT_END2("blink,blink_style", "Document::updateStyle", 2076 TRACE_EVENT_END2("blink,blink_style", "Document::updateStyle",
2076 "resolverAccessCount", 2077 "resolverAccessCount",
2077 styleEngine().styleForElementCount() - initialElementCount, 2078 styleEngine().styleForElementCount() - initialElementCount,
2078 "counters", styleEngine().stats()->toTracedValue()); 2079 "counters", styleEngine().stats()->toTracedValue());
2079 } else { 2080 } else {
2080 TRACE_EVENT_END1( 2081 TRACE_EVENT_END1(
2081 "blink,blink_style", "Document::updateStyle", "resolverAccessCount", 2082 "blink,blink_style", "Document::updateStyle", "resolverAccessCount",
2082 styleEngine().styleForElementCount() - initialElementCount); 2083 styleEngine().styleForElementCount() - initialElementCount);
2083 } 2084 }
2085
2086 double updateDurationSeconds = monotonicallyIncreasingTime() - startTime;
2087 DEFINE_STATIC_LOCAL(CustomCountHistogram, updateHistogram,
2088 ("Style.UpdateTime", 0, 10000000, 50));
2089 updateHistogram.count(updateDurationSeconds * 1000 * 1000);
2090 CSSTiming::from(*this).recordUpdateDuration(updateDurationSeconds);
2084 } 2091 }
2085 2092
2086 void Document::notifyLayoutTreeOfSubtreeChanges() { 2093 void Document::notifyLayoutTreeOfSubtreeChanges() {
2087 if (!layoutViewItem().wasNotifiedOfSubtreeChange()) 2094 if (!layoutViewItem().wasNotifiedOfSubtreeChange())
2088 return; 2095 return;
2089 2096
2090 m_lifecycle.advanceTo(DocumentLifecycle::InLayoutSubtreeChange); 2097 m_lifecycle.advanceTo(DocumentLifecycle::InLayoutSubtreeChange);
2091 2098
2092 layoutViewItem().handleSubtreeModifications(); 2099 layoutViewItem().handleSubtreeModifications();
2093 DCHECK(!layoutViewItem().wasNotifiedOfSubtreeChange()); 2100 DCHECK(!layoutViewItem().wasNotifiedOfSubtreeChange());
(...skipping 4452 matching lines...) Expand 10 before | Expand all | Expand 10 after
6546 } 6553 }
6547 6554
6548 void showLiveDocumentInstances() { 6555 void showLiveDocumentInstances() {
6549 WeakDocumentSet& set = liveDocumentSet(); 6556 WeakDocumentSet& set = liveDocumentSet();
6550 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); 6557 fprintf(stderr, "There are %u documents currently alive:\n", set.size());
6551 for (Document* document : set) 6558 for (Document* document : set)
6552 fprintf(stderr, "- Document %p URL: %s\n", document, 6559 fprintf(stderr, "- Document %p URL: %s\n", document,
6553 document->url().getString().utf8().data()); 6560 document->url().getString().utf8().data());
6554 } 6561 }
6555 #endif 6562 #endif
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/css/StyleSheetContents.cpp ('k') | third_party/WebKit/Source/core/timing/PerformanceTiming.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698