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

Unified Diff: content/renderer/render_frame_impl.cc

Issue 1229083002: Clean up some detach logic in RenderFrameImpl. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/render_frame_impl.cc
diff --git a/content/renderer/render_frame_impl.cc b/content/renderer/render_frame_impl.cc
index feb83296cc48333ab0c37e0479f50f21126e9d56..dc75e9c2f95bc6d5665e73055c91e270a2abd1cb 100644
--- a/content/renderer/render_frame_impl.cc
+++ b/content/renderer/render_frame_impl.cc
@@ -2167,6 +2167,10 @@ void RenderFrameImpl::frameDetached(blink::WebFrame* frame, DetachType type) {
// sent before setting |is_detaching_| to true.
is_detaching_ = true;
+ if (render_widget_) {
Charlie Reis 2015/07/09 21:06:19 nit: No braces. Same below.
+ render_widget_->UnregisterRenderFrame(this);
+ }
+
// We need to clean up subframes by removing them from the map and deleting
// the RenderFrameImpl. In contrast, the main frame is owned by its
// containing RenderViewHost (so that they have the same lifetime), so only
@@ -2176,17 +2180,11 @@ void RenderFrameImpl::frameDetached(blink::WebFrame* frame, DetachType type) {
CHECK_EQ(it->second, this);
g_frame_map.Get().erase(it);
- if (is_subframe_) {
- if (base::CommandLine::ForCurrentProcess()->HasSwitch(
- switches::kSitePerProcess) && render_widget_) {
- render_widget_->UnregisterRenderFrame(this);
- }
-
- // Only remove the frame from the renderer's frame tree if the frame is
- // being detached for removal. For swaps, WebFrame::swap already takes care
- // of replacing the frame with a RemoteFrame.
- if (type == DetachType::Remove)
- frame->parent()->removeChild(frame);
+ // Only remove the frame from the renderer's frame tree if the frame is
+ // being detached for removal. In the case of a swap, the frame needs to
+ // remain in the tree so WebFrame::swap() can replace it with the new frame.
+ if (is_subframe_ && type == DetachType::Remove) {
+ frame->parent()->removeChild(frame);
}
// |frame| is invalid after here. Be sure to clear frame_ as well, since this
« 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