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

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

Issue 618253002: Revert of Streamline frame detach (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/loader/FrameLoader.h ('k') | Source/core/loader/FrameLoaderClient.h » ('j') | 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) 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserv ed. 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserv ed.
3 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) 3 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
4 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/) 4 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/)
5 * Copyright (C) 2008 Alp Toker <alp@atoker.com> 5 * Copyright (C) 2008 Alp Toker <alp@atoker.com>
6 * Copyright (C) Research In Motion Limited 2009. All rights reserved. 6 * Copyright (C) Research In Motion Limited 2009. All rights reserved.
7 * Copyright (C) 2011 Kris Jordan <krisjordan@gmail.com> 7 * Copyright (C) 2011 Kris Jordan <krisjordan@gmail.com>
8 * Copyright (C) 2011 Google Inc. All rights reserved. 8 * Copyright (C) 2011 Google Inc. All rights reserved.
9 * 9 *
10 * Redistribution and use in source and binary forms, with or without 10 * Redistribution and use in source and binary forms, with or without
(...skipping 1087 matching lines...) Expand 10 before | Expand all | Expand 10 after
1098 } 1098 }
1099 } 1099 }
1100 1100
1101 String FrameLoader::userAgent(const KURL& url) const 1101 String FrameLoader::userAgent(const KURL& url) const
1102 { 1102 {
1103 String userAgent = client()->userAgent(url); 1103 String userAgent = client()->userAgent(url);
1104 InspectorInstrumentation::applyUserAgentOverride(m_frame, &userAgent); 1104 InspectorInstrumentation::applyUserAgentOverride(m_frame, &userAgent);
1105 return userAgent; 1105 return userAgent;
1106 } 1106 }
1107 1107
1108 void FrameLoader::detach() 1108 void FrameLoader::detachFromParent()
1109 { 1109 {
1110 #if !ENABLE(OILPAN) 1110 #if !ENABLE(OILPAN)
1111 // The caller must protect a reference to m_frame. 1111 // The caller must protect a reference to m_frame.
1112 ASSERT(m_frame->refCount() > 1); 1112 ASSERT(m_frame->refCount() > 1);
1113 #endif 1113 #endif
1114
1115 InspectorInstrumentation::frameDetachedFromParent(m_frame);
1116
1114 if (m_documentLoader) 1117 if (m_documentLoader)
1115 m_documentLoader->detachFromFrame(); 1118 m_documentLoader->detachFromFrame();
1116 m_documentLoader = nullptr; 1119 m_documentLoader = nullptr;
1117 1120
1121 if (!client())
1122 return;
1123
1124 // FIXME: All this code belongs up in Page.
1118 Frame* parent = m_frame->tree().parent(); 1125 Frame* parent = m_frame->tree().parent();
1119 if (parent && parent->isLocalFrame()) 1126 if (parent && parent->isLocalFrame()) {
1127 m_frame->setView(nullptr);
1128 // FIXME: Shouldn't need to check if page() is null here.
1129 if (m_frame->owner() && m_frame->page())
1130 m_frame->page()->decrementSubframeCount();
1131 m_frame->willDetachFrameHost();
1132 detachClient();
1120 toLocalFrame(parent)->loader().scheduleCheckCompleted(); 1133 toLocalFrame(parent)->loader().scheduleCheckCompleted();
1134 } else {
1135 m_frame->setView(nullptr);
1136 m_frame->willDetachFrameHost();
1137 detachClient();
1138 }
1139 m_frame->detachFromFrameHost();
1140 }
1141
1142 void FrameLoader::detachClient()
1143 {
1144 ASSERT(client());
1145
1146 // Finish all cleanup work that might require talking to the embedder.
1121 m_progressTracker->dispose(); 1147 m_progressTracker->dispose();
1122 m_progressTracker.clear(); 1148 m_progressTracker.clear();
1123 setOpener(0); 1149 setOpener(0);
1150 // Notify ScriptController that the frame is closing, since its cleanup ends up calling
1151 // back to FrameLoaderClient via WindowProxy.
1152 m_frame->script().clearForClose();
1153
1154 // client() should never be null because that means we somehow re-entered
1155 // the frame detach code... but it is sometimes.
1156 // FIXME: Understand why this is happening so we can document this insanity.
1157 if (client()) {
1158 // After this, we must no longer talk to the client since this clears
1159 // its owning reference back to our owning LocalFrame.
1160 client()->detachedFromParent();
1161 m_frame->clearClient();
1162 }
1124 } 1163 }
1125 1164
1126 void FrameLoader::receivedMainResourceError(const ResourceError& error) 1165 void FrameLoader::receivedMainResourceError(const ResourceError& error)
1127 { 1166 {
1128 // Retain because the stop may release the last reference to it. 1167 // Retain because the stop may release the last reference to it.
1129 RefPtrWillBeRawPtr<LocalFrame> protect(m_frame.get()); 1168 RefPtrWillBeRawPtr<LocalFrame> protect(m_frame.get());
1130 1169
1131 if (m_frame->document()->parser()) 1170 if (m_frame->document()->parser())
1132 m_frame->document()->parser()->stopParsing(); 1171 m_frame->document()->parser()->stopParsing();
1133 1172
(...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after
1437 // FIXME: We need a way to propagate sandbox flags to out-of-process frames. 1476 // FIXME: We need a way to propagate sandbox flags to out-of-process frames.
1438 Frame* parentFrame = m_frame->tree().parent(); 1477 Frame* parentFrame = m_frame->tree().parent();
1439 if (parentFrame && parentFrame->isLocalFrame()) 1478 if (parentFrame && parentFrame->isLocalFrame())
1440 flags |= toLocalFrame(parentFrame)->document()->sandboxFlags(); 1479 flags |= toLocalFrame(parentFrame)->document()->sandboxFlags();
1441 if (FrameOwner* frameOwner = m_frame->owner()) 1480 if (FrameOwner* frameOwner = m_frame->owner())
1442 flags |= frameOwner->sandboxFlags(); 1481 flags |= frameOwner->sandboxFlags();
1443 return flags; 1482 return flags;
1444 } 1483 }
1445 1484
1446 } // namespace blink 1485 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/loader/FrameLoader.h ('k') | Source/core/loader/FrameLoaderClient.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698