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

Side by Side Diff: content/browser/renderer_host/mock_render_process_host.cc

Issue 8787004: Make ChildProcessHost be used through an interface in content/public, instead of by inheritence. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/browser/renderer_host/mock_render_process_host.h" 5 #include "content/browser/renderer_host/mock_render_process_host.h"
6 6
7 #include "base/lazy_instance.h" 7 #include "base/lazy_instance.h"
8 #include "base/message_loop.h" 8 #include "base/message_loop.h"
9 #include "base/time.h" 9 #include "base/time.h"
10 #include "content/browser/child_process_security_policy.h" 10 #include "content/browser/child_process_security_policy.h"
11 #include "content/browser/renderer_host/render_process_host_impl.h" 11 #include "content/browser/renderer_host/render_process_host_impl.h"
12 #include "content/common/child_process_host.h" 12 #include "content/common/child_process_host_impl.h"
13 #include "content/public/browser/notification_service.h" 13 #include "content/public/browser/notification_service.h"
14 #include "content/public/browser/notification_types.h" 14 #include "content/public/browser/notification_types.h"
15 15
16 using content::ChildProcessHostImpl;
17
16 MockRenderProcessHost::MockRenderProcessHost( 18 MockRenderProcessHost::MockRenderProcessHost(
17 content::BrowserContext* browser_context) 19 content::BrowserContext* browser_context)
18 : transport_dib_(NULL), 20 : transport_dib_(NULL),
19 bad_msg_count_(0), 21 bad_msg_count_(0),
20 factory_(NULL), 22 factory_(NULL),
21 id_(ChildProcessHost::GenerateChildProcessUniqueId()), 23 id_(ChildProcessHostImpl::GenerateChildProcessUniqueId()),
22 browser_context_(browser_context), 24 browser_context_(browser_context),
23 max_page_id_(-1), 25 max_page_id_(-1),
24 fast_shutdown_started_(false) { 26 fast_shutdown_started_(false) {
25 // Child process security operations can't be unit tested unless we add 27 // Child process security operations can't be unit tested unless we add
26 // ourselves as an existing child process. 28 // ourselves as an existing child process.
27 ChildProcessSecurityPolicy::GetInstance()->Add(GetID()); 29 ChildProcessSecurityPolicy::GetInstance()->Add(GetID());
28 30
29 RenderProcessHostImpl::RegisterHost(GetID(), this); 31 RenderProcessHostImpl::RegisterHost(GetID(), this);
30 } 32 }
31 33
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after
250 252
251 void MockRenderProcessHostFactory::Remove(MockRenderProcessHost* host) const { 253 void MockRenderProcessHostFactory::Remove(MockRenderProcessHost* host) const {
252 for (ScopedVector<MockRenderProcessHost>::iterator it = processes_.begin(); 254 for (ScopedVector<MockRenderProcessHost>::iterator it = processes_.begin();
253 it != processes_.end(); ++it) { 255 it != processes_.end(); ++it) {
254 if (*it == host) { 256 if (*it == host) {
255 processes_.weak_erase(it); 257 processes_.weak_erase(it);
256 break; 258 break;
257 } 259 }
258 } 260 }
259 } 261 }
OLDNEW
« no previous file with comments | « content/browser/ppapi_plugin_process_host.cc ('k') | content/browser/renderer_host/render_message_filter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698