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

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

Issue 2521543004: Avoid calling a virtual method on a null document in lifecycle(). (Closed)
Patch Set: Created 4 years 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 1348 matching lines...) Expand 10 before | Expand all | Expand 10 after
1359 float pageScaleAtLayoutWidth = 1359 float pageScaleAtLayoutWidth =
1360 m_frame->host()->visualViewport().size().width() / size.width(); 1360 m_frame->host()->visualViewport().size().width() / size.width();
1361 size.expand(0, browserControls.height() / pageScaleAtLayoutWidth); 1361 size.expand(0, browserControls.height() / pageScaleAtLayoutWidth);
1362 } 1362 }
1363 1363
1364 size.scale(1 / zoom); 1364 size.scale(1 / zoom);
1365 return size; 1365 return size;
1366 } 1366 }
1367 1367
1368 DocumentLifecycle& FrameView::lifecycle() const { 1368 DocumentLifecycle& FrameView::lifecycle() const {
1369 DCHECK(m_frame);
1370 DCHECK(m_frame->document());
1369 return m_frame->document()->lifecycle(); 1371 return m_frame->document()->lifecycle();
1370 } 1372 }
1371 1373
1372 LayoutReplaced* FrameView::embeddedReplacedContent() const { 1374 LayoutReplaced* FrameView::embeddedReplacedContent() const {
1373 LayoutViewItem layoutViewItem = this->layoutViewItem(); 1375 LayoutViewItem layoutViewItem = this->layoutViewItem();
1374 if (layoutViewItem.isNull()) 1376 if (layoutViewItem.isNull())
1375 return nullptr; 1377 return nullptr;
1376 1378
1377 LayoutObject* firstChild = layoutView()->firstChild(); 1379 LayoutObject* firstChild = layoutView()->firstChild();
1378 if (!firstChild || !firstChild->isBox()) 1380 if (!firstChild || !firstChild->isBox())
(...skipping 3213 matching lines...) Expand 10 before | Expand all | Expand 10 after
4592 else if (frameRect().maxX() < 0) 4594 else if (frameRect().maxX() < 0)
4593 frame().document()->maybeRecordLoadReason(WouldLoadLeft); 4595 frame().document()->maybeRecordLoadReason(WouldLoadLeft);
4594 else if (!m_hiddenForThrottling) 4596 else if (!m_hiddenForThrottling)
4595 frame().document()->maybeRecordLoadReason(WouldLoadVisible); 4597 frame().document()->maybeRecordLoadReason(WouldLoadVisible);
4596 } 4598 }
4597 } 4599 }
4598 } 4600 }
4599 } 4601 }
4600 4602
4601 bool FrameView::shouldThrottleRendering() const { 4603 bool FrameView::shouldThrottleRendering() const {
4602 return canThrottleRendering() && lifecycle().throttlingAllowed(); 4604 return canThrottleRendering() && m_frame->document() &&
4605 lifecycle().throttlingAllowed();
4603 } 4606 }
4604 4607
4605 bool FrameView::canThrottleRendering() const { 4608 bool FrameView::canThrottleRendering() const {
4606 if (m_lifecycleUpdatesThrottled) 4609 if (m_lifecycleUpdatesThrottled)
4607 return true; 4610 return true;
4608 if (!RuntimeEnabledFeatures::renderingPipelineThrottlingEnabled()) 4611 if (!RuntimeEnabledFeatures::renderingPipelineThrottlingEnabled())
4609 return false; 4612 return false;
4610 if (m_subtreeThrottled) 4613 if (m_subtreeThrottled)
4611 return true; 4614 return true;
4612 // We only throttle hidden cross-origin frames. This is to avoid a situation 4615 // We only throttle hidden cross-origin frames. This is to avoid a situation
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
4644 DCHECK(m_frame->isMainFrame()); 4647 DCHECK(m_frame->isMainFrame());
4645 return m_initialViewportSize.width(); 4648 return m_initialViewportSize.width();
4646 } 4649 }
4647 4650
4648 int FrameView::initialViewportHeight() const { 4651 int FrameView::initialViewportHeight() const {
4649 DCHECK(m_frame->isMainFrame()); 4652 DCHECK(m_frame->isMainFrame());
4650 return m_initialViewportSize.height(); 4653 return m_initialViewportSize.height();
4651 } 4654 }
4652 4655
4653 } // namespace blink 4656 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698