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

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

Issue 645623004: Reland "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 1092 matching lines...) Expand 10 before | Expand all | Expand 10 after
1103 } 1103 }
1104 } 1104 }
1105 1105
1106 String FrameLoader::userAgent(const KURL& url) const 1106 String FrameLoader::userAgent(const KURL& url) const
1107 { 1107 {
1108 String userAgent = client()->userAgent(url); 1108 String userAgent = client()->userAgent(url);
1109 InspectorInstrumentation::applyUserAgentOverride(m_frame, &userAgent); 1109 InspectorInstrumentation::applyUserAgentOverride(m_frame, &userAgent);
1110 return userAgent; 1110 return userAgent;
1111 } 1111 }
1112 1112
1113 void FrameLoader::detachFromParent() 1113 void FrameLoader::detach()
1114 { 1114 {
1115 #if !ENABLE(OILPAN) 1115 #if !ENABLE(OILPAN)
1116 // The caller must protect a reference to m_frame. 1116 // The caller must protect a reference to m_frame.
1117 ASSERT(m_frame->refCount() > 1); 1117 ASSERT(m_frame->refCount() > 1);
1118 #endif 1118 #endif
1119
1120 InspectorInstrumentation::frameDetachedFromParent(m_frame);
1121
1122 if (m_documentLoader) 1119 if (m_documentLoader)
1123 m_documentLoader->detachFromFrame(); 1120 m_documentLoader->detachFromFrame();
1124 m_documentLoader = nullptr; 1121 m_documentLoader = nullptr;
1125 1122
1126 if (!client())
1127 return;
1128
1129 // FIXME: All this code belongs up in Page.
1130 Frame* parent = m_frame->tree().parent(); 1123 Frame* parent = m_frame->tree().parent();
1131 if (parent && parent->isLocalFrame()) { 1124 if (parent && parent->isLocalFrame())
1132 m_frame->setView(nullptr);
1133 // FIXME: Shouldn't need to check if page() is null here.
1134 if (m_frame->owner() && m_frame->page())
1135 m_frame->page()->decrementSubframeCount();
1136 m_frame->willDetachFrameHost();
1137 detachClient();
1138 toLocalFrame(parent)->loader().scheduleCheckCompleted(); 1125 toLocalFrame(parent)->loader().scheduleCheckCompleted();
1139 } else {
1140 m_frame->setView(nullptr);
1141 m_frame->willDetachFrameHost();
1142 detachClient();
1143 }
1144 m_frame->detachFromFrameHost();
1145 }
1146
1147 void FrameLoader::detachClient()
1148 {
1149 ASSERT(client());
1150
1151 // Finish all cleanup work that might require talking to the embedder.
1152 m_progressTracker->dispose(); 1126 m_progressTracker->dispose();
1153 m_progressTracker.clear(); 1127 m_progressTracker.clear();
1154 setOpener(0); 1128 setOpener(0);
1155 // Notify ScriptController that the frame is closing, since its cleanup ends up calling
1156 // back to FrameLoaderClient via WindowProxy.
1157 m_frame->script().clearForClose();
1158
1159 // client() should never be null because that means we somehow re-entered
1160 // the frame detach code... but it is sometimes.
1161 // FIXME: Understand why this is happening so we can document this insanity.
1162 if (client()) {
1163 // After this, we must no longer talk to the client since this clears
1164 // its owning reference back to our owning LocalFrame.
1165 client()->detachedFromParent();
1166 m_frame->clearClient();
1167 }
1168 } 1129 }
1169 1130
1170 void FrameLoader::receivedMainResourceError(const ResourceError& error) 1131 void FrameLoader::receivedMainResourceError(const ResourceError& error)
1171 { 1132 {
1172 // Retain because the stop may release the last reference to it. 1133 // Retain because the stop may release the last reference to it.
1173 RefPtrWillBeRawPtr<LocalFrame> protect(m_frame.get()); 1134 RefPtrWillBeRawPtr<LocalFrame> protect(m_frame.get());
1174 1135
1175 if (m_frame->document()->parser()) 1136 if (m_frame->document()->parser())
1176 m_frame->document()->parser()->stopParsing(); 1137 m_frame->document()->parser()->stopParsing();
1177 1138
(...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after
1481 // FIXME: We need a way to propagate sandbox flags to out-of-process frames. 1442 // FIXME: We need a way to propagate sandbox flags to out-of-process frames.
1482 Frame* parentFrame = m_frame->tree().parent(); 1443 Frame* parentFrame = m_frame->tree().parent();
1483 if (parentFrame && parentFrame->isLocalFrame()) 1444 if (parentFrame && parentFrame->isLocalFrame())
1484 flags |= toLocalFrame(parentFrame)->document()->sandboxFlags(); 1445 flags |= toLocalFrame(parentFrame)->document()->sandboxFlags();
1485 if (FrameOwner* frameOwner = m_frame->owner()) 1446 if (FrameOwner* frameOwner = m_frame->owner())
1486 flags |= frameOwner->sandboxFlags(); 1447 flags |= frameOwner->sandboxFlags();
1487 return flags; 1448 return flags;
1488 } 1449 }
1489 1450
1490 } // namespace blink 1451 } // 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