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/child/child_thread_impl.h" | 5 #include "content/child/child_thread_impl.h" |
6 | 6 |
7 #include <signal.h> | 7 #include <signal.h> |
8 | |
9 #include <string> | 8 #include <string> |
| 9 #include <utility> |
10 | 10 |
11 #include "base/base_switches.h" | 11 #include "base/base_switches.h" |
12 #include "base/command_line.h" | 12 #include "base/command_line.h" |
13 #include "base/debug/leak_annotations.h" | 13 #include "base/debug/leak_annotations.h" |
14 #include "base/debug/profiler.h" | 14 #include "base/debug/profiler.h" |
15 #include "base/lazy_instance.h" | 15 #include "base/lazy_instance.h" |
16 #include "base/location.h" | 16 #include "base/location.h" |
17 #include "base/logging.h" | 17 #include "base/logging.h" |
18 #include "base/macros.h" | 18 #include "base/macros.h" |
19 #include "base/message_loop/timer_slack.h" | 19 #include "base/message_loop/timer_slack.h" |
(...skipping 443 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
463 ChildProcess::current()->io_task_runner())); | 463 ChildProcess::current()->io_task_runner())); |
464 channel_->AddFilter(new ChildMemoryMessageFilter()); | 464 channel_->AddFilter(new ChildMemoryMessageFilter()); |
465 } | 465 } |
466 | 466 |
467 // In single process mode we may already have a power monitor | 467 // In single process mode we may already have a power monitor |
468 if (!base::PowerMonitor::Get()) { | 468 if (!base::PowerMonitor::Get()) { |
469 scoped_ptr<PowerMonitorBroadcastSource> power_monitor_source( | 469 scoped_ptr<PowerMonitorBroadcastSource> power_monitor_source( |
470 new PowerMonitorBroadcastSource()); | 470 new PowerMonitorBroadcastSource()); |
471 channel_->AddFilter(power_monitor_source->GetMessageFilter()); | 471 channel_->AddFilter(power_monitor_source->GetMessageFilter()); |
472 | 472 |
473 power_monitor_.reset(new base::PowerMonitor( | 473 power_monitor_.reset( |
474 power_monitor_source.Pass())); | 474 new base::PowerMonitor(std::move(power_monitor_source))); |
475 } | 475 } |
476 | 476 |
477 #if defined(OS_POSIX) | 477 #if defined(OS_POSIX) |
478 // Check that --process-type is specified so we don't do this in unit tests | 478 // Check that --process-type is specified so we don't do this in unit tests |
479 // and single-process mode. | 479 // and single-process mode. |
480 if (base::CommandLine::ForCurrentProcess()->HasSwitch(switches::kProcessType)) | 480 if (base::CommandLine::ForCurrentProcess()->HasSwitch(switches::kProcessType)) |
481 channel_->AddFilter(new SuicideOnChannelErrorFilter()); | 481 channel_->AddFilter(new SuicideOnChannelErrorFilter()); |
482 #endif | 482 #endif |
483 | 483 |
484 #if defined(OS_MACOSX) | 484 #if defined(OS_MACOSX) |
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
719 const IPC::PlatformFileForTransit& file) { | 719 const IPC::PlatformFileForTransit& file) { |
720 #if defined(MOJO_SHELL_CLIENT) | 720 #if defined(MOJO_SHELL_CLIENT) |
721 #if defined(OS_POSIX) | 721 #if defined(OS_POSIX) |
722 base::PlatformFile handle = file.fd; | 722 base::PlatformFile handle = file.fd; |
723 #elif defined(OS_WIN) | 723 #elif defined(OS_WIN) |
724 base::PlatformFile handle = file; | 724 base::PlatformFile handle = file; |
725 #endif | 725 #endif |
726 mojo::ScopedMessagePipeHandle message_pipe = | 726 mojo::ScopedMessagePipeHandle message_pipe = |
727 mojo_shell_channel_init_.Init(handle, GetIOTaskRunner()); | 727 mojo_shell_channel_init_.Init(handle, GetIOTaskRunner()); |
728 DCHECK(message_pipe.is_valid()); | 728 DCHECK(message_pipe.is_valid()); |
729 MojoShellConnectionImpl::Get()->BindToMessagePipe(message_pipe.Pass()); | 729 MojoShellConnectionImpl::Get()->BindToMessagePipe(std::move(message_pipe)); |
730 #endif // defined(MOJO_SHELL_CLIENT) | 730 #endif // defined(MOJO_SHELL_CLIENT) |
731 } | 731 } |
732 | 732 |
733 void ChildThreadImpl::OnSetMojoParentPipeHandle( | 733 void ChildThreadImpl::OnSetMojoParentPipeHandle( |
734 const IPC::PlatformFileForTransit& file) { | 734 const IPC::PlatformFileForTransit& file) { |
735 mojo::embedder::SetParentPipeHandle( | 735 mojo::embedder::SetParentPipeHandle( |
736 mojo::embedder::ScopedPlatformHandle(mojo::embedder::PlatformHandle( | 736 mojo::embedder::ScopedPlatformHandle(mojo::embedder::PlatformHandle( |
737 IPC::PlatformFileForTransitToPlatformFile(file)))); | 737 IPC::PlatformFileForTransitToPlatformFile(file)))); |
738 } | 738 } |
739 | 739 |
(...skipping 27 matching lines...) Expand all Loading... |
767 void ChildThreadImpl::EnsureConnected() { | 767 void ChildThreadImpl::EnsureConnected() { |
768 VLOG(0) << "ChildThreadImpl::EnsureConnected()"; | 768 VLOG(0) << "ChildThreadImpl::EnsureConnected()"; |
769 base::Process::Current().Terminate(0, false); | 769 base::Process::Current().Terminate(0, false); |
770 } | 770 } |
771 | 771 |
772 bool ChildThreadImpl::IsInBrowserProcess() const { | 772 bool ChildThreadImpl::IsInBrowserProcess() const { |
773 return browser_process_io_runner_; | 773 return browser_process_io_runner_; |
774 } | 774 } |
775 | 775 |
776 } // namespace content | 776 } // namespace content |
OLD | NEW |