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

Unified Diff: content/browser/renderer_host/mock_render_process_host.cc

Issue 8597005: Provide a way for RenderProcessHosts to register themselves in the global host map. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 1 month 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
« no previous file with comments | « no previous file | content/browser/renderer_host/render_process_host_impl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/renderer_host/mock_render_process_host.cc
===================================================================
--- content/browser/renderer_host/mock_render_process_host.cc (revision 110616)
+++ content/browser/renderer_host/mock_render_process_host.cc (working copy)
@@ -8,19 +8,11 @@
#include "base/message_loop.h"
#include "base/time.h"
#include "content/browser/child_process_security_policy.h"
+#include "content/browser/renderer_host/render_process_host_impl.h"
#include "content/common/child_process_info.h"
#include "content/public/browser/notification_service.h"
#include "content/public/browser/notification_types.h"
-// This map is the global list of all renderer processes and is defined in
-// render_process_host_impl.cc
-// TODO(ananta)
-// Clean up this dependency in a subsequent CL.
-extern base::LazyInstance<
- IDMap<content::RenderProcessHost>,
- base::LeakyLazyInstanceTraits<IDMap<content::RenderProcessHost> > >
- g_all_hosts;
-
MockRenderProcessHost::MockRenderProcessHost(
content::BrowserContext* browser_context)
: transport_dib_(NULL),
@@ -33,7 +25,8 @@
// Child process security operations can't be unit tested unless we add
// ourselves as an existing child process.
ChildProcessSecurityPolicy::GetInstance()->Add(GetID());
- g_all_hosts.Get().AddWithID(this, GetID());
+
+ RenderProcessHostImpl::RegisterHost(GetID(), this);
}
MockRenderProcessHost::~MockRenderProcessHost() {
@@ -42,8 +35,7 @@
if (factory_)
factory_->Remove(this);
// In unit tests, Release() might not have been called.
- if (g_all_hosts.Get().Lookup(GetID()))
- g_all_hosts.Get().Remove(GetID());
+ RenderProcessHostImpl::UnregisterHost(GetID());
}
void MockRenderProcessHost::EnableSendQueue() {
@@ -173,7 +165,7 @@
content::Source<RenderProcessHost>(this),
content::NotificationService::NoDetails());
MessageLoop::current()->DeleteSoon(FROM_HERE, this);
- g_all_hosts.Get().Remove(GetID());
+ RenderProcessHostImpl::UnregisterHost(GetID());
}
}
« no previous file with comments | « no previous file | content/browser/renderer_host/render_process_host_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698