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

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

Issue 2389023002: Deferred frame loading stats v2 (Closed)
Patch Set: display:none doesn't work 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 4327 matching lines...) Expand 10 before | Expand all | Expand 10 after
4338 parent->m_needsUpdateViewportIntersectionInSubtree = true; 4338 parent->m_needsUpdateViewportIntersectionInSubtree = true;
4339 } 4339 }
4340 4340
4341 void FrameView::updateViewportIntersectionIfNeeded() { 4341 void FrameView::updateViewportIntersectionIfNeeded() {
4342 if (!m_needsUpdateViewportIntersection) 4342 if (!m_needsUpdateViewportIntersection)
4343 return; 4343 return;
4344 m_needsUpdateViewportIntersection = false; 4344 m_needsUpdateViewportIntersection = false;
4345 m_viewportIntersectionValid = true; 4345 m_viewportIntersectionValid = true;
4346 FrameView* parent = parentFrameView(); 4346 FrameView* parent = parentFrameView();
4347 if (!parent) { 4347 if (!parent) {
4348 // display:none frames have no parent because they're not in the DOM.
dcheng 2016/10/07 05:52:40 I don't understand this comment in conjunction wit
4349 if (HTMLFrameOwnerElement* element = frame().deprecatedLocalOwner()) {
4350 if (const ComputedStyle* style = element->computedStyle()) {
dgrogan 2016/10/05 01:19:08 I'm trying to detect when an iframe has style="dis
dcheng 2016/10/07 05:52:40 I think what's happening here is that there's no L
4351 if (style->display() == EDisplay::None)
4352 frame().document()->wouldLoadBecause(WouldLoadDisplayNone);
4353 }
4354 }
4355 frame().document()->wouldLoadBecause(WouldLoadOutOfProcess);
4348 m_viewportIntersection = frameRect(); 4356 m_viewportIntersection = frameRect();
4349 return; 4357 return;
4350 } 4358 }
4351 ASSERT(!parent->m_needsUpdateViewportIntersection); 4359 ASSERT(!parent->m_needsUpdateViewportIntersection);
4352 4360
4361 bool parentLoaded = parent->frame().document()->wouldLoadReason() != Created;
4362 if (parentLoaded) {
4363 if (frameRect().isEmpty()) {
4364 frame().document()->wouldLoadBecause(WouldLoadZeroByZero);
4365 } else if (frameRect().maxY() < 0) {
4366 frame().document()->wouldLoadBecause(WouldLoadAbove);
4367 } else if (frameRect().maxX() < 0) {
4368 frame().document()->wouldLoadBecause(WouldLoadLeft);
4369 }
4370 }
4371
4353 // If our parent is hidden, then we are too. 4372 // If our parent is hidden, then we are too.
4354 if (parent->m_viewportIntersection.isEmpty()) { 4373 if (parent->m_viewportIntersection.isEmpty()) {
4355 m_viewportIntersection = parent->m_viewportIntersection; 4374 m_viewportIntersection = parent->m_viewportIntersection;
4356 return; 4375 return;
4357 } 4376 }
4358 4377
4359 // Transform our bounds into the root frame's content coordinate space, 4378 // Transform our bounds into the root frame's content coordinate space,
4360 // making sure we have valid layout data in our parent document. If our 4379 // making sure we have valid layout data in our parent document. If our
4361 // parent is throttled, we'll use possible stale layout information and 4380 // parent is throttled, we'll use possible stale layout information and
4362 // rely on the fact that another lifecycle update will be scheduled once 4381 // rely on the fact that another lifecycle update will be scheduled once
4363 // our parent becomes unthrottled. 4382 // our parent becomes unthrottled.
4364 ASSERT(parent->lifecycle().state() >= DocumentLifecycle::LayoutClean || 4383 ASSERT(parent->lifecycle().state() >= DocumentLifecycle::LayoutClean ||
4365 parent->shouldThrottleRendering()); 4384 parent->shouldThrottleRendering());
4366 m_viewportIntersection = parent->contentsToRootFrame(frameRect()); 4385 m_viewportIntersection = parent->contentsToRootFrame(frameRect());
4367 4386
4368 // TODO(skyostil): Expand the viewport to make it less likely to see stale con tent while scrolling. 4387 // TODO(skyostil): Expand the viewport to make it less likely to see stale con tent while scrolling.
4369 IntRect viewport = parent->m_viewportIntersection; 4388 IntRect viewport = parent->m_viewportIntersection;
4370 m_viewportIntersection.intersect(viewport); 4389 m_viewportIntersection.intersect(viewport);
4390
4391 if (parentLoaded && !m_viewportIntersection.isEmpty())
4392 frame().document()->wouldLoadBecause(WouldLoadVisible);
4371 } 4393 }
4372 4394
4373 void FrameView::updateViewportIntersectionsForSubtree( 4395 void FrameView::updateViewportIntersectionsForSubtree(
4374 DocumentLifecycle::LifecycleState targetState) { 4396 DocumentLifecycle::LifecycleState targetState) {
4375 bool hadValidIntersection = m_viewportIntersectionValid; 4397 bool hadValidIntersection = m_viewportIntersectionValid;
4376 bool hadEmptyIntersection = m_viewportIntersection.isEmpty(); 4398 bool hadEmptyIntersection = m_viewportIntersection.isEmpty();
4377 updateViewportIntersectionIfNeeded(); 4399 updateViewportIntersectionIfNeeded();
4378 4400
4379 // Notify javascript IntersectionObservers 4401 // Notify javascript IntersectionObservers
4380 if (targetState == DocumentLifecycle::PaintClean && 4402 if (targetState == DocumentLifecycle::PaintClean &&
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
4446 4468
4447 void FrameView::notifyRenderThrottlingObservers() { 4469 void FrameView::notifyRenderThrottlingObservers() {
4448 TRACE_EVENT0("blink", "FrameView::notifyRenderThrottlingObservers"); 4470 TRACE_EVENT0("blink", "FrameView::notifyRenderThrottlingObservers");
4449 DCHECK(!isInPerformLayout()); 4471 DCHECK(!isInPerformLayout());
4450 DCHECK(frame().document()); 4472 DCHECK(frame().document());
4451 DCHECK(!frame().document()->inStyleRecalc()); 4473 DCHECK(!frame().document()->inStyleRecalc());
4452 bool wasThrottled = canThrottleRendering(); 4474 bool wasThrottled = canThrottleRendering();
4453 4475
4454 updateThrottlingStatus(); 4476 updateThrottlingStatus();
4455 4477
4456 frame().document()->onVisibilityMaybeChanged(!m_hiddenForThrottling);
4457
4458 bool becameThrottled = !wasThrottled && canThrottleRendering(); 4478 bool becameThrottled = !wasThrottled && canThrottleRendering();
4459 bool becameUnthrottled = wasThrottled && !canThrottleRendering(); 4479 bool becameUnthrottled = wasThrottled && !canThrottleRendering();
4460 ScrollingCoordinator* scrollingCoordinator = this->scrollingCoordinator(); 4480 ScrollingCoordinator* scrollingCoordinator = this->scrollingCoordinator();
4461 if (becameThrottled) { 4481 if (becameThrottled) {
4462 // If this FrameView became throttled, we must make sure all of its 4482 // If this FrameView became throttled, we must make sure all of its
4463 // children become throttled at the same time. Otherwise we might 4483 // children become throttled at the same time. Otherwise we might
4464 // attempt to paint one of the children with an out-of-date layout 4484 // attempt to paint one of the children with an out-of-date layout
4465 // before |notifyRenderThrottlingObservers| has made it throttled. 4485 // before |notifyRenderThrottlingObservers| has made it throttled.
4466 forAllNonThrottledFrameViews([](FrameView& frameView) { 4486 forAllNonThrottledFrameViews([](FrameView& frameView) {
4467 frameView.m_subtreeThrottled = true; 4487 frameView.m_subtreeThrottled = true;
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
4505 } 4525 }
4506 4526
4507 bool FrameView::canThrottleRendering() const { 4527 bool FrameView::canThrottleRendering() const {
4508 if (!RuntimeEnabledFeatures::renderingPipelineThrottlingEnabled()) 4528 if (!RuntimeEnabledFeatures::renderingPipelineThrottlingEnabled())
4509 return false; 4529 return false;
4510 return m_subtreeThrottled || 4530 return m_subtreeThrottled ||
4511 (m_hiddenForThrottling && m_crossOriginForThrottling); 4531 (m_hiddenForThrottling && m_crossOriginForThrottling);
4512 } 4532 }
4513 4533
4514 } // namespace blink 4534 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698