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

Side by Side Diff: third_party/WebKit/Source/core/loader/FrameLoader.cpp

Issue 2436623004: [Fetch, Loader] Expect on-heap objects will never get destroyed with a reference (Closed)
Patch Set: fix 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) 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights
3 * reserved. 3 * reserved.
4 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) 4 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
5 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. 5 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved.
6 * (http://www.torchmobile.com/) 6 * (http://www.torchmobile.com/)
7 * Copyright (C) 2008 Alp Toker <alp@atoker.com> 7 * Copyright (C) 2008 Alp Toker <alp@atoker.com>
8 * Copyright (C) Research In Motion Limited 2009. All rights reserved. 8 * Copyright (C) Research In Motion Limited 2009. All rights reserved.
9 * Copyright (C) 2011 Kris Jordan <krisjordan@gmail.com> 9 * Copyright (C) 2011 Kris Jordan <krisjordan@gmail.com>
10 * Copyright (C) 2011 Google Inc. All rights reserved. 10 * Copyright (C) 2011 Google Inc. All rights reserved.
(...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after
347 // always contains the result of evaluating a javascript: url. This is the 347 // always contains the result of evaluating a javascript: url. This is the
348 // <iframe src="javascript:'html'"> case. 348 // <iframe src="javascript:'html'"> case.
349 void FrameLoader::replaceDocumentWhileExecutingJavaScriptURL( 349 void FrameLoader::replaceDocumentWhileExecutingJavaScriptURL(
350 const String& source, 350 const String& source,
351 Document* ownerDocument) { 351 Document* ownerDocument) {
352 if (!m_frame->document()->loader() || 352 if (!m_frame->document()->loader() ||
353 m_frame->document()->pageDismissalEventBeingDispatched() != 353 m_frame->document()->pageDismissalEventBeingDispatched() !=
354 Document::NoDismissal) 354 Document::NoDismissal)
355 return; 355 return;
356 356
357 // DocumentLoader::replaceDocumentWhileExecutingJavaScriptURL can cause the
358 // DocumentLoader to get deref'ed and possible destroyed, so protect it with a
359 // RefPtr.
360 DocumentLoader* documentLoader(m_frame->document()->loader()); 357 DocumentLoader* documentLoader(m_frame->document()->loader());
361 358
362 UseCounter::count(*m_frame->document(), 359 UseCounter::count(*m_frame->document(),
363 UseCounter::ReplaceDocumentViaJavaScriptURL); 360 UseCounter::ReplaceDocumentViaJavaScriptURL);
364 361
365 // Prepare a DocumentInit before clearing the frame, because it may need to 362 // Prepare a DocumentInit before clearing the frame, because it may need to
366 // inherit an aliased security context. 363 // inherit an aliased security context.
367 DocumentInit init(ownerDocument, m_frame->document()->url(), m_frame); 364 DocumentInit init(ownerDocument, m_frame->document()->url(), m_frame);
368 init.withNewRegistrationContext(); 365 init.withNewRegistrationContext();
369 366
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after
602 } 599 }
603 600
604 if (client()) { 601 if (client()) {
605 client()->runScriptsAtDocumentReady( 602 client()->runScriptsAtDocumentReady(
606 m_documentLoader ? m_documentLoader->isCommittedButEmpty() : true); 603 m_documentLoader ? m_documentLoader->isCommittedButEmpty() : true);
607 } 604 }
608 605
609 checkCompleted(); 606 checkCompleted();
610 607
611 if (!m_frame->view()) 608 if (!m_frame->view())
612 return; // We are being destroyed by something checkCompleted called. 609 return;
613 610
614 // Check if the scrollbars are really needed for the content. If not, remove 611 // Check if the scrollbars are really needed for the content. If not, remove
615 // them, relayout, and repaint. 612 // them, relayout, and repaint.
616 m_frame->view()->restoreScrollbar(); 613 m_frame->view()->restoreScrollbar();
617 processFragment(m_frame->document()->url(), NavigationToDifferentDocument); 614 processFragment(m_frame->document()->url(), NavigationToDifferentDocument);
618 } 615 }
619 616
620 static bool allDescendantsAreComplete(Frame* frame) { 617 static bool allDescendantsAreComplete(Frame* frame) {
621 for (Frame* child = frame->tree().firstChild(); child; 618 for (Frame* child = frame->tree().firstChild(); child;
622 child = child->tree().traverseNext(frame)) { 619 child = child->tree().traverseNext(frame)) {
(...skipping 1313 matching lines...) Expand 10 before | Expand all | Expand 10 after
1936 m_documentLoader ? m_documentLoader->url() : String()); 1933 m_documentLoader ? m_documentLoader->url() : String());
1937 return tracedValue; 1934 return tracedValue;
1938 } 1935 }
1939 1936
1940 inline void FrameLoader::takeObjectSnapshot() const { 1937 inline void FrameLoader::takeObjectSnapshot() const {
1941 TRACE_EVENT_OBJECT_SNAPSHOT_WITH_ID("loading", "FrameLoader", this, 1938 TRACE_EVENT_OBJECT_SNAPSHOT_WITH_ID("loading", "FrameLoader", this,
1942 toTracedValue()); 1939 toTracedValue());
1943 } 1940 }
1944 1941
1945 } // namespace blink 1942 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698