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

Side by Side Diff: third_party/WebKit/Source/core/frame/FrameView.cpp

Issue 2623043002: Fix first paint tracking for SPv2 (Closed)
Patch Set: Created 3 years, 11 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 * Copyright (C) 1998, 1999 Torben Weis <weis@kde.org> 2 * Copyright (C) 1998, 1999 Torben Weis <weis@kde.org>
3 * 1999 Lars Knoll <knoll@kde.org> 3 * 1999 Lars Knoll <knoll@kde.org>
4 * 1999 Antti Koivisto <koivisto@kde.org> 4 * 1999 Antti Koivisto <koivisto@kde.org>
5 * 2000 Dirk Mueller <mueller@kde.org> 5 * 2000 Dirk Mueller <mueller@kde.org>
6 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
7 * (C) 2006 Graham Dennis (graham.dennis@gmail.com) 7 * (C) 2006 Graham Dennis (graham.dennis@gmail.com)
8 * (C) 2006 Alexey Proskuryakov (ap@nypop.com) 8 * (C) 2006 Alexey Proskuryakov (ap@nypop.com)
9 * Copyright (C) 2009 Google Inc. All rights reserved. 9 * Copyright (C) 2009 Google Inc. All rights reserved.
10 * 10 *
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 #include "core/page/AutoscrollController.h" 87 #include "core/page/AutoscrollController.h"
88 #include "core/page/ChromeClient.h" 88 #include "core/page/ChromeClient.h"
89 #include "core/page/FocusController.h" 89 #include "core/page/FocusController.h"
90 #include "core/page/FrameTree.h" 90 #include "core/page/FrameTree.h"
91 #include "core/page/Page.h" 91 #include "core/page/Page.h"
92 #include "core/page/scrolling/RootScrollerUtil.h" 92 #include "core/page/scrolling/RootScrollerUtil.h"
93 #include "core/page/scrolling/ScrollingCoordinator.h" 93 #include "core/page/scrolling/ScrollingCoordinator.h"
94 #include "core/page/scrolling/TopDocumentRootScrollerController.h" 94 #include "core/page/scrolling/TopDocumentRootScrollerController.h"
95 #include "core/paint/FramePainter.h" 95 #include "core/paint/FramePainter.h"
96 #include "core/paint/PaintLayer.h" 96 #include "core/paint/PaintLayer.h"
97 #include "core/paint/PaintTiming.h"
97 #include "core/paint/PrePaintTreeWalk.h" 98 #include "core/paint/PrePaintTreeWalk.h"
98 #include "core/plugins/PluginView.h" 99 #include "core/plugins/PluginView.h"
99 #include "core/style/ComputedStyle.h" 100 #include "core/style/ComputedStyle.h"
100 #include "core/svg/SVGDocumentExtensions.h" 101 #include "core/svg/SVGDocumentExtensions.h"
101 #include "core/svg/SVGSVGElement.h" 102 #include "core/svg/SVGSVGElement.h"
102 #include "platform/Histogram.h" 103 #include "platform/Histogram.h"
103 #include "platform/HostWindow.h" 104 #include "platform/HostWindow.h"
104 #include "platform/RuntimeEnabledFeatures.h" 105 #include "platform/RuntimeEnabledFeatures.h"
105 #include "platform/ScriptForbiddenScope.h" 106 #include "platform/ScriptForbiddenScope.h"
106 #include "platform/WebFrameScheduler.h" 107 #include "platform/WebFrameScheduler.h"
(...skipping 2888 matching lines...) Expand 10 before | Expand all | Expand 10 after
2995 }); 2996 });
2996 2997
2997 if (RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled()) 2998 if (RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled())
2998 PrePaintTreeWalk().walk(*this); 2999 PrePaintTreeWalk().walk(*this);
2999 3000
3000 forAllNonThrottledFrameViews([](FrameView& frameView) { 3001 forAllNonThrottledFrameViews([](FrameView& frameView) {
3001 frameView.lifecycle().advanceTo(DocumentLifecycle::PrePaintClean); 3002 frameView.lifecycle().advanceTo(DocumentLifecycle::PrePaintClean);
3002 }); 3003 });
3003 } 3004 }
3004 3005
3006 void FrameView::notifyPaint(const PaintController& paintController) const {
3007 if (Document* document = m_frame->document()) {
3008 PaintTiming::from(*document).notifyPaint(paintController.firstPainted(),
3009 paintController.textPainted(),
3010 paintController.imagePainted());
3011 }
3012 }
3013
3005 void FrameView::paintTree() { 3014 void FrameView::paintTree() {
3006 TRACE_EVENT0("blink", "FrameView::paintTree"); 3015 TRACE_EVENT0("blink", "FrameView::paintTree");
3007 SCOPED_BLINK_UMA_HISTOGRAM_TIMER("Blink.Paint.UpdateTime"); 3016 SCOPED_BLINK_UMA_HISTOGRAM_TIMER("Blink.Paint.UpdateTime");
3008 3017
3009 ASSERT(frame() == page()->mainFrame() || 3018 ASSERT(frame() == page()->mainFrame() ||
3010 (!frame().tree().parent()->isLocalFrame())); 3019 (!frame().tree().parent()->isLocalFrame()));
3011 3020
3012 LayoutViewItem view = layoutViewItem(); 3021 LayoutViewItem view = layoutViewItem();
3013 ASSERT(!view.isNull()); 3022 ASSERT(!view.isNull());
3014 forAllNonThrottledFrameViews([](FrameView& frameView) { 3023 forAllNonThrottledFrameViews([](FrameView& frameView) {
3015 frameView.lifecycle().advanceTo(DocumentLifecycle::InPaint); 3024 frameView.lifecycle().advanceTo(DocumentLifecycle::InPaint);
3016 }); 3025 });
3017 3026
3018 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { 3027 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) {
3019 if (layoutView()->layer()->needsRepaint()) { 3028 if (layoutView()->layer()->needsRepaint()) {
3020 GraphicsContext graphicsContext(*m_paintController); 3029 GraphicsContext graphicsContext(*m_paintController);
3021 paint(graphicsContext, CullRect(LayoutRect::infiniteIntRect())); 3030 paint(graphicsContext, CullRect(LayoutRect::infiniteIntRect()));
3022 m_paintController->commitNewDisplayItems(LayoutSize()); 3031 m_paintController->commitNewDisplayItems(LayoutSize());
3032 notifyPaint(*m_paintController);
3023 } 3033 }
3024 } else { 3034 } else {
3025 // A null graphics layer can occur for painting of SVG images that are not 3035 // A null graphics layer can occur for painting of SVG images that are not
3026 // parented into the main frame tree, or when the FrameView is the main 3036 // parented into the main frame tree, or when the FrameView is the main
3027 // frame view of a page overlay. The page overlay is in the layer tree of 3037 // frame view of a page overlay. The page overlay is in the layer tree of
3028 // the host page and will be painted during painting of the host page. 3038 // the host page and will be painted during painting of the host page.
3029 if (GraphicsLayer* rootGraphicsLayer = 3039 if (GraphicsLayer* rootGraphicsLayer =
3030 view.compositor()->rootGraphicsLayer()) { 3040 view.compositor()->rootGraphicsLayer()) {
3031 paintGraphicsLayerRecursively(rootGraphicsLayer); 3041 paintGraphicsLayerRecursively(rootGraphicsLayer);
3032 } 3042 }
(...skipping 18 matching lines...) Expand all
3051 3061
3052 forAllNonThrottledFrameViews([](FrameView& frameView) { 3062 forAllNonThrottledFrameViews([](FrameView& frameView) {
3053 frameView.lifecycle().advanceTo(DocumentLifecycle::PaintClean); 3063 frameView.lifecycle().advanceTo(DocumentLifecycle::PaintClean);
3054 LayoutViewItem layoutViewItem = frameView.layoutViewItem(); 3064 LayoutViewItem layoutViewItem = frameView.layoutViewItem();
3055 if (!layoutViewItem.isNull()) 3065 if (!layoutViewItem.isNull())
3056 layoutViewItem.layer()->clearNeedsRepaintRecursively(); 3066 layoutViewItem.layer()->clearNeedsRepaintRecursively();
3057 }); 3067 });
3058 } 3068 }
3059 3069
3060 void FrameView::paintGraphicsLayerRecursively(GraphicsLayer* graphicsLayer) { 3070 void FrameView::paintGraphicsLayerRecursively(GraphicsLayer* graphicsLayer) {
3061 if (graphicsLayer->drawsContent()) 3071 if (graphicsLayer->drawsContent()) {
3062 graphicsLayer->paint(nullptr); 3072 graphicsLayer->paint(nullptr);
3073 notifyPaint(graphicsLayer->getPaintController());
3074 }
3063 3075
3064 if (!RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { 3076 if (!RuntimeEnabledFeatures::slimmingPaintV2Enabled()) {
3065 if (GraphicsLayer* maskLayer = graphicsLayer->maskLayer()) 3077 if (GraphicsLayer* maskLayer = graphicsLayer->maskLayer())
3066 paintGraphicsLayerRecursively(maskLayer); 3078 paintGraphicsLayerRecursively(maskLayer);
3067 if (GraphicsLayer* contentsClippingMaskLayer = 3079 if (GraphicsLayer* contentsClippingMaskLayer =
3068 graphicsLayer->contentsClippingMaskLayer()) 3080 graphicsLayer->contentsClippingMaskLayer())
3069 paintGraphicsLayerRecursively(contentsClippingMaskLayer); 3081 paintGraphicsLayerRecursively(contentsClippingMaskLayer);
3070 } 3082 }
3071 3083
3072 for (auto& child : graphicsLayer->children()) 3084 for (auto& child : graphicsLayer->children())
(...skipping 1829 matching lines...) Expand 10 before | Expand all | Expand 10 after
4902 reason < MainThreadScrollingReason::kMainThreadScrollingReasonCount; 4914 reason < MainThreadScrollingReason::kMainThreadScrollingReasonCount;
4903 ++reason) { 4915 ++reason) {
4904 if (m_mainThreadScrollingReasonsCounter[reason] > 0) { 4916 if (m_mainThreadScrollingReasonsCounter[reason] > 0) {
4905 reasons |= 1 << reason; 4917 reasons |= 1 << reason;
4906 } 4918 }
4907 } 4919 }
4908 return reasons; 4920 return reasons;
4909 } 4921 }
4910 4922
4911 } // namespace blink 4923 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698