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

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

Issue 2389023002: Deferred frame loading stats v2 (Closed)
Patch Set: make display none work. update histograms.xml Created 4 years, 2 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 4377 matching lines...) Expand 10 before | Expand all | Expand 10 after
4388 parent->m_needsUpdateViewportIntersectionInSubtree = true; 4388 parent->m_needsUpdateViewportIntersectionInSubtree = true;
4389 } 4389 }
4390 4390
4391 void FrameView::updateViewportIntersectionIfNeeded() { 4391 void FrameView::updateViewportIntersectionIfNeeded() {
4392 if (!m_needsUpdateViewportIntersection) 4392 if (!m_needsUpdateViewportIntersection)
4393 return; 4393 return;
4394 m_needsUpdateViewportIntersection = false; 4394 m_needsUpdateViewportIntersection = false;
4395 m_viewportIntersectionValid = true; 4395 m_viewportIntersectionValid = true;
4396 FrameView* parent = parentFrameView(); 4396 FrameView* parent = parentFrameView();
4397 if (!parent) { 4397 if (!parent) {
4398 if (HTMLFrameOwnerElement* element = frame().deprecatedLocalOwner()) {
4399 if (!element->layoutObject())
4400 frame().document()->wouldLoadBecause(WouldLoadDisplayNone);
4401 }
4402 frame().document()->wouldLoadBecause(WouldLoadOutOfProcess);
dcheng 2016/10/08 00:46:22 Should this be in an else?
dgrogan 2016/10/13 01:06:22 It was ok without one because of the check in Docu
4398 m_viewportIntersection = frameRect(); 4403 m_viewportIntersection = frameRect();
4399 return; 4404 return;
4400 } 4405 }
4401 ASSERT(!parent->m_needsUpdateViewportIntersection); 4406 ASSERT(!parent->m_needsUpdateViewportIntersection);
4402 4407
4408 bool parentLoaded = parent->frame().document()->wouldLoadReason() != Created;
dcheng 2016/10/08 00:46:22 Maybe add a comment here: it'll help me understand
dgrogan 2016/10/13 01:06:22 Comment added. I think we're saying the same thing
4409 if (parentLoaded) {
4410 if (frameRect().isEmpty())
4411 frame().document()->wouldLoadBecause(WouldLoadZeroByZero);
4412 else if (frameRect().maxY() < 0)
4413 frame().document()->wouldLoadBecause(WouldLoadAbove);
4414 else if (frameRect().maxX() < 0)
4415 frame().document()->wouldLoadBecause(WouldLoadLeft);
4416 }
4417
4403 // If our parent is hidden, then we are too. 4418 // If our parent is hidden, then we are too.
4404 if (parent->m_viewportIntersection.isEmpty()) { 4419 if (parent->m_viewportIntersection.isEmpty()) {
4405 m_viewportIntersection = parent->m_viewportIntersection; 4420 m_viewportIntersection = parent->m_viewportIntersection;
4406 return; 4421 return;
4407 } 4422 }
4408 4423
4409 // Transform our bounds into the root frame's content coordinate space, 4424 // Transform our bounds into the root frame's content coordinate space,
4410 // making sure we have valid layout data in our parent document. If our 4425 // making sure we have valid layout data in our parent document. If our
4411 // parent is throttled, we'll use possible stale layout information and 4426 // parent is throttled, we'll use possible stale layout information and
4412 // rely on the fact that another lifecycle update will be scheduled once 4427 // rely on the fact that another lifecycle update will be scheduled once
4413 // our parent becomes unthrottled. 4428 // our parent becomes unthrottled.
4414 ASSERT(parent->lifecycle().state() >= DocumentLifecycle::LayoutClean || 4429 ASSERT(parent->lifecycle().state() >= DocumentLifecycle::LayoutClean ||
4415 parent->shouldThrottleRendering()); 4430 parent->shouldThrottleRendering());
4416 m_viewportIntersection = parent->contentsToRootFrame(frameRect()); 4431 m_viewportIntersection = parent->contentsToRootFrame(frameRect());
4417 4432
4418 // TODO(skyostil): Expand the viewport to make it less likely to see stale 4433 // TODO(skyostil): Expand the viewport to make it less likely to see stale
4419 // content while scrolling. 4434 // content while scrolling.
4420 IntRect viewport = parent->m_viewportIntersection; 4435 IntRect viewport = parent->m_viewportIntersection;
4421 m_viewportIntersection.intersect(viewport); 4436 m_viewportIntersection.intersect(viewport);
4437
4438 if (parentLoaded && !m_viewportIntersection.isEmpty())
4439 frame().document()->wouldLoadBecause(WouldLoadVisible);
4422 } 4440 }
4423 4441
4424 void FrameView::updateViewportIntersectionsForSubtree( 4442 void FrameView::updateViewportIntersectionsForSubtree(
4425 DocumentLifecycle::LifecycleState targetState) { 4443 DocumentLifecycle::LifecycleState targetState) {
4426 bool hadValidIntersection = m_viewportIntersectionValid; 4444 bool hadValidIntersection = m_viewportIntersectionValid;
4427 bool hadEmptyIntersection = m_viewportIntersection.isEmpty(); 4445 bool hadEmptyIntersection = m_viewportIntersection.isEmpty();
4428 updateViewportIntersectionIfNeeded(); 4446 updateViewportIntersectionIfNeeded();
4429 4447
4430 // Notify javascript IntersectionObservers 4448 // Notify javascript IntersectionObservers
4431 if (targetState == DocumentLifecycle::PaintClean && 4449 if (targetState == DocumentLifecycle::PaintClean &&
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
4497 4515
4498 void FrameView::notifyRenderThrottlingObservers() { 4516 void FrameView::notifyRenderThrottlingObservers() {
4499 TRACE_EVENT0("blink", "FrameView::notifyRenderThrottlingObservers"); 4517 TRACE_EVENT0("blink", "FrameView::notifyRenderThrottlingObservers");
4500 DCHECK(!isInPerformLayout()); 4518 DCHECK(!isInPerformLayout());
4501 DCHECK(frame().document()); 4519 DCHECK(frame().document());
4502 DCHECK(!frame().document()->inStyleRecalc()); 4520 DCHECK(!frame().document()->inStyleRecalc());
4503 bool wasThrottled = canThrottleRendering(); 4521 bool wasThrottled = canThrottleRendering();
4504 4522
4505 updateThrottlingStatus(); 4523 updateThrottlingStatus();
4506 4524
4507 frame().document()->onVisibilityMaybeChanged(!m_hiddenForThrottling);
4508
4509 bool becameThrottled = !wasThrottled && canThrottleRendering(); 4525 bool becameThrottled = !wasThrottled && canThrottleRendering();
4510 bool becameUnthrottled = wasThrottled && !canThrottleRendering(); 4526 bool becameUnthrottled = wasThrottled && !canThrottleRendering();
4511 ScrollingCoordinator* scrollingCoordinator = this->scrollingCoordinator(); 4527 ScrollingCoordinator* scrollingCoordinator = this->scrollingCoordinator();
4512 if (becameThrottled) { 4528 if (becameThrottled) {
4513 // If this FrameView became throttled, we must make sure all of its 4529 // If this FrameView became throttled, we must make sure all of its
4514 // children become throttled at the same time. Otherwise we might 4530 // children become throttled at the same time. Otherwise we might
4515 // attempt to paint one of the children with an out-of-date layout 4531 // attempt to paint one of the children with an out-of-date layout
4516 // before |notifyRenderThrottlingObservers| has made it throttled. 4532 // before |notifyRenderThrottlingObservers| has made it throttled.
4517 forAllNonThrottledFrameViews([](FrameView& frameView) { 4533 forAllNonThrottledFrameViews([](FrameView& frameView) {
4518 frameView.m_subtreeThrottled = true; 4534 frameView.m_subtreeThrottled = true;
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
4557 } 4573 }
4558 4574
4559 bool FrameView::canThrottleRendering() const { 4575 bool FrameView::canThrottleRendering() const {
4560 if (!RuntimeEnabledFeatures::renderingPipelineThrottlingEnabled()) 4576 if (!RuntimeEnabledFeatures::renderingPipelineThrottlingEnabled())
4561 return false; 4577 return false;
4562 return m_subtreeThrottled || 4578 return m_subtreeThrottled ||
4563 (m_hiddenForThrottling && m_crossOriginForThrottling); 4579 (m_hiddenForThrottling && m_crossOriginForThrottling);
4564 } 4580 }
4565 4581
4566 } // namespace blink 4582 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698