| 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..ec621c10dca3f15e9bc40ba269d519621247a81f 100644
|
| --- a/content/browser/renderer_host/render_frame_host_impl.cc
|
| +++ b/content/browser/renderer_host/render_frame_host_impl.cc
|
| @@ -4,31 +4,64 @@
|
|
|
| #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 {
|
|
|
| +// The (process id, routing id) pair that identifies one RenderFrame.
|
| +typedef std::pair<int32, int32> RenderFrameHostID;
|
| +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(GetProcess()->GetID(), routing_id_),
|
| + this));
|
| }
|
|
|
| RenderFrameHostImpl::~RenderFrameHostImpl() {
|
| + GetProcess()->RemoveRoute(routing_id_);
|
| + g_routing_id_frame_map.Get().erase(
|
| + RenderFrameHostID(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
|
|
|