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

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

Issue 2051333005: Let FrameView track object paint invalidations (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@TrackInvalidation
Patch Set: NeedsRebaseline Created 4 years, 6 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 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 #include "core/page/scrolling/ScrollingCoordinator.h" 80 #include "core/page/scrolling/ScrollingCoordinator.h"
81 #include "core/paint/FramePainter.h" 81 #include "core/paint/FramePainter.h"
82 #include "core/paint/PaintLayer.h" 82 #include "core/paint/PaintLayer.h"
83 #include "core/paint/PrePaintTreeWalk.h" 83 #include "core/paint/PrePaintTreeWalk.h"
84 #include "core/plugins/PluginView.h" 84 #include "core/plugins/PluginView.h"
85 #include "core/style/ComputedStyle.h" 85 #include "core/style/ComputedStyle.h"
86 #include "core/svg/SVGDocumentExtensions.h" 86 #include "core/svg/SVGDocumentExtensions.h"
87 #include "core/svg/SVGSVGElement.h" 87 #include "core/svg/SVGSVGElement.h"
88 #include "platform/Histogram.h" 88 #include "platform/Histogram.h"
89 #include "platform/HostWindow.h" 89 #include "platform/HostWindow.h"
90 #include "platform/JSONValues.h"
90 #include "platform/RuntimeEnabledFeatures.h" 91 #include "platform/RuntimeEnabledFeatures.h"
91 #include "platform/ScriptForbiddenScope.h" 92 #include "platform/ScriptForbiddenScope.h"
92 #include "platform/TraceEvent.h" 93 #include "platform/TraceEvent.h"
93 #include "platform/TracedValue.h" 94 #include "platform/TracedValue.h"
94 #include "platform/fonts/FontCache.h" 95 #include "platform/fonts/FontCache.h"
95 #include "platform/geometry/DoubleRect.h" 96 #include "platform/geometry/DoubleRect.h"
96 #include "platform/geometry/FloatRect.h" 97 #include "platform/geometry/FloatRect.h"
97 #include "platform/geometry/LayoutRect.h" 98 #include "platform/geometry/LayoutRect.h"
98 #include "platform/graphics/GraphicsContext.h" 99 #include "platform/graphics/GraphicsContext.h"
99 #include "platform/graphics/GraphicsLayer.h" 100 #include "platform/graphics/GraphicsLayer.h"
(...skipping 26 matching lines...) Expand all
126 , m_canHaveScrollbars(true) 127 , m_canHaveScrollbars(true)
127 , m_hasPendingLayout(false) 128 , m_hasPendingLayout(false)
128 , m_inSynchronousPostLayout(false) 129 , m_inSynchronousPostLayout(false)
129 , m_postLayoutTasksTimer(this, &FrameView::postLayoutTimerFired) 130 , m_postLayoutTasksTimer(this, &FrameView::postLayoutTimerFired)
130 , m_updateWidgetsTimer(this, &FrameView::updateWidgetsTimerFired) 131 , m_updateWidgetsTimer(this, &FrameView::updateWidgetsTimerFired)
131 , m_renderThrottlingObserverNotificationFactory(CancellableTaskFactory::crea te(this, &FrameView::notifyRenderThrottlingObservers)) 132 , m_renderThrottlingObserverNotificationFactory(CancellableTaskFactory::crea te(this, &FrameView::notifyRenderThrottlingObservers))
132 , m_isTransparent(false) 133 , m_isTransparent(false)
133 , m_baseBackgroundColor(Color::white) 134 , m_baseBackgroundColor(Color::white)
134 , m_mediaType(MediaTypeNames::screen) 135 , m_mediaType(MediaTypeNames::screen)
135 , m_safeToPropagateScrollToParent(true) 136 , m_safeToPropagateScrollToParent(true)
136 , m_isTrackingPaintInvalidations(false)
137 , m_scrollCorner(nullptr) 137 , m_scrollCorner(nullptr)
138 , m_stickyPositionObjectCount(0) 138 , m_stickyPositionObjectCount(0)
139 , m_inputEventsScaleFactorForEmulation(1) 139 , m_inputEventsScaleFactorForEmulation(1)
140 , m_layoutSizeFixedToFrameSize(true) 140 , m_layoutSizeFixedToFrameSize(true)
141 , m_didScrollTimer(this, &FrameView::didScrollTimerFired) 141 , m_didScrollTimer(this, &FrameView::didScrollTimerFired)
142 , m_topControlsViewportAdjustment(0) 142 , m_topControlsViewportAdjustment(0)
143 , m_needsUpdateWidgetGeometries(false) 143 , m_needsUpdateWidgetGeometries(false)
144 , m_needsUpdateViewportIntersection(true) 144 , m_needsUpdateViewportIntersection(true)
145 , m_needsUpdateViewportIntersectionInSubtree(true) 145 , m_needsUpdateViewportIntersectionInSubtree(true)
146 #if ENABLE(ASSERT) 146 #if ENABLE(ASSERT)
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
213 m_layoutSchedulingEnabled = true; 213 m_layoutSchedulingEnabled = true;
214 m_inSynchronousPostLayout = false; 214 m_inSynchronousPostLayout = false;
215 m_layoutCount = 0; 215 m_layoutCount = 0;
216 m_nestedLayoutCount = 0; 216 m_nestedLayoutCount = 0;
217 m_postLayoutTasksTimer.stop(); 217 m_postLayoutTasksTimer.stop();
218 m_updateWidgetsTimer.stop(); 218 m_updateWidgetsTimer.stop();
219 m_firstLayout = true; 219 m_firstLayout = true;
220 m_safeToPropagateScrollToParent = true; 220 m_safeToPropagateScrollToParent = true;
221 m_lastViewportSize = IntSize(); 221 m_lastViewportSize = IntSize();
222 m_lastZoomFactor = 1.0f; 222 m_lastZoomFactor = 1.0f;
223 m_isTrackingPaintInvalidations = s_initialTrackAllPaintInvalidations; 223 m_trackedObjectPaintInvalidations = adoptPtr(s_initialTrackAllPaintInvalidat ions ? new Vector<ObjectPaintInvalidation> : nullptr);
224 m_visuallyNonEmptyCharacterCount = 0; 224 m_visuallyNonEmptyCharacterCount = 0;
225 m_visuallyNonEmptyPixelCount = 0; 225 m_visuallyNonEmptyPixelCount = 0;
226 m_isVisuallyNonEmpty = false; 226 m_isVisuallyNonEmpty = false;
227 clearFragmentAnchor(); 227 clearFragmentAnchor();
228 m_viewportConstrainedObjects.reset(); 228 m_viewportConstrainedObjects.reset();
229 m_layoutSubtreeRootList.clear(); 229 m_layoutSubtreeRootList.clear();
230 m_orthogonalWritingModeRootList.clear(); 230 m_orthogonalWritingModeRootList.clear();
231 } 231 }
232 232
233 // Call function for each non-throttled frame view in pre tree order. 233 // Call function for each non-throttled frame view in pre tree order.
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
376 376
377 LayoutPart* layoutObject = m_frame->ownerLayoutObject(); 377 LayoutPart* layoutObject = m_frame->ownerLayoutObject();
378 if (!layoutObject) 378 if (!layoutObject)
379 return; 379 return;
380 380
381 IntRect paintInvalidationRect = rect; 381 IntRect paintInvalidationRect = rect;
382 paintInvalidationRect.move(layoutObject->borderLeft() + layoutObject->paddin gLeft(), 382 paintInvalidationRect.move(layoutObject->borderLeft() + layoutObject->paddin gLeft(),
383 layoutObject->borderTop() + layoutObject->paddingTop()); 383 layoutObject->borderTop() + layoutObject->paddingTop());
384 // FIXME: We should not allow paint invalidation out of paint invalidation s tate. crbug.com/457415 384 // FIXME: We should not allow paint invalidation out of paint invalidation s tate. crbug.com/457415
385 DisablePaintInvalidationStateAsserts paintInvalidationAssertDisabler; 385 DisablePaintInvalidationStateAsserts paintInvalidationAssertDisabler;
386 layoutObject->invalidatePaintRectangleNotInvalidatingDisplayItemClients(Layo utRect(paintInvalidationRect)); 386 layoutObject->invalidatePaintRectangle(LayoutRect(paintInvalidationRect));
387 } 387 }
388 388
389 void FrameView::setFrameRect(const IntRect& newRect) 389 void FrameView::setFrameRect(const IntRect& newRect)
390 { 390 {
391 IntRect oldRect = frameRect(); 391 IntRect oldRect = frameRect();
392 if (newRect == oldRect) 392 if (newRect == oldRect)
393 return; 393 return;
394 394
395 Widget::setFrameRect(newRect); 395 Widget::setFrameRect(newRect);
396 396
(...skipping 2532 matching lines...) Expand 10 before | Expand all | Expand 10 after
2929 return parentPoint; 2929 return parentPoint;
2930 } 2930 }
2931 2931
2932 void FrameView::setInitialTracksPaintInvalidationsForTesting(bool trackPaintInva lidations) 2932 void FrameView::setInitialTracksPaintInvalidationsForTesting(bool trackPaintInva lidations)
2933 { 2933 {
2934 s_initialTrackAllPaintInvalidations = trackPaintInvalidations; 2934 s_initialTrackAllPaintInvalidations = trackPaintInvalidations;
2935 } 2935 }
2936 2936
2937 void FrameView::setTracksPaintInvalidations(bool trackPaintInvalidations) 2937 void FrameView::setTracksPaintInvalidations(bool trackPaintInvalidations)
2938 { 2938 {
2939 if (trackPaintInvalidations == m_isTrackingPaintInvalidations) 2939 if (trackPaintInvalidations == isTrackingPaintInvalidations())
2940 return; 2940 return;
2941 2941
2942 for (Frame* frame = m_frame->tree().top(); frame; frame = frame->tree().trav erseNext()) { 2942 for (Frame* frame = m_frame->tree().top(); frame; frame = frame->tree().trav erseNext()) {
2943 if (!frame->isLocalFrame()) 2943 if (!frame->isLocalFrame())
2944 continue; 2944 continue;
2945 if (LayoutViewItem layoutView = toLocalFrame(frame)->contentLayoutItem() ) { 2945 if (LayoutViewItem layoutView = toLocalFrame(frame)->contentLayoutItem() ) {
2946 layoutView.frameView()->m_isTrackingPaintInvalidations = trackPaintI nvalidations; 2946 layoutView.frameView()->m_trackedObjectPaintInvalidations = adoptPtr (trackPaintInvalidations ? new Vector<ObjectPaintInvalidation> : nullptr);
2947 layoutView.compositor()->setTracksPaintInvalidations(trackPaintInval idations); 2947 layoutView.compositor()->setTracksPaintInvalidations(trackPaintInval idations);
2948 } 2948 }
2949 } 2949 }
2950 2950
2951 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("blink.invalidation"), 2951 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("blink.invalidation"),
2952 "FrameView::setTracksPaintInvalidations", TRACE_EVENT_SCOPE_GLOBAL, "ena bled", trackPaintInvalidations); 2952 "FrameView::setTracksPaintInvalidations", TRACE_EVENT_SCOPE_GLOBAL, "ena bled", trackPaintInvalidations);
2953 }
2953 2954
2954 m_isTrackingPaintInvalidations = trackPaintInvalidations; 2955 void FrameView::trackObjectPaintInvalidation(const DisplayItemClient& client, Pa intInvalidationReason reason)
2956 {
2957 if (!m_trackedObjectPaintInvalidations)
2958 return;
2959
2960 ObjectPaintInvalidation invalidation = { client.debugName(), reason };
2961 m_trackedObjectPaintInvalidations->append(invalidation);
2962 }
2963
2964 PassRefPtr<JSONArray> FrameView::trackedObjectPaintInvalidationsAsJSON() const
2965 {
2966 if (!m_trackedObjectPaintInvalidations || m_trackedObjectPaintInvalidations- >isEmpty())
2967 return nullptr;
2968
2969 RefPtr<JSONArray> result = JSONArray::create();
2970 for (const auto& item : *m_trackedObjectPaintInvalidations) {
2971 RefPtr<JSONObject> itemJSON = JSONObject::create();
2972 itemJSON->setString("object", item.name);
2973 itemJSON->setString("reason", paintInvalidationReasonToString(item.reaso n));
2974 result->pushObject(itemJSON);
2975 }
2976 return result;
2955 } 2977 }
2956 2978
2957 void FrameView::addResizerArea(LayoutBox& resizerBox) 2979 void FrameView::addResizerArea(LayoutBox& resizerBox)
2958 { 2980 {
2959 if (!m_resizerAreas) 2981 if (!m_resizerAreas)
2960 m_resizerAreas = adoptPtr(new ResizerAreaSet); 2982 m_resizerAreas = adoptPtr(new ResizerAreaSet);
2961 m_resizerAreas->add(&resizerBox); 2983 m_resizerAreas->add(&resizerBox);
2962 } 2984 }
2963 2985
2964 void FrameView::removeResizerArea(LayoutBox& resizerBox) 2986 void FrameView::removeResizerArea(LayoutBox& resizerBox)
(...skipping 1188 matching lines...) Expand 10 before | Expand all | Expand 10 after
4153 return m_subtreeThrottled || (m_hiddenForThrottling && m_crossOriginForThrot tling); 4175 return m_subtreeThrottled || (m_hiddenForThrottling && m_crossOriginForThrot tling);
4154 } 4176 }
4155 4177
4156 LayoutBox& FrameView::boxForScrollControlPaintInvalidation() const 4178 LayoutBox& FrameView::boxForScrollControlPaintInvalidation() const
4157 { 4179 {
4158 ASSERT(!layoutViewItem().isNull()); 4180 ASSERT(!layoutViewItem().isNull());
4159 return *layoutView(); 4181 return *layoutView();
4160 } 4182 }
4161 4183
4162 } // namespace blink 4184 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/frame/FrameView.h ('k') | third_party/WebKit/Source/core/frame/LocalFrame.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698