Chromium Code Reviews| Index: content/browser/renderer_host/render_frame_host_impl.cc |
| diff --git a/content/browser/renderer_host/render_frame_host_impl.cc b/content/browser/renderer_host/render_frame_host_impl.cc |
| index ea511d0b8c38d14a376281979fa7989e66ca3e51..044ebe2efef516dcbc332737a335ea92683055b8 100644 |
| --- a/content/browser/renderer_host/render_frame_host_impl.cc |
| +++ b/content/browser/renderer_host/render_frame_host_impl.cc |
| @@ -4,31 +4,63 @@ |
| #include "content/browser/renderer_host/render_frame_host_impl.h" |
| +#include "base/containers/hash_tables.h" |
| +#include "base/lazy_instance.h" |
| #include "content/browser/renderer_host/render_view_host_impl.h" |
| namespace content { |
| +typedef std::pair<int32, int32> RenderFrameHostID; |
|
Charlie Reis
2013/08/26 18:27:10
Please add a comment saying what these IDs represe
awong
2013/08/27 19:58:13
Done.
|
| +typedef base::hash_map<RenderFrameHostID, RenderFrameHostImpl*> |
| + RoutingIDFrameMap; |
| +static base::LazyInstance<RoutingIDFrameMap> g_routing_id_frame_map = |
| + LAZY_INSTANCE_INITIALIZER; |
| + |
| +// static |
| +RenderFrameHostImpl* RenderFrameHostImpl::FromID( |
| + int process_id, int routing_id) { |
| + RoutingIDFrameMap* frames = g_routing_id_frame_map.Pointer(); |
| + RoutingIDFrameMap::iterator it = frames->find( |
| + RenderFrameHostID(process_id, routing_id)); |
| + return it == frames->end() ? NULL : it->second; |
| +} |
| + |
| RenderFrameHostImpl::RenderFrameHostImpl( |
| RenderViewHostImpl* render_view_host, |
| int routing_id, |
| - bool swapped_out) |
| + bool is_swapped_out) |
| : render_view_host_(render_view_host), |
| - routing_id_(routing_id) { |
| + routing_id_(routing_id), |
| + is_swapped_out_(is_swapped_out) { |
| + GetProcess()->AddRoute(routing_id_, this); |
| + g_routing_id_frame_map.Get().insert(std::make_pair( |
| + RenderFrameHostID(render_view_host_->GetProcess()->GetID(), routing_id_), |
|
Charlie Reis
2013/08/26 18:27:10
nit: Just use GetProcess(), here and in the destru
awong
2013/08/27 19:58:13
Done.
|
| + this)); |
| } |
| RenderFrameHostImpl::~RenderFrameHostImpl() { |
| + GetProcess()->RemoveRoute(routing_id_); |
| + g_routing_id_frame_map.Get().erase( |
| + RenderFrameHostID(render_view_host_->GetProcess()->GetID(), routing_id_)); |
| + |
| } |
| bool RenderFrameHostImpl::Send(IPC::Message* message) { |
| - // Use the RenderViewHost object to send the message. It inherits it from |
| - // RenderWidgetHost, which ultimately uses the current process's |Send|. |
| - return render_view_host_->Send(message); |
| + return GetProcess()->Send(message); |
| } |
| bool RenderFrameHostImpl::OnMessageReceived(const IPC::Message &msg) { |
| - // Pass the message up to the RenderViewHost, until we have enough |
| - // infrastructure to start processing messages in this object. |
| - return render_view_host_->OnMessageReceived(msg); |
| + return false; |
| +} |
| + |
| +void RenderFrameHostImpl::Init() { |
| + GetProcess()->ResumeRequestsForView(routing_id()); |
| +} |
| + |
| +RenderProcessHost* RenderFrameHostImpl::GetProcess() const { |
| + // TODO(ajwong): This should return its own process once cross-process |
| + // subframe navigations are supported. |
| + return render_view_host_->GetProcess(); |
| } |
| } // namespace content |