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

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

Issue 7464009: Removal of Profile from content part 1. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: slight tweaking for comments Created 9 years, 5 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 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 "content/browser/child_process_security_policy.h" 7 #include "content/browser/child_process_security_policy.h"
8 8
9 MockRenderProcessHost::MockRenderProcessHost(Profile* profile) 9 MockRenderProcessHost::MockRenderProcessHost(
10 : RenderProcessHost(profile), 10 content::BrowserContext* browser_context)
11 transport_dib_(NULL), 11 : RenderProcessHost(browser_context),
12 bad_msg_count_(0), 12 transport_dib_(NULL),
13 factory_(NULL) { 13 bad_msg_count_(0),
14 factory_(NULL) {
14 // Child process security operations can't be unit tested unless we add 15 // Child process security operations can't be unit tested unless we add
15 // ourselves as an existing child process. 16 // ourselves as an existing child process.
16 ChildProcessSecurityPolicy::GetInstance()->Add(id()); 17 ChildProcessSecurityPolicy::GetInstance()->Add(id());
17 } 18 }
18 19
19 MockRenderProcessHost::~MockRenderProcessHost() { 20 MockRenderProcessHost::~MockRenderProcessHost() {
20 ChildProcessSecurityPolicy::GetInstance()->Remove(id()); 21 ChildProcessSecurityPolicy::GetInstance()->Remove(id());
21 delete transport_dib_; 22 delete transport_dib_;
22 if (factory_) 23 if (factory_)
23 factory_->Remove(this); 24 factory_->Remove(this);
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 MockRenderProcessHostFactory::~MockRenderProcessHostFactory() { 121 MockRenderProcessHostFactory::~MockRenderProcessHostFactory() {
121 // Detach this object from MockRenderProcesses to prevent STLDeleteElements() 122 // Detach this object from MockRenderProcesses to prevent STLDeleteElements()
122 // from calling MockRenderProcessHostFactory::Remove(). 123 // from calling MockRenderProcessHostFactory::Remove().
123 for (ScopedVector<MockRenderProcessHost>::iterator it = processes_.begin(); 124 for (ScopedVector<MockRenderProcessHost>::iterator it = processes_.begin();
124 it != processes_.end(); ++it) { 125 it != processes_.end(); ++it) {
125 (*it)->SetFactory(NULL); 126 (*it)->SetFactory(NULL);
126 } 127 }
127 } 128 }
128 129
129 RenderProcessHost* MockRenderProcessHostFactory::CreateRenderProcessHost( 130 RenderProcessHost* MockRenderProcessHostFactory::CreateRenderProcessHost(
130 Profile* profile) const { 131 content::BrowserContext* browser_context) const {
131 MockRenderProcessHost* host = new MockRenderProcessHost(profile); 132 MockRenderProcessHost* host = new MockRenderProcessHost(browser_context);
132 if (host) { 133 if (host) {
133 processes_.push_back(host); 134 processes_.push_back(host);
134 host->SetFactory(this); 135 host->SetFactory(this);
135 } 136 }
136 return host; 137 return host;
137 } 138 }
138 139
139 void MockRenderProcessHostFactory::Remove(MockRenderProcessHost* host) const { 140 void MockRenderProcessHostFactory::Remove(MockRenderProcessHost* host) const {
140 for (ScopedVector<MockRenderProcessHost>::iterator it = processes_.begin(); 141 for (ScopedVector<MockRenderProcessHost>::iterator it = processes_.begin();
141 it != processes_.end(); ++it) { 142 it != processes_.end(); ++it) {
142 if (*it == host) { 143 if (*it == host) {
143 processes_.weak_erase(it); 144 processes_.weak_erase(it);
144 break; 145 break;
145 } 146 }
146 } 147 }
147 } 148 }
OLDNEW
« no previous file with comments | « content/browser/renderer_host/mock_render_process_host.h ('k') | content/browser/renderer_host/pepper_file_message_filter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698