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

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

Issue 2389023002: Deferred frame loading stats v2 (Closed)
Patch Set: fix up some tests; remove comment 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 4293 matching lines...) Expand 10 before | Expand all | Expand 10 after
4304 parent->m_needsUpdateViewportIntersectionInSubtree = true; 4304 parent->m_needsUpdateViewportIntersectionInSubtree = true;
4305 } 4305 }
4306 4306
4307 void FrameView::updateViewportIntersectionIfNeeded() { 4307 void FrameView::updateViewportIntersectionIfNeeded() {
4308 if (!m_needsUpdateViewportIntersection) 4308 if (!m_needsUpdateViewportIntersection)
4309 return; 4309 return;
4310 m_needsUpdateViewportIntersection = false; 4310 m_needsUpdateViewportIntersection = false;
4311 m_viewportIntersectionValid = true; 4311 m_viewportIntersectionValid = true;
4312 FrameView* parent = parentFrameView(); 4312 FrameView* parent = parentFrameView();
4313 if (!parent) { 4313 if (!parent) {
4314 HTMLFrameOwnerElement* element = frame().deprecatedLocalOwner();
4315 if (!element)
4316 frame().document()->wouldLoadBecause(WouldLoadOutOfProcess);
4317 // Having no layout object means the frame is not drawn.
4318 else if (!element->layoutObject())
4319 frame().document()->wouldLoadBecause(WouldLoadDisplayNone);
4314 m_viewportIntersection = frameRect(); 4320 m_viewportIntersection = frameRect();
4315 return; 4321 return;
4316 } 4322 }
4317 ASSERT(!parent->m_needsUpdateViewportIntersection); 4323 ASSERT(!parent->m_needsUpdateViewportIntersection);
4318 4324
4325 bool parentLoaded = parent->frame().document()->wouldLoadReason() > Created;
4326 // If the parent wasn't loaded, the children won't be either.
4327 if (parentLoaded) {
4328 if (frameRect().isEmpty())
4329 frame().document()->wouldLoadBecause(WouldLoadZeroByZero);
4330 else if (frameRect().maxY() < 0)
4331 frame().document()->wouldLoadBecause(WouldLoadAbove);
4332 else if (frameRect().maxX() < 0)
4333 frame().document()->wouldLoadBecause(WouldLoadLeft);
4334 }
4335
4319 // If our parent is hidden, then we are too. 4336 // If our parent is hidden, then we are too.
4320 if (parent->m_viewportIntersection.isEmpty()) { 4337 if (parent->m_viewportIntersection.isEmpty()) {
4321 m_viewportIntersection = parent->m_viewportIntersection; 4338 m_viewportIntersection = parent->m_viewportIntersection;
4322 return; 4339 return;
4323 } 4340 }
4324 4341
4325 // Transform our bounds into the root frame's content coordinate space, 4342 // Transform our bounds into the root frame's content coordinate space,
4326 // making sure we have valid layout data in our parent document. If our 4343 // making sure we have valid layout data in our parent document. If our
4327 // parent is throttled, we'll use possible stale layout information and 4344 // parent is throttled, we'll use possible stale layout information and
4328 // rely on the fact that another lifecycle update will be scheduled once 4345 // rely on the fact that another lifecycle update will be scheduled once
4329 // our parent becomes unthrottled. 4346 // our parent becomes unthrottled.
4330 ASSERT(parent->lifecycle().state() >= DocumentLifecycle::LayoutClean || 4347 ASSERT(parent->lifecycle().state() >= DocumentLifecycle::LayoutClean ||
4331 parent->shouldThrottleRendering()); 4348 parent->shouldThrottleRendering());
4332 m_viewportIntersection = parent->contentsToRootFrame(frameRect()); 4349 m_viewportIntersection = parent->contentsToRootFrame(frameRect());
4333 4350
4334 // TODO(skyostil): Expand the viewport to make it less likely to see stale 4351 // TODO(skyostil): Expand the viewport to make it less likely to see stale
4335 // content while scrolling. 4352 // content while scrolling.
4336 IntRect viewport = parent->m_viewportIntersection; 4353 IntRect viewport = parent->m_viewportIntersection;
4337 m_viewportIntersection.intersect(viewport); 4354 m_viewportIntersection.intersect(viewport);
4355
4356 if (parentLoaded && !m_viewportIntersection.isEmpty())
4357 frame().document()->wouldLoadBecause(WouldLoadVisible);
4338 } 4358 }
4339 4359
4340 void FrameView::updateViewportIntersectionsForSubtree( 4360 void FrameView::updateViewportIntersectionsForSubtree(
4341 DocumentLifecycle::LifecycleState targetState) { 4361 DocumentLifecycle::LifecycleState targetState) {
4342 bool hadValidIntersection = m_viewportIntersectionValid; 4362 bool hadValidIntersection = m_viewportIntersectionValid;
4343 bool hadEmptyIntersection = m_viewportIntersection.isEmpty(); 4363 bool hadEmptyIntersection = m_viewportIntersection.isEmpty();
4344 updateViewportIntersectionIfNeeded(); 4364 updateViewportIntersectionIfNeeded();
4345 4365
4346 // Notify javascript IntersectionObservers 4366 // Notify javascript IntersectionObservers
4347 if (targetState == DocumentLifecycle::PaintClean && 4367 if (targetState == DocumentLifecycle::PaintClean &&
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
4413 4433
4414 void FrameView::notifyRenderThrottlingObservers() { 4434 void FrameView::notifyRenderThrottlingObservers() {
4415 TRACE_EVENT0("blink", "FrameView::notifyRenderThrottlingObservers"); 4435 TRACE_EVENT0("blink", "FrameView::notifyRenderThrottlingObservers");
4416 DCHECK(!isInPerformLayout()); 4436 DCHECK(!isInPerformLayout());
4417 DCHECK(frame().document()); 4437 DCHECK(frame().document());
4418 DCHECK(!frame().document()->inStyleRecalc()); 4438 DCHECK(!frame().document()->inStyleRecalc());
4419 bool wasThrottled = canThrottleRendering(); 4439 bool wasThrottled = canThrottleRendering();
4420 4440
4421 updateThrottlingStatus(); 4441 updateThrottlingStatus();
4422 4442
4423 frame().document()->onVisibilityMaybeChanged(!m_hiddenForThrottling);
4424
4425 bool becameThrottled = !wasThrottled && canThrottleRendering(); 4443 bool becameThrottled = !wasThrottled && canThrottleRendering();
4426 bool becameUnthrottled = wasThrottled && !canThrottleRendering(); 4444 bool becameUnthrottled = wasThrottled && !canThrottleRendering();
4427 ScrollingCoordinator* scrollingCoordinator = this->scrollingCoordinator(); 4445 ScrollingCoordinator* scrollingCoordinator = this->scrollingCoordinator();
4428 if (becameThrottled) { 4446 if (becameThrottled) {
4429 // If this FrameView became throttled, we must make sure all of its 4447 // If this FrameView became throttled, we must make sure all of its
4430 // children become throttled at the same time. Otherwise we might 4448 // children become throttled at the same time. Otherwise we might
4431 // attempt to paint one of the children with an out-of-date layout 4449 // attempt to paint one of the children with an out-of-date layout
4432 // before |notifyRenderThrottlingObservers| has made it throttled. 4450 // before |notifyRenderThrottlingObservers| has made it throttled.
4433 forAllNonThrottledFrameViews([](FrameView& frameView) { 4451 forAllNonThrottledFrameViews([](FrameView& frameView) {
4434 frameView.m_subtreeThrottled = true; 4452 frameView.m_subtreeThrottled = true;
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
4473 } 4491 }
4474 4492
4475 bool FrameView::canThrottleRendering() const { 4493 bool FrameView::canThrottleRendering() const {
4476 if (!RuntimeEnabledFeatures::renderingPipelineThrottlingEnabled()) 4494 if (!RuntimeEnabledFeatures::renderingPipelineThrottlingEnabled())
4477 return false; 4495 return false;
4478 return m_subtreeThrottled || 4496 return m_subtreeThrottled ||
4479 (m_hiddenForThrottling && m_crossOriginForThrottling); 4497 (m_hiddenForThrottling && m_crossOriginForThrottling);
4480 } 4498 }
4481 4499
4482 } // namespace blink 4500 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698