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

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

Issue 1774193002: New paint invalidation using paint property tree walk (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Correct tracking of paintInvalidationContainer Created 4 years, 9 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 1061 matching lines...) Expand 10 before | Expand all | Expand 10 after
1072 #if ENABLE(ASSERT) 1072 #if ENABLE(ASSERT)
1073 // Post-layout assert that nobody was re-marked as needing layout during lay out. 1073 // Post-layout assert that nobody was re-marked as needing layout during lay out.
1074 layoutView()->assertSubtreeIsLaidOut(); 1074 layoutView()->assertSubtreeIsLaidOut();
1075 #endif 1075 #endif
1076 1076
1077 frame().document()->layoutUpdated(); 1077 frame().document()->layoutUpdated();
1078 } 1078 }
1079 1079
1080 void FrameView::invalidateTreeIfNeeded(PaintInvalidationState& paintInvalidation State) 1080 void FrameView::invalidateTreeIfNeeded(PaintInvalidationState& paintInvalidation State)
1081 { 1081 {
1082 ASSERT(!RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled());
1083
1082 if (shouldThrottleRendering()) 1084 if (shouldThrottleRendering())
1083 return; 1085 return;
1084 1086
1085 lifecycle().advanceTo(DocumentLifecycle::InPaintInvalidation); 1087 lifecycle().advanceTo(DocumentLifecycle::InPaintInvalidation);
1086 1088
1087 RELEASE_ASSERT(layoutView()); 1089 RELEASE_ASSERT(layoutView());
1088 LayoutView& rootForPaintInvalidation = *layoutView(); 1090 LayoutView& rootForPaintInvalidation = *layoutView();
1089 ASSERT(!rootForPaintInvalidation.needsLayout()); 1091 ASSERT(!rootForPaintInvalidation.needsLayout());
1090 1092
1091 TRACE_EVENT1("blink", "FrameView::invalidateTree", "root", rootForPaintInval idation.debugName().ascii()); 1093 TRACE_EVENT1("blink", "FrameView::invalidateTree", "root", rootForPaintInval idation.debugName().ascii());
(...skipping 1296 matching lines...) Expand 10 before | Expand all | Expand 10 after
2388 } 2390 }
2389 2391
2390 void FrameView::updateLifecycleToLayoutClean() 2392 void FrameView::updateLifecycleToLayoutClean()
2391 { 2393 {
2392 frame().localFrameRoot()->view()->updateLifecyclePhasesInternal(OnlyUpToLayo utClean); 2394 frame().localFrameRoot()->view()->updateLifecyclePhasesInternal(OnlyUpToLayo utClean);
2393 } 2395 }
2394 2396
2395 void FrameView::scheduleVisualUpdateForPaintInvalidationIfNeeded() 2397 void FrameView::scheduleVisualUpdateForPaintInvalidationIfNeeded()
2396 { 2398 {
2397 LocalFrame* localFrameRoot = frame().localFrameRoot(); 2399 LocalFrame* localFrameRoot = frame().localFrameRoot();
2398 if (!localFrameRoot->view()->m_isUpdatingAllLifecyclePhases || lifecycle().s tate() >= DocumentLifecycle::PaintInvalidationClean) { 2400 if (!localFrameRoot->view()->m_isUpdatingAllLifecyclePhases
2401 || (!RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled() && lifec ycle().state() >= DocumentLifecycle::PaintInvalidationClean)
2402 || lifecycle().state() >= DocumentLifecycle::UpdatePaintPropertiesClean) {
2399 // Schedule visual update to process the paint invalidation in the next cycle. 2403 // Schedule visual update to process the paint invalidation in the next cycle.
2400 localFrameRoot->scheduleVisualUpdateUnlessThrottled(); 2404 localFrameRoot->scheduleVisualUpdateUnlessThrottled();
2401 } 2405 }
2402 // Otherwise the paint invalidation will be handled in paint invalidation ph ase of this cycle. 2406 // Otherwise the paint invalidation will be handled in paint invalidation ph ase of this cycle.
2403 } 2407 }
2404 2408
2405 // TODO(leviw): We don't assert lifecycle information from documents in child Pl uginViews. 2409 // TODO(leviw): We don't assert lifecycle information from documents in child Pl uginViews.
2406 void FrameView::updateLifecyclePhasesInternal(LifeCycleUpdateOption phases) 2410 void FrameView::updateLifecyclePhasesInternal(LifeCycleUpdateOption phases)
2407 { 2411 {
2408 Optional<TemporaryChange<bool>> isUpdatingAllLifecyclePhasesScope; 2412 Optional<TemporaryChange<bool>> isUpdatingAllLifecyclePhasesScope;
(...skipping 25 matching lines...) Expand all
2434 TRACE_EVENT1("devtools.timeline", "UpdateLayerTree", "data", Inspect orUpdateLayerTreeEvent::data(m_frame.get())); 2438 TRACE_EVENT1("devtools.timeline", "UpdateLayerTree", "data", Inspect orUpdateLayerTreeEvent::data(m_frame.get()));
2435 2439
2436 // This was required for slimming paint v1 but is only temporarily 2440 // This was required for slimming paint v1 but is only temporarily
2437 // needed for slimming paint v2. 2441 // needed for slimming paint v2.
2438 view->compositor()->updateIfNeededRecursive(); 2442 view->compositor()->updateIfNeededRecursive();
2439 scrollContentsIfNeededRecursive(); 2443 scrollContentsIfNeededRecursive();
2440 2444
2441 ASSERT(lifecycle().state() >= DocumentLifecycle::CompositingClean); 2445 ASSERT(lifecycle().state() >= DocumentLifecycle::CompositingClean);
2442 2446
2443 if (phases == AllPhases) { 2447 if (phases == AllPhases) {
2444 invalidateTreeIfNeededRecursive(); 2448 if (!RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled())
2449 invalidateTreeIfNeededRecursive();
2445 2450
2446 if (view->compositor()->inCompositingMode()) 2451 if (view->compositor()->inCompositingMode())
2447 scrollingCoordinator()->updateAfterCompositingChangeIfNeeded (); 2452 scrollingCoordinator()->updateAfterCompositingChangeIfNeeded ();
2448 2453
2449 updateCompositedSelectionIfNeeded(); 2454 updateCompositedSelectionIfNeeded();
2450 } 2455 }
2451 } 2456 }
2452 2457
2453 if (phases == AllPhases) { 2458 if (phases == AllPhases) {
2454 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) 2459 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled() || RuntimeEnabl edFeatures::slimmingPaintInvalidationEnabled())
2455 updatePaintProperties(); 2460 updatePaintProperties();
2456 2461
2457 if (!m_frame->document()->printing()) 2462 if (!m_frame->document()->printing())
2458 synchronizedPaint(); 2463 synchronizedPaint();
2459 2464
2460 if (RuntimeEnabledFeatures::frameTimingSupportEnabled()) 2465 if (RuntimeEnabledFeatures::frameTimingSupportEnabled())
2461 updateFrameTimingRequestsIfNeeded(); 2466 updateFrameTimingRequestsIfNeeded();
2462 2467
2463 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) 2468 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled())
2464 pushPaintArtifactToCompositor(); 2469 pushPaintArtifactToCompositor();
2465 2470
2466 ASSERT(!view->hasPendingSelection()); 2471 ASSERT(!view->hasPendingSelection());
2467 ASSERT((m_frame->document()->printing() && lifecycle().state() == Do cumentLifecycle::PaintInvalidationClean) 2472 ASSERT((m_frame->document()->printing() && lifecycle().state() == Do cumentLifecycle::PaintInvalidationClean)
2468 || lifecycle().state() == DocumentLifecycle::PaintClean); 2473 || lifecycle().state() == DocumentLifecycle::PaintClean);
2469 } 2474 }
2470 } 2475 }
2471 2476
2472 updateViewportIntersectionsForSubtree(phases); 2477 updateViewportIntersectionsForSubtree(phases);
2473 } 2478 }
2474 2479
2475 void FrameView::updatePaintProperties() 2480 void FrameView::updatePaintProperties()
2476 { 2481 {
2477 TRACE_EVENT0("blink", "FrameView::updatePaintProperties"); 2482 TRACE_EVENT0("blink", "FrameView::updatePaintProperties");
2478 2483
2479 ASSERT(RuntimeEnabledFeatures::slimmingPaintV2Enabled()); 2484 ASSERT(RuntimeEnabledFeatures::slimmingPaintV2Enabled() || RuntimeEnabledFea tures::slimmingPaintInvalidationEnabled());
2480 2485
2481 forAllNonThrottledFrameViews([](FrameView& frameView) { frameView.lifecycle( ).advanceTo(DocumentLifecycle::InUpdatePaintProperties); }); 2486 forAllNonThrottledFrameViews([](FrameView& frameView) { frameView.lifecycle( ).advanceTo(DocumentLifecycle::InUpdatePaintProperties); });
2482 PaintPropertyTreeBuilder().buildPropertyTrees(*this); 2487 PaintPropertyTreeBuilder builder;
2488 builder.buildPropertyTrees(*this);
2483 forAllNonThrottledFrameViews([](FrameView& frameView) { frameView.lifecycle( ).advanceTo(DocumentLifecycle::UpdatePaintPropertiesClean); }); 2489 forAllNonThrottledFrameViews([](FrameView& frameView) { frameView.lifecycle( ).advanceTo(DocumentLifecycle::UpdatePaintPropertiesClean); });
2490
2491 // Process objects needing paint invalidation on the next frame. See the def inition of PaintInvalidationDelayedFull for more details.
2492 for (auto& target : builder.pendingDelayedPaintInvalidations())
2493 target->setShouldDoFullPaintInvalidation(PaintInvalidationDelayedFull);
2484 } 2494 }
2485 2495
2486 void FrameView::synchronizedPaint() 2496 void FrameView::synchronizedPaint()
2487 { 2497 {
2488 TRACE_EVENT0("blink", "FrameView::synchronizedPaint"); 2498 TRACE_EVENT0("blink", "FrameView::synchronizedPaint");
2489 2499
2490 ASSERT(frame() == page()->mainFrame() || (!frame().tree().parent()->isLocalF rame())); 2500 ASSERT(frame() == page()->mainFrame() || (!frame().tree().parent()->isLocalF rame()));
2491 2501
2492 LayoutView* view = layoutView(); 2502 LayoutView* view = layoutView();
2493 ASSERT(view); 2503 ASSERT(view);
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
2642 lifecycle().advanceTo(DocumentLifecycle::LayoutClean); 2652 lifecycle().advanceTo(DocumentLifecycle::LayoutClean);
2643 2653
2644 // Ensure that we become visually non-empty eventually. 2654 // Ensure that we become visually non-empty eventually.
2645 // TODO(esprehn): This should check isRenderingReady() instead. 2655 // TODO(esprehn): This should check isRenderingReady() instead.
2646 if (frame().document()->hasFinishedParsing() && frame().loader().stateMachin e()->committedFirstRealDocumentLoad()) 2656 if (frame().document()->hasFinishedParsing() && frame().loader().stateMachin e()->committedFirstRealDocumentLoad())
2647 m_isVisuallyNonEmpty = true; 2657 m_isVisuallyNonEmpty = true;
2648 } 2658 }
2649 2659
2650 void FrameView::invalidateTreeIfNeededRecursive() 2660 void FrameView::invalidateTreeIfNeededRecursive()
2651 { 2661 {
2662 ASSERT(!RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled());
2652 RELEASE_ASSERT(layoutView()); 2663 RELEASE_ASSERT(layoutView());
2653 2664
2654 // We need to stop recursing here since a child frame view might not be thro ttled 2665 // We need to stop recursing here since a child frame view might not be thro ttled
2655 // even though we are (e.g., it didn't compute its visibility yet). 2666 // even though we are (e.g., it didn't compute its visibility yet).
2656 if (shouldThrottleRendering()) 2667 if (shouldThrottleRendering())
2657 return; 2668 return;
2658 TRACE_EVENT1("blink", "FrameView::invalidateTreeIfNeededRecursive", "root", layoutView()->debugName().ascii()); 2669 TRACE_EVENT1("blink", "FrameView::invalidateTreeIfNeededRecursive", "root", layoutView()->debugName().ascii());
2659 2670
2660 Vector<LayoutObject*> pendingDelayedPaintInvalidations; 2671 Vector<LayoutObject*> pendingDelayedPaintInvalidations;
2661 PaintInvalidationState rootPaintInvalidationState(*layoutView(), pendingDela yedPaintInvalidations); 2672 PaintInvalidationState rootPaintInvalidationState(*layoutView(), pendingDela yedPaintInvalidations);
(...skipping 1447 matching lines...) Expand 10 before | Expand all | Expand 10 after
4109 return m_hiddenForThrottling && m_crossOriginForThrottling; 4120 return m_hiddenForThrottling && m_crossOriginForThrottling;
4110 } 4121 }
4111 4122
4112 LayoutBox& FrameView::boxForScrollControlPaintInvalidation() const 4123 LayoutBox& FrameView::boxForScrollControlPaintInvalidation() const
4113 { 4124 {
4114 ASSERT(layoutView()); 4125 ASSERT(layoutView());
4115 return *layoutView(); 4126 return *layoutView();
4116 } 4127 }
4117 4128
4118 } // namespace blink 4129 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698