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

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

Issue 782093002: Ensure that before creating proxy of site A, RVH of site A is initialized. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: sync again Created 5 years, 11 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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_proxy_host.h" 5 #include "content/browser/frame_host/render_frame_proxy_host.h"
6 6
7 #include "base/lazy_instance.h" 7 #include "base/lazy_instance.h"
8 #include "content/browser/frame_host/cross_process_frame_connector.h" 8 #include "content/browser/frame_host/cross_process_frame_connector.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 26 matching lines...) Expand all
37 RoutingIDFrameProxyMap* frames = g_routing_id_frame_proxy_map.Pointer(); 37 RoutingIDFrameProxyMap* frames = g_routing_id_frame_proxy_map.Pointer();
38 RoutingIDFrameProxyMap::iterator it = frames->find( 38 RoutingIDFrameProxyMap::iterator it = frames->find(
39 RenderFrameProxyHostID(process_id, routing_id)); 39 RenderFrameProxyHostID(process_id, routing_id));
40 return it == frames->end() ? NULL : it->second; 40 return it == frames->end() ? NULL : it->second;
41 } 41 }
42 42
43 RenderFrameProxyHost::RenderFrameProxyHost(SiteInstance* site_instance, 43 RenderFrameProxyHost::RenderFrameProxyHost(SiteInstance* site_instance,
44 FrameTreeNode* frame_tree_node) 44 FrameTreeNode* frame_tree_node)
45 : routing_id_(site_instance->GetProcess()->GetNextRoutingID()), 45 : routing_id_(site_instance->GetProcess()->GetNextRoutingID()),
46 site_instance_(site_instance), 46 site_instance_(site_instance),
47 frame_tree_node_(frame_tree_node) { 47 frame_tree_node_(frame_tree_node),
48 render_frame_proxy_created_(false) {
48 GetProcess()->AddRoute(routing_id_, this); 49 GetProcess()->AddRoute(routing_id_, this);
49 CHECK(g_routing_id_frame_proxy_map.Get().insert( 50 CHECK(g_routing_id_frame_proxy_map.Get().insert(
50 std::make_pair( 51 std::make_pair(
51 RenderFrameProxyHostID(GetProcess()->GetID(), routing_id_), 52 RenderFrameProxyHostID(GetProcess()->GetID(), routing_id_),
52 this)).second); 53 this)).second);
53 54
54 if (!frame_tree_node_->IsMainFrame() && 55 if (!frame_tree_node_->IsMainFrame() &&
55 frame_tree_node_->parent() 56 frame_tree_node_->parent()
56 ->render_manager() 57 ->render_manager()
57 ->current_frame_host() 58 ->current_frame_host()
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 return true; 114 return true;
114 115
115 bool handled = true; 116 bool handled = true;
116 IPC_BEGIN_MESSAGE_MAP(RenderFrameProxyHost, msg) 117 IPC_BEGIN_MESSAGE_MAP(RenderFrameProxyHost, msg)
117 IPC_MESSAGE_HANDLER(FrameHostMsg_OpenURL, OnOpenURL) 118 IPC_MESSAGE_HANDLER(FrameHostMsg_OpenURL, OnOpenURL)
118 IPC_MESSAGE_UNHANDLED(handled = false) 119 IPC_MESSAGE_UNHANDLED(handled = false)
119 IPC_END_MESSAGE_MAP() 120 IPC_END_MESSAGE_MAP()
120 return handled; 121 return handled;
121 } 122 }
122 123
124 bool RenderFrameProxyHost::IsRenderFrameProxyLive() {
nasko 2015/01/20 23:51:23 If this is just an accessor, it needs to be hacker
lazyboy 2015/01/21 18:52:14 Done.
125 return render_frame_proxy_created_;
126 }
127
123 bool RenderFrameProxyHost::InitRenderFrameProxy() { 128 bool RenderFrameProxyHost::InitRenderFrameProxy() {
129 DCHECK(!render_frame_proxy_created_);
124 // The process may (if we're sharing a process with another host that already 130 // The process may (if we're sharing a process with another host that already
125 // initialized it) or may not (we have our own process or the old process 131 // initialized it) or may not (we have our own process or the old process
126 // crashed) have been initialized. Calling Init multiple times will be 132 // crashed) have been initialized. Calling Init multiple times will be
127 // ignored, so this is safe. 133 // ignored, so this is safe.
128 if (!site_instance_->GetProcess()->Init()) 134 if (!site_instance_->GetProcess()->Init())
129 return false; 135 return false;
130 136
131 DCHECK(GetProcess()->HasConnection()); 137 DCHECK(GetProcess()->HasConnection());
132 138
133 int parent_routing_id = MSG_ROUTING_NONE; 139 int parent_routing_id = MSG_ROUTING_NONE;
134 if (frame_tree_node_->parent()) { 140 if (frame_tree_node_->parent()) {
135 parent_routing_id = frame_tree_node_->parent() 141 parent_routing_id = frame_tree_node_->parent()
136 ->render_manager() 142 ->render_manager()
137 ->GetRoutingIdForSiteInstance(site_instance_.get()); 143 ->GetRoutingIdForSiteInstance(site_instance_.get());
138 CHECK_NE(parent_routing_id, MSG_ROUTING_NONE); 144 CHECK_NE(parent_routing_id, MSG_ROUTING_NONE);
139 } 145 }
140 146
141 Send(new FrameMsg_NewFrameProxy(routing_id_, 147 Send(new FrameMsg_NewFrameProxy(routing_id_,
142 parent_routing_id, 148 parent_routing_id,
143 frame_tree_node_->frame_tree() 149 frame_tree_node_->frame_tree()
144 ->GetRenderViewHost(site_instance_.get()) 150 ->GetRenderViewHost(site_instance_.get())
145 ->GetRoutingID(), 151 ->GetRoutingID(),
146 frame_tree_node_ 152 frame_tree_node_
147 ->current_replication_state())); 153 ->current_replication_state()));
148 154
155 render_frame_proxy_created_ = true;
149 return true; 156 return true;
150 } 157 }
151 158
152 void RenderFrameProxyHost::DisownOpener() { 159 void RenderFrameProxyHost::DisownOpener() {
153 Send(new FrameMsg_DisownOpener(GetRoutingID())); 160 Send(new FrameMsg_DisownOpener(GetRoutingID()));
154 } 161 }
155 162
156 void RenderFrameProxyHost::OnOpenURL( 163 void RenderFrameProxyHost::OnOpenURL(
157 const FrameHostMsg_OpenURL_Params& params) { 164 const FrameHostMsg_OpenURL_Params& params) {
158 frame_tree_node_->current_frame_host()->OpenURL(params, site_instance_.get()); 165 frame_tree_node_->current_frame_host()->OpenURL(params, site_instance_.get());
159 } 166 }
160 167
161 } // namespace content 168 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698