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

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

Issue 2623043002: Fix first paint tracking for SPv2 (Closed)
Patch Set: Rebase and update comments 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 2889 matching lines...) Expand 10 before | Expand all | Expand 10 after
2996 }); 2997 });
2997 2998
2998 if (RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled()) 2999 if (RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled())
2999 PrePaintTreeWalk().walk(*this); 3000 PrePaintTreeWalk().walk(*this);
3000 3001
3001 forAllNonThrottledFrameViews([](FrameView& frameView) { 3002 forAllNonThrottledFrameViews([](FrameView& frameView) {
3002 frameView.lifecycle().advanceTo(DocumentLifecycle::PrePaintClean); 3003 frameView.lifecycle().advanceTo(DocumentLifecycle::PrePaintClean);
3003 }); 3004 });
3004 } 3005 }
3005 3006
3007 void FrameView::notifyPaint(const PaintController& paintController) const {
3008 if (Document* document = m_frame->document()) {
pdr. 2017/01/12 21:56:45 Would it be valid to add DCHECK(m_frame->document(
Xianzhu 2017/01/12 22:13:39 Yes. We should have document if we have painted.
3009 PaintTiming::from(*document).notifyPaint(paintController.firstPainted(),
3010 paintController.textPainted(),
3011 paintController.imagePainted());
3012 }
3013 }
3014
3006 void FrameView::paintTree() { 3015 void FrameView::paintTree() {
3007 TRACE_EVENT0("blink", "FrameView::paintTree"); 3016 TRACE_EVENT0("blink", "FrameView::paintTree");
3008 SCOPED_BLINK_UMA_HISTOGRAM_TIMER("Blink.Paint.UpdateTime"); 3017 SCOPED_BLINK_UMA_HISTOGRAM_TIMER("Blink.Paint.UpdateTime");
3009 3018
3010 ASSERT(frame() == page()->mainFrame() || 3019 ASSERT(frame() == page()->mainFrame() ||
3011 (!frame().tree().parent()->isLocalFrame())); 3020 (!frame().tree().parent()->isLocalFrame()));
3012 3021
3013 LayoutViewItem view = layoutViewItem(); 3022 LayoutViewItem view = layoutViewItem();
3014 ASSERT(!view.isNull()); 3023 ASSERT(!view.isNull());
3015 forAllNonThrottledFrameViews([](FrameView& frameView) { 3024 forAllNonThrottledFrameViews([](FrameView& frameView) {
3016 frameView.lifecycle().advanceTo(DocumentLifecycle::InPaint); 3025 frameView.lifecycle().advanceTo(DocumentLifecycle::InPaint);
3017 }); 3026 });
3018 3027
3019 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { 3028 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) {
3020 if (layoutView()->layer()->needsRepaint()) { 3029 if (layoutView()->layer()->needsRepaint()) {
3021 GraphicsContext graphicsContext(*m_paintController); 3030 GraphicsContext graphicsContext(*m_paintController);
3022 paint(graphicsContext, CullRect(LayoutRect::infiniteIntRect())); 3031 paint(graphicsContext, CullRect(LayoutRect::infiniteIntRect()));
3023 m_paintController->commitNewDisplayItems(LayoutSize()); 3032 m_paintController->commitNewDisplayItems(LayoutSize());
3033 notifyPaint(*m_paintController);
3024 } 3034 }
3025 } else { 3035 } else {
3026 // A null graphics layer can occur for painting of SVG images that are not 3036 // A null graphics layer can occur for painting of SVG images that are not
3027 // parented into the main frame tree, or when the FrameView is the main 3037 // parented into the main frame tree, or when the FrameView is the main
3028 // frame view of a page overlay. The page overlay is in the layer tree of 3038 // frame view of a page overlay. The page overlay is in the layer tree of
3029 // the host page and will be painted during painting of the host page. 3039 // the host page and will be painted during painting of the host page.
3030 if (GraphicsLayer* rootGraphicsLayer = 3040 if (GraphicsLayer* rootGraphicsLayer =
3031 view.compositor()->rootGraphicsLayer()) { 3041 view.compositor()->rootGraphicsLayer()) {
3032 paintGraphicsLayerRecursively(rootGraphicsLayer); 3042 paintGraphicsLayerRecursively(rootGraphicsLayer);
3033 } 3043 }
(...skipping 18 matching lines...) Expand all
3052 3062
3053 forAllNonThrottledFrameViews([](FrameView& frameView) { 3063 forAllNonThrottledFrameViews([](FrameView& frameView) {
3054 frameView.lifecycle().advanceTo(DocumentLifecycle::PaintClean); 3064 frameView.lifecycle().advanceTo(DocumentLifecycle::PaintClean);
3055 LayoutViewItem layoutViewItem = frameView.layoutViewItem(); 3065 LayoutViewItem layoutViewItem = frameView.layoutViewItem();
3056 if (!layoutViewItem.isNull()) 3066 if (!layoutViewItem.isNull())
3057 layoutViewItem.layer()->clearNeedsRepaintRecursively(); 3067 layoutViewItem.layer()->clearNeedsRepaintRecursively();
3058 }); 3068 });
3059 } 3069 }
3060 3070
3061 void FrameView::paintGraphicsLayerRecursively(GraphicsLayer* graphicsLayer) { 3071 void FrameView::paintGraphicsLayerRecursively(GraphicsLayer* graphicsLayer) {
3062 if (graphicsLayer->drawsContent()) 3072 if (graphicsLayer->drawsContent()) {
3063 graphicsLayer->paint(nullptr); 3073 graphicsLayer->paint(nullptr);
3074 notifyPaint(graphicsLayer->getPaintController());
3075 }
3064 3076
3065 if (!RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { 3077 if (!RuntimeEnabledFeatures::slimmingPaintV2Enabled()) {
3066 if (GraphicsLayer* maskLayer = graphicsLayer->maskLayer()) 3078 if (GraphicsLayer* maskLayer = graphicsLayer->maskLayer())
3067 paintGraphicsLayerRecursively(maskLayer); 3079 paintGraphicsLayerRecursively(maskLayer);
3068 if (GraphicsLayer* contentsClippingMaskLayer = 3080 if (GraphicsLayer* contentsClippingMaskLayer =
3069 graphicsLayer->contentsClippingMaskLayer()) 3081 graphicsLayer->contentsClippingMaskLayer())
3070 paintGraphicsLayerRecursively(contentsClippingMaskLayer); 3082 paintGraphicsLayerRecursively(contentsClippingMaskLayer);
3071 } 3083 }
3072 3084
3073 for (auto& child : graphicsLayer->children()) 3085 for (auto& child : graphicsLayer->children())
(...skipping 1839 matching lines...) Expand 10 before | Expand all | Expand 10 after
4913 reason < MainThreadScrollingReason::kMainThreadScrollingReasonCount; 4925 reason < MainThreadScrollingReason::kMainThreadScrollingReasonCount;
4914 ++reason) { 4926 ++reason) {
4915 if (m_mainThreadScrollingReasonsCounter[reason] > 0) { 4927 if (m_mainThreadScrollingReasonsCounter[reason] > 0) {
4916 reasons |= 1 << reason; 4928 reasons |= 1 << reason;
4917 } 4929 }
4918 } 4930 }
4919 return reasons; 4931 return reasons;
4920 } 4932 }
4921 4933
4922 } // namespace blink 4934 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698