| OLD | NEW |
| 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/debug/dump_without_crashing.h" | 10 #include "base/debug/dump_without_crashing.h" |
| (...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 394 delegate_->OnProcessLaunchFailed(); | 394 delegate_->OnProcessLaunchFailed(); |
| 395 delete delegate_; // Will delete us | 395 delete delegate_; // Will delete us |
| 396 } | 396 } |
| 397 | 397 |
| 398 void BrowserChildProcessHostImpl::OnProcessLaunched() { | 398 void BrowserChildProcessHostImpl::OnProcessLaunched() { |
| 399 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 399 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 400 | 400 |
| 401 const base::Process& process = child_process_->GetProcess(); | 401 const base::Process& process = child_process_->GetProcess(); |
| 402 DCHECK(process.IsValid()); | 402 DCHECK(process.IsValid()); |
| 403 | 403 |
| 404 #if defined(OS_WIN) | |
| 405 // TODO(jam): enable on POSIX | |
| 406 if (base::CommandLine::ForCurrentProcess()->HasSwitch("use-new-edk")) { | 404 if (base::CommandLine::ForCurrentProcess()->HasSwitch("use-new-edk")) { |
| 407 mojo::embedder::ScopedPlatformHandle client_pipe = | 405 mojo::embedder::ScopedPlatformHandle client_pipe = |
| 408 mojo::embedder::ChildProcessLaunched(process.Handle()); | 406 mojo::embedder::ChildProcessLaunched(process.Handle()); |
| 409 Send(new ChildProcessMsg_SetMojoParentPipeHandle( | 407 Send(new ChildProcessMsg_SetMojoParentPipeHandle( |
| 410 IPC::GetFileHandleForProcess( | 408 IPC::GetFileHandleForProcess( |
| 411 #if defined(OS_WIN) | 409 #if defined(OS_WIN) |
| 412 client_pipe.release().handle, | 410 client_pipe.release().handle, |
| 413 #else | 411 #else |
| 414 client_pipe.release().fd, | 412 client_pipe.release().fd, |
| 415 #endif | 413 #endif |
| 416 process.Handle(), true))); | 414 process.Handle(), true))); |
| 417 } | 415 } |
| 418 #endif | |
| 419 | 416 |
| 420 #if defined(OS_WIN) | 417 #if defined(OS_WIN) |
| 421 // Start a WaitableEventWatcher that will invoke OnProcessExitedEarly if the | 418 // Start a WaitableEventWatcher that will invoke OnProcessExitedEarly if the |
| 422 // child process exits. This watcher is stopped once the IPC channel is | 419 // child process exits. This watcher is stopped once the IPC channel is |
| 423 // connected and the exit of the child process is detecter by an error on the | 420 // connected and the exit of the child process is detecter by an error on the |
| 424 // IPC channel thereafter. | 421 // IPC channel thereafter. |
| 425 DCHECK(!early_exit_watcher_.GetWatchedObject()); | 422 DCHECK(!early_exit_watcher_.GetWatchedObject()); |
| 426 early_exit_watcher_.StartWatchingOnce(process.Handle(), this); | 423 early_exit_watcher_.StartWatchingOnce(process.Handle(), this); |
| 427 #endif | 424 #endif |
| 428 | 425 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 445 | 442 |
| 446 #if defined(OS_WIN) | 443 #if defined(OS_WIN) |
| 447 | 444 |
| 448 void BrowserChildProcessHostImpl::OnObjectSignaled(HANDLE object) { | 445 void BrowserChildProcessHostImpl::OnObjectSignaled(HANDLE object) { |
| 449 OnChildDisconnected(); | 446 OnChildDisconnected(); |
| 450 } | 447 } |
| 451 | 448 |
| 452 #endif | 449 #endif |
| 453 | 450 |
| 454 } // namespace content | 451 } // namespace content |
| OLD | NEW |