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

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: Fix IPC_BEGIN_MESSAGE_MAP macro, as _EX version doesn't exist anymore. 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..b09fccb5eab3cf49306a090122c953ceca60713c 100644
--- a/content/browser/frame_host/render_frame_proxy_host.cc
+++ b/content/browser/frame_host/render_frame_proxy_host.cc
@@ -4,16 +4,55 @@
#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_);
+}
+
+RenderViewHostImpl* RenderFrameProxyHost::GetRenderViewHost() {
+ if (render_frame_host_.get())
+ return render_frame_host_->render_view_host();
+ return NULL;
+}
+
+scoped_ptr<RenderFrameHostImpl> RenderFrameProxyHost::PassFrameHostOwnership() {
+ 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
« no previous file with comments | « content/browser/frame_host/render_frame_proxy_host.h ('k') | content/browser/renderer_host/render_view_host_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698