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

Side by Side Diff: content/browser/frame_host/render_frame_host_impl.cc

Issue 117693002: Make RenderFrameHostManager swap RenderFrameHosts, not RenderViewHosts. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 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 | Annotate | Revision Log
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/browser/frame_host/render_frame_host_impl.h" 5 #include "content/browser/frame_host/render_frame_host_impl.h"
6 6
7 #include "base/containers/hash_tables.h" 7 #include "base/containers/hash_tables.h"
8 #include "base/lazy_instance.h" 8 #include "base/lazy_instance.h"
9 #include "content/browser/frame_host/frame_tree.h" 9 #include "content/browser/frame_host/frame_tree.h"
10 #include "content/browser/frame_host/frame_tree_node.h" 10 #include "content/browser/frame_host/frame_tree_node.h"
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 FrameTree* frame_tree, 47 FrameTree* frame_tree,
48 FrameTreeNode* frame_tree_node, 48 FrameTreeNode* frame_tree_node,
49 int routing_id, 49 int routing_id,
50 bool is_swapped_out) 50 bool is_swapped_out)
51 : render_view_host_(render_view_host), 51 : render_view_host_(render_view_host),
52 delegate_(delegate), 52 delegate_(delegate),
53 frame_tree_(frame_tree), 53 frame_tree_(frame_tree),
54 frame_tree_node_(frame_tree_node), 54 frame_tree_node_(frame_tree_node),
55 routing_id_(routing_id), 55 routing_id_(routing_id),
56 is_swapped_out_(is_swapped_out) { 56 is_swapped_out_(is_swapped_out) {
57 frame_tree_->RegisterRenderFrameHost(this);
57 GetProcess()->AddRoute(routing_id_, this); 58 GetProcess()->AddRoute(routing_id_, this);
58 g_routing_id_frame_map.Get().insert(std::make_pair( 59 g_routing_id_frame_map.Get().insert(std::make_pair(
59 RenderFrameHostID(GetProcess()->GetID(), routing_id_), 60 RenderFrameHostID(GetProcess()->GetID(), routing_id_),
60 this)); 61 this));
61 } 62 }
62 63
63 RenderFrameHostImpl::~RenderFrameHostImpl() { 64 RenderFrameHostImpl::~RenderFrameHostImpl() {
64 GetProcess()->RemoveRoute(routing_id_); 65 GetProcess()->RemoveRoute(routing_id_);
65 g_routing_id_frame_map.Get().erase( 66 g_routing_id_frame_map.Get().erase(
66 RenderFrameHostID(GetProcess()->GetID(), routing_id_)); 67 RenderFrameHostID(GetProcess()->GetID(), routing_id_));
67 if (delegate_) 68 if (delegate_)
68 delegate_->RenderFrameDeleted(this); 69 delegate_->RenderFrameDeleted(this);
70
71 // Notify the FrameTree that this RFH is going away, allowing it to shut down
72 // the corresponding RenderViewHost if it is no longer needed.
73 frame_tree_->UnregisterRenderFrameHost(this);
69 } 74 }
70 75
71 RenderProcessHost* RenderFrameHostImpl::GetProcess() { 76 RenderProcessHost* RenderFrameHostImpl::GetProcess() {
72 // TODO(nasko): This should return its own process, once we have working 77 // TODO(nasko): This should return its own process, once we have working
73 // cross-process navigation for subframes. 78 // cross-process navigation for subframes.
74 return render_view_host_->GetProcess(); 79 return render_view_host_->GetProcess();
75 } 80 }
76 81
77 int RenderFrameHostImpl::GetRoutingID() { 82 int RenderFrameHostImpl::GetRoutingID() {
78 return routing_id_; 83 return routing_id_;
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 void RenderFrameHostImpl::OnDidStartProvisionalLoadForFrame( 130 void RenderFrameHostImpl::OnDidStartProvisionalLoadForFrame(
126 int64 frame_id, 131 int64 frame_id,
127 int64 parent_frame_id, 132 int64 parent_frame_id,
128 bool is_main_frame, 133 bool is_main_frame,
129 const GURL& url) { 134 const GURL& url) {
130 frame_tree_node_->navigator()->DidStartProvisionalLoad( 135 frame_tree_node_->navigator()->DidStartProvisionalLoad(
131 this, frame_id, parent_frame_id, is_main_frame, url); 136 this, frame_id, parent_frame_id, is_main_frame, url);
132 } 137 }
133 138
134 } // namespace content 139 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698