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 384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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) | 404 #if defined(OS_WIN) |
| 405 // TODO(jam): enable on POSIX |
405 if (base::CommandLine::ForCurrentProcess()->HasSwitch("use-new-edk")) { | 406 if (base::CommandLine::ForCurrentProcess()->HasSwitch("use-new-edk")) { |
406 HANDLE client_pipe = mojo::embedder::ChildProcessLaunched(process.Handle()); | 407 mojo::embedder::ScopedPlatformHandle client_pipe = |
| 408 mojo::embedder::ChildProcessLaunched(process.Handle()); |
407 Send(new ChildProcessMsg_SetMojoParentPipeHandle( | 409 Send(new ChildProcessMsg_SetMojoParentPipeHandle( |
408 IPC::GetFileHandleForProcess(client_pipe, process.Handle(), true))); | 410 IPC::GetFileHandleForProcess( |
| 411 #if defined(OS_WIN) |
| 412 client_pipe.release().handle, |
| 413 #else |
| 414 client_pipe.release().fd, |
| 415 #endif |
| 416 process.Handle(), true))); |
409 } | 417 } |
| 418 #endif |
410 | 419 |
| 420 #if defined(OS_WIN) |
411 // Start a WaitableEventWatcher that will invoke OnProcessExitedEarly if the | 421 // Start a WaitableEventWatcher that will invoke OnProcessExitedEarly if the |
412 // child process exits. This watcher is stopped once the IPC channel is | 422 // child process exits. This watcher is stopped once the IPC channel is |
413 // connected and the exit of the child process is detecter by an error on the | 423 // connected and the exit of the child process is detecter by an error on the |
414 // IPC channel thereafter. | 424 // IPC channel thereafter. |
415 DCHECK(!early_exit_watcher_.GetWatchedObject()); | 425 DCHECK(!early_exit_watcher_.GetWatchedObject()); |
416 early_exit_watcher_.StartWatchingOnce(process.Handle(), this); | 426 early_exit_watcher_.StartWatchingOnce(process.Handle(), this); |
417 #endif | 427 #endif |
418 | 428 |
419 // TODO(rvargas) crbug.com/417532: Don't store a handle. | 429 // TODO(rvargas) crbug.com/417532: Don't store a handle. |
420 data_.handle = process.Handle(); | 430 data_.handle = process.Handle(); |
(...skipping 14 matching lines...) Expand all Loading... |
435 | 445 |
436 #if defined(OS_WIN) | 446 #if defined(OS_WIN) |
437 | 447 |
438 void BrowserChildProcessHostImpl::OnObjectSignaled(HANDLE object) { | 448 void BrowserChildProcessHostImpl::OnObjectSignaled(HANDLE object) { |
439 OnChildDisconnected(); | 449 OnChildDisconnected(); |
440 } | 450 } |
441 | 451 |
442 #endif | 452 #endif |
443 | 453 |
444 } // namespace content | 454 } // namespace content |
OLD | NEW |