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

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

Issue 281663002: Create RenderFrameProxyHost at time of swap-out instead of commit. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: All comments addressed. Created 6 years, 7 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
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 "content/browser/frame_host/frame_tree_node.h"
7 #include "content/browser/frame_host/render_frame_host_impl.h" 8 #include "content/browser/frame_host/render_frame_host_impl.h"
8 #include "content/browser/site_instance_impl.h" 9 #include "content/browser/site_instance_impl.h"
10 #include "content/common/frame_messages.h"
11 #include "ipc/ipc_message.h"
9 12
10 namespace content { 13 namespace content {
11 14
12 RenderFrameProxyHost::RenderFrameProxyHost( 15 RenderFrameProxyHost::RenderFrameProxyHost(SiteInstance* site_instance,
13 scoped_ptr<RenderFrameHostImpl> render_frame_host) 16 FrameTreeNode* frame_tree_node)
14 : site_instance_(render_frame_host->GetSiteInstance()), 17 : routing_id_(site_instance->GetProcess()->GetNextRoutingID()),
15 render_frame_host_(render_frame_host.Pass()) {} 18 site_instance_(site_instance),
19 frame_tree_node_(frame_tree_node) {
20 GetProcess()->AddRoute(routing_id_, this);
21 }
16 22
17 RenderFrameProxyHost::~RenderFrameProxyHost() {} 23 RenderFrameProxyHost::~RenderFrameProxyHost() {
24 if (GetProcess()->HasConnection())
25 Send(new FrameMsg_DeleteProxy(routing_id_));
26
27 GetProcess()->RemoveRoute(routing_id_);
28 }
29
30 scoped_ptr<RenderFrameHostImpl> RenderFrameProxyHost::PassFrameHostOwnership() {
31 if (GetProcess()->HasConnection())
32 Send(new FrameMsg_DeleteProxy(routing_id_));
Charlie Reis 2014/05/15 22:55:00 Ok for this to happen a second time when this obje
nasko 2014/05/15 23:36:49 Thanks for the comment. I think we have a bug in C
33
34 render_frame_host_->set_render_frame_proxy_host(NULL);
35 return render_frame_host_.Pass();
36 }
37
38 bool RenderFrameProxyHost::Send(IPC::Message *msg) {
39 // TODO(nasko): For now, RenderFrameHost uses this object to send IPC messages
40 // while swapped out. This can be removed once we don't have a swapped out
41 // state on RenderFrameHosts. See https://crbug.com/357747.
42 msg->set_routing_id(routing_id_);
43 return GetProcess()->Send(msg);
44 }
45
46 bool RenderFrameProxyHost::OnMessageReceived(const IPC::Message& msg) {
47 // TODO(nasko): This can be removed once we don't have a swapped out state on
48 // RenderFrameHosts. See https://crbug.com/357747.
49 if (render_frame_host_.get())
50 return render_frame_host_->OnMessageReceived(msg);
51
52 return false;
53 }
18 54
19 } // namespace content 55 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698