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

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

Issue 13896004: Cleanup various bits of BrowserThreadImpl and PluginServiceImpl. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 7 years, 8 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
« no previous file with comments | « no previous file | content/browser/browser_thread_impl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/browser_child_process_host_impl.h" 5 #include "content/browser/browser_child_process_host_impl.h"
6 6
7 #include "base/base_switches.h" 7 #include "base/base_switches.h"
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/files/file_path.h" 10 #include "base/files/file_path.h"
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after
293 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, 293 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE,
294 base::Bind(&NotifyProcessHostDisconnected, data_)); 294 base::Bind(&NotifyProcessHostDisconnected, data_));
295 delete delegate_; // Will delete us 295 delete delegate_; // Will delete us
296 } 296 }
297 297
298 bool BrowserChildProcessHostImpl::Send(IPC::Message* message) { 298 bool BrowserChildProcessHostImpl::Send(IPC::Message* message) {
299 return child_process_host_->Send(message); 299 return child_process_host_->Send(message);
300 } 300 }
301 301
302 void BrowserChildProcessHostImpl::OnProcessLaunched() { 302 void BrowserChildProcessHostImpl::OnProcessLaunched() {
303 if (!child_process_->GetHandle()) { 303 base::ProcessHandle handle = child_process_->GetHandle();
304 if (!handle) {
304 delete delegate_; // Will delete us 305 delete delegate_; // Will delete us
305 return; 306 return;
306 } 307 }
307 308
308 #if defined(OS_WIN) 309 #if defined(OS_WIN)
309 // Start a WaitableEventWatcher that will invoke OnProcessExitedEarly if the 310 // Start a WaitableEventWatcher that will invoke OnProcessExitedEarly if the
310 // child process exits. This watcher is stopped once the IPC channel is 311 // child process exits. This watcher is stopped once the IPC channel is
311 // connected and the exit of the child process is detecter by an error on the 312 // connected and the exit of the child process is detecter by an error on the
312 // IPC channel thereafter. 313 // IPC channel thereafter.
313 DCHECK(!early_exit_watcher_.GetWatchedEvent()); 314 DCHECK(!early_exit_watcher_.GetWatchedEvent());
314 early_exit_watcher_.StartWatching( 315 early_exit_watcher_.StartWatching(
315 new base::WaitableEvent(child_process_->GetHandle()), 316 new base::WaitableEvent(handle),
316 base::Bind(&BrowserChildProcessHostImpl::OnProcessExitedEarly, 317 base::Bind(&BrowserChildProcessHostImpl::OnProcessExitedEarly,
317 base::Unretained(this))); 318 base::Unretained(this)));
318 #endif 319 #endif
319 320
320 data_.handle = child_process_->GetHandle(); 321 data_.handle = handle;
321 delegate_->OnProcessLaunched(); 322 delegate_->OnProcessLaunched();
322 } 323 }
323 324
324 #if defined(OS_WIN) 325 #if defined(OS_WIN)
325 326
326 void BrowserChildProcessHostImpl::DeleteProcessWaitableEvent( 327 void BrowserChildProcessHostImpl::DeleteProcessWaitableEvent(
327 base::WaitableEvent* event) { 328 base::WaitableEvent* event) {
328 if (!event) 329 if (!event)
329 return; 330 return;
330 331
331 // The WaitableEvent does not own the process handle so ensure it does not 332 // The WaitableEvent does not own the process handle so ensure it does not
332 // close it. 333 // close it.
333 event->Release(); 334 event->Release();
334 335
335 delete event; 336 delete event;
336 } 337 }
337 338
338 void BrowserChildProcessHostImpl::OnProcessExitedEarly( 339 void BrowserChildProcessHostImpl::OnProcessExitedEarly(
339 base::WaitableEvent* event) { 340 base::WaitableEvent* event) {
340 DeleteProcessWaitableEvent(event); 341 DeleteProcessWaitableEvent(event);
341 OnChildDisconnected(); 342 OnChildDisconnected();
342 } 343 }
343 344
344 #endif 345 #endif
345 346
346 } // namespace content 347 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | content/browser/browser_thread_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698