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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: content/browser/frame_host/render_frame_proxy_host.cc
diff --git a/content/browser/frame_host/render_frame_proxy_host.cc b/content/browser/frame_host/render_frame_proxy_host.cc
index e965fdac528e19cfa0e81319ca87271805d36fd8..241be3aafe862dcc03a7de81f43d716c1b0c309b 100644
--- a/content/browser/frame_host/render_frame_proxy_host.cc
+++ b/content/browser/frame_host/render_frame_proxy_host.cc
@@ -4,16 +4,52 @@
#include "content/browser/frame_host/render_frame_proxy_host.h"
+#include "content/browser/frame_host/frame_tree_node.h"
#include "content/browser/frame_host/render_frame_host_impl.h"
#include "content/browser/site_instance_impl.h"
+#include "content/common/frame_messages.h"
+#include "ipc/ipc_message.h"
namespace content {
-RenderFrameProxyHost::RenderFrameProxyHost(
- scoped_ptr<RenderFrameHostImpl> render_frame_host)
- : site_instance_(render_frame_host->GetSiteInstance()),
- render_frame_host_(render_frame_host.Pass()) {}
+RenderFrameProxyHost::RenderFrameProxyHost(SiteInstance* site_instance,
+ FrameTreeNode* frame_tree_node)
+ : routing_id_(site_instance->GetProcess()->GetNextRoutingID()),
+ site_instance_(site_instance),
+ frame_tree_node_(frame_tree_node) {
+ GetProcess()->AddRoute(routing_id_, this);
+}
-RenderFrameProxyHost::~RenderFrameProxyHost() {}
+RenderFrameProxyHost::~RenderFrameProxyHost() {
+ if (GetProcess()->HasConnection())
+ Send(new FrameMsg_DeleteProxy(routing_id_));
+
+ GetProcess()->RemoveRoute(routing_id_);
+}
+
+scoped_ptr<RenderFrameHostImpl> RenderFrameProxyHost::PassFrameHostOwnership() {
+ if (GetProcess()->HasConnection())
+ 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
+
+ render_frame_host_->set_render_frame_proxy_host(NULL);
+ return render_frame_host_.Pass();
+}
+
+bool RenderFrameProxyHost::Send(IPC::Message *msg) {
+ // TODO(nasko): For now, RenderFrameHost uses this object to send IPC messages
+ // while swapped out. This can be removed once we don't have a swapped out
+ // state on RenderFrameHosts. See https://crbug.com/357747.
+ msg->set_routing_id(routing_id_);
+ return GetProcess()->Send(msg);
+}
+
+bool RenderFrameProxyHost::OnMessageReceived(const IPC::Message& msg) {
+ // TODO(nasko): This can be removed once we don't have a swapped out state on
+ // RenderFrameHosts. See https://crbug.com/357747.
+ if (render_frame_host_.get())
+ return render_frame_host_->OnMessageReceived(msg);
+
+ return false;
+}
} // namespace content

Powered by Google App Engine
This is Rietveld 408576698