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

Side by Side Diff: content/browser/utility_process_host_impl.cc

Issue 2138263002: Revert of Move content's shell connections to the IO thread (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/utility_process_host_impl.h" 5 #include "content/browser/utility_process_host_impl.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/base_switches.h" 9 #include "base/base_switches.h"
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 child_flags_(ChildProcessHost::CHILD_NORMAL), 165 child_flags_(ChildProcessHost::CHILD_NORMAL),
166 #endif 166 #endif
167 started_(false), 167 started_(false),
168 name_(base::ASCIIToUTF16("utility process")), 168 name_(base::ASCIIToUTF16("utility process")),
169 child_token_(mojo::edk::GenerateRandomToken()), 169 child_token_(mojo::edk::GenerateRandomToken()),
170 weak_ptr_factory_(this) { 170 weak_ptr_factory_(this) {
171 process_.reset(new BrowserChildProcessHostImpl(PROCESS_TYPE_UTILITY, this, 171 process_.reset(new BrowserChildProcessHostImpl(PROCESS_TYPE_UTILITY, this,
172 child_token_)); 172 child_token_));
173 mojo_child_connection_.reset(new MojoChildConnection( 173 mojo_child_connection_.reset(new MojoChildConnection(
174 kUtilityMojoApplicationName, 174 kUtilityMojoApplicationName,
175 base::StringPrintf("%d_0", process_->GetData().id), child_token_, 175 base::StringPrintf("%d_0", process_->GetData().id),
176 MojoShellContext::GetConnectorForIOThread(), 176 child_token_,
177 BrowserThread::UnsafeGetMessageLoopForThread(BrowserThread::IO) 177 MojoShellContext::GetConnectorForIOThread()));
178 ->task_runner()));
179 } 178 }
180 179
181 UtilityProcessHostImpl::~UtilityProcessHostImpl() { 180 UtilityProcessHostImpl::~UtilityProcessHostImpl() {
182 DCHECK_CURRENTLY_ON(BrowserThread::IO); 181 DCHECK_CURRENTLY_ON(BrowserThread::IO);
183 if (is_batch_mode_) 182 if (is_batch_mode_)
184 EndBatchMode(); 183 EndBatchMode();
185 } 184 }
186 185
187 base::WeakPtr<UtilityProcessHost> UtilityProcessHostImpl::AsWeakPtr() { 186 base::WeakPtr<UtilityProcessHost> UtilityProcessHostImpl::AsWeakPtr() {
188 return weak_ptr_factory_.GetWeakPtr(); 187 return weak_ptr_factory_.GetWeakPtr();
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
233 env_ = env; 232 env_ = env;
234 } 233 }
235 234
236 #endif // OS_POSIX 235 #endif // OS_POSIX
237 236
238 bool UtilityProcessHostImpl::Start() { 237 bool UtilityProcessHostImpl::Start() {
239 return StartProcess(); 238 return StartProcess();
240 } 239 }
241 240
242 shell::InterfaceRegistry* UtilityProcessHostImpl::GetInterfaceRegistry() { 241 shell::InterfaceRegistry* UtilityProcessHostImpl::GetInterfaceRegistry() {
243 return mojo_child_connection_->GetInterfaceRegistry(); 242 return mojo_child_connection_->connection()->GetInterfaceRegistry();
244 } 243 }
245 244
246 shell::InterfaceProvider* UtilityProcessHostImpl::GetRemoteInterfaces() { 245 shell::InterfaceProvider* UtilityProcessHostImpl::GetRemoteInterfaces() {
247 return mojo_child_connection_->GetRemoteInterfaces(); 246 return mojo_child_connection_->connection()->GetRemoteInterfaces();
248 } 247 }
249 248
250 void UtilityProcessHostImpl::SetName(const base::string16& name) { 249 void UtilityProcessHostImpl::SetName(const base::string16& name) {
251 name_ = name; 250 name_ = name;
252 } 251 }
253 252
254 #if defined(OS_POSIX) && !defined(OS_ANDROID) && !defined(OS_MACOSX) 253 #if defined(OS_POSIX) && !defined(OS_ANDROID) && !defined(OS_MACOSX)
255 // static 254 // static
256 void UtilityProcessHostImpl::EarlyZygoteLaunch() { 255 void UtilityProcessHostImpl::EarlyZygoteLaunch() {
257 DCHECK(!g_utility_zygote); 256 DCHECK(!g_utility_zygote);
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
425 base::WeakPtr<UtilityProcessHostImpl> host, 424 base::WeakPtr<UtilityProcessHostImpl> host,
426 int error_code) { 425 int error_code) {
427 if (!host) 426 if (!host)
428 return; 427 return;
429 428
430 host->OnProcessLaunchFailed(error_code); 429 host->OnProcessLaunchFailed(error_code);
431 delete host.get(); 430 delete host.get();
432 } 431 }
433 432
434 } // namespace content 433 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698