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

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

Issue 2449473003: Log to UMA why we would load a third-party frame (Closed)
Patch Set: Created 4 years, 1 month 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 4390 matching lines...) Expand 10 before | Expand all | Expand 10 after
4401 parent->m_needsUpdateViewportIntersectionInSubtree = true; 4401 parent->m_needsUpdateViewportIntersectionInSubtree = true;
4402 } 4402 }
4403 4403
4404 void FrameView::updateViewportIntersectionIfNeeded() { 4404 void FrameView::updateViewportIntersectionIfNeeded() {
4405 if (!m_needsUpdateViewportIntersection) 4405 if (!m_needsUpdateViewportIntersection)
4406 return; 4406 return;
4407 m_needsUpdateViewportIntersection = false; 4407 m_needsUpdateViewportIntersection = false;
4408 m_viewportIntersectionValid = true; 4408 m_viewportIntersectionValid = true;
4409 FrameView* parent = parentFrameView(); 4409 FrameView* parent = parentFrameView();
4410 if (!parent) { 4410 if (!parent) {
4411 HTMLFrameOwnerElement* element = frame().deprecatedLocalOwner();
4412 if (!element)
4413 frame().document()->maybeRecordLoadReason(WouldLoadOutOfProcess);
4414 // Having no layout object means the frame is not drawn.
4415 else if (!element->layoutObject())
4416 frame().document()->maybeRecordLoadReason(WouldLoadDisplayNone);
4411 m_viewportIntersection = frameRect(); 4417 m_viewportIntersection = frameRect();
4412 return; 4418 return;
4413 } 4419 }
4414 ASSERT(!parent->m_needsUpdateViewportIntersection); 4420 ASSERT(!parent->m_needsUpdateViewportIntersection);
4415 4421
4422 bool parentLoaded = parent->frame().document()->wouldLoadReason() > Created;
4423 // If the parent wasn't loaded, the children won't be either.
4424 if (parentLoaded) {
4425 if (frameRect().isEmpty())
4426 frame().document()->maybeRecordLoadReason(WouldLoadZeroByZero);
4427 else if (frameRect().maxY() < 0)
4428 frame().document()->maybeRecordLoadReason(WouldLoadAbove);
4429 else if (frameRect().maxX() < 0)
4430 frame().document()->maybeRecordLoadReason(WouldLoadLeft);
4431 }
4432
4416 // If our parent is hidden, then we are too. 4433 // If our parent is hidden, then we are too.
4417 if (parent->m_viewportIntersection.isEmpty()) { 4434 if (parent->m_viewportIntersection.isEmpty()) {
4418 m_viewportIntersection = parent->m_viewportIntersection; 4435 m_viewportIntersection = parent->m_viewportIntersection;
4419 return; 4436 return;
4420 } 4437 }
4421 4438
4422 // Transform our bounds into the root frame's content coordinate space, 4439 // Transform our bounds into the root frame's content coordinate space,
4423 // making sure we have valid layout data in our parent document. If our 4440 // making sure we have valid layout data in our parent document. If our
4424 // parent is throttled, we'll use possible stale layout information and 4441 // parent is throttled, we'll use possible stale layout information and
4425 // rely on the fact that another lifecycle update will be scheduled once 4442 // rely on the fact that another lifecycle update will be scheduled once
4426 // our parent becomes unthrottled. 4443 // our parent becomes unthrottled.
4427 ASSERT(parent->lifecycle().state() >= DocumentLifecycle::LayoutClean || 4444 ASSERT(parent->lifecycle().state() >= DocumentLifecycle::LayoutClean ||
4428 parent->shouldThrottleRendering()); 4445 parent->shouldThrottleRendering());
4429 m_viewportIntersection = parent->contentsToRootFrame(frameRect()); 4446 m_viewportIntersection = parent->contentsToRootFrame(frameRect());
4430 4447
4431 // TODO(skyostil): Expand the viewport to make it less likely to see stale 4448 // TODO(skyostil): Expand the viewport to make it less likely to see stale
4432 // content while scrolling. 4449 // content while scrolling.
4433 IntRect viewport = parent->m_viewportIntersection; 4450 IntRect viewport = parent->m_viewportIntersection;
4434 m_viewportIntersection.intersect(viewport); 4451 m_viewportIntersection.intersect(viewport);
4452
4453 if (parentLoaded && !m_viewportIntersection.isEmpty())
4454 frame().document()->maybeRecordLoadReason(WouldLoadVisible);
4435 } 4455 }
4436 4456
4437 void FrameView::updateViewportIntersectionsForSubtree( 4457 void FrameView::updateViewportIntersectionsForSubtree(
4438 DocumentLifecycle::LifecycleState targetState) { 4458 DocumentLifecycle::LifecycleState targetState) {
4439 bool hadValidIntersection = m_viewportIntersectionValid; 4459 bool hadValidIntersection = m_viewportIntersectionValid;
4440 bool hadEmptyIntersection = m_viewportIntersection.isEmpty(); 4460 bool hadEmptyIntersection = m_viewportIntersection.isEmpty();
4441 updateViewportIntersectionIfNeeded(); 4461 updateViewportIntersectionIfNeeded();
4442 4462
4443 // Notify javascript IntersectionObservers 4463 // Notify javascript IntersectionObservers
4444 if (targetState == DocumentLifecycle::PaintClean && 4464 if (targetState == DocumentLifecycle::PaintClean &&
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
4510 4530
4511 void FrameView::notifyRenderThrottlingObservers() { 4531 void FrameView::notifyRenderThrottlingObservers() {
4512 TRACE_EVENT0("blink", "FrameView::notifyRenderThrottlingObservers"); 4532 TRACE_EVENT0("blink", "FrameView::notifyRenderThrottlingObservers");
4513 DCHECK(!isInPerformLayout()); 4533 DCHECK(!isInPerformLayout());
4514 DCHECK(frame().document()); 4534 DCHECK(frame().document());
4515 DCHECK(!frame().document()->inStyleRecalc()); 4535 DCHECK(!frame().document()->inStyleRecalc());
4516 bool wasThrottled = canThrottleRendering(); 4536 bool wasThrottled = canThrottleRendering();
4517 4537
4518 updateThrottlingStatus(); 4538 updateThrottlingStatus();
4519 4539
4520 frame().document()->onVisibilityMaybeChanged(!m_hiddenForThrottling);
4521
4522 bool becameThrottled = !wasThrottled && canThrottleRendering(); 4540 bool becameThrottled = !wasThrottled && canThrottleRendering();
4523 bool becameUnthrottled = wasThrottled && !canThrottleRendering(); 4541 bool becameUnthrottled = wasThrottled && !canThrottleRendering();
4524 ScrollingCoordinator* scrollingCoordinator = this->scrollingCoordinator(); 4542 ScrollingCoordinator* scrollingCoordinator = this->scrollingCoordinator();
4525 if (becameThrottled) { 4543 if (becameThrottled) {
4526 // If this FrameView became throttled, we must make sure all of its 4544 // If this FrameView became throttled, we must make sure all of its
4527 // children become throttled at the same time. Otherwise we might 4545 // children become throttled at the same time. Otherwise we might
4528 // attempt to paint one of the children with an out-of-date layout 4546 // attempt to paint one of the children with an out-of-date layout
4529 // before |notifyRenderThrottlingObservers| has made it throttled. 4547 // before |notifyRenderThrottlingObservers| has made it throttled.
4530 forAllNonThrottledFrameViews([](FrameView& frameView) { 4548 forAllNonThrottledFrameViews([](FrameView& frameView) {
4531 frameView.m_subtreeThrottled = true; 4549 frameView.m_subtreeThrottled = true;
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
4570 } 4588 }
4571 4589
4572 bool FrameView::canThrottleRendering() const { 4590 bool FrameView::canThrottleRendering() const {
4573 if (!RuntimeEnabledFeatures::renderingPipelineThrottlingEnabled()) 4591 if (!RuntimeEnabledFeatures::renderingPipelineThrottlingEnabled())
4574 return false; 4592 return false;
4575 return m_subtreeThrottled || 4593 return m_subtreeThrottled ||
4576 (m_hiddenForThrottling && m_crossOriginForThrottling); 4594 (m_hiddenForThrottling && m_crossOriginForThrottling);
4577 } 4595 }
4578 4596
4579 } // namespace blink 4597 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/dom/Document.cpp ('k') | third_party/WebKit/Source/core/frame/LocalDOMWindow.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698