| 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 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 #include "content/child/service_worker/service_worker_message_filter.h" | 49 #include "content/child/service_worker/service_worker_message_filter.h" |
| 50 #include "content/child/thread_safe_sender.h" | 50 #include "content/child/thread_safe_sender.h" |
| 51 #include "content/child/websocket_dispatcher.h" | 51 #include "content/child/websocket_dispatcher.h" |
| 52 #include "content/common/child_process_messages.h" | 52 #include "content/common/child_process_messages.h" |
| 53 #include "content/common/in_process_child_thread_params.h" | 53 #include "content/common/in_process_child_thread_params.h" |
| 54 #include "content/common/mojo/mojo_messages.h" | 54 #include "content/common/mojo/mojo_messages.h" |
| 55 #include "content/public/common/content_switches.h" | 55 #include "content/public/common/content_switches.h" |
| 56 #include "ipc/attachment_broker.h" | 56 #include "ipc/attachment_broker.h" |
| 57 #include "ipc/attachment_broker_unprivileged.h" | 57 #include "ipc/attachment_broker_unprivileged.h" |
| 58 #include "ipc/ipc_logging.h" | 58 #include "ipc/ipc_logging.h" |
| 59 #include "ipc/ipc_platform_file.h" |
| 59 #include "ipc/ipc_switches.h" | 60 #include "ipc/ipc_switches.h" |
| 60 #include "ipc/ipc_sync_channel.h" | 61 #include "ipc/ipc_sync_channel.h" |
| 61 #include "ipc/ipc_sync_message_filter.h" | 62 #include "ipc/ipc_sync_message_filter.h" |
| 62 #include "ipc/mojo/ipc_channel_mojo.h" | 63 #include "ipc/mojo/ipc_channel_mojo.h" |
| 63 #include "third_party/mojo/src/mojo/edk/embedder/embedder.h" | 64 #include "third_party/mojo/src/mojo/edk/embedder/embedder.h" |
| 64 | 65 |
| 65 #if defined(TCMALLOC_TRACE_MEMORY_SUPPORTED) | 66 #if defined(TCMALLOC_TRACE_MEMORY_SUPPORTED) |
| 66 #include "third_party/tcmalloc/chromium/src/gperftools/heap-profiler.h" | 67 #include "third_party/tcmalloc/chromium/src/gperftools/heap-profiler.h" |
| 67 #endif | 68 #endif |
| 68 | 69 |
| (...skipping 655 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 724 #elif defined(OS_WIN) | 725 #elif defined(OS_WIN) |
| 725 base::PlatformFile handle = file; | 726 base::PlatformFile handle = file; |
| 726 #endif | 727 #endif |
| 727 mojo::ScopedMessagePipeHandle message_pipe = | 728 mojo::ScopedMessagePipeHandle message_pipe = |
| 728 mojo_shell_channel_init_.Init(handle, GetIOTaskRunner()); | 729 mojo_shell_channel_init_.Init(handle, GetIOTaskRunner()); |
| 729 DCHECK(message_pipe.is_valid()); | 730 DCHECK(message_pipe.is_valid()); |
| 730 MojoShellConnectionImpl::CreateWithMessagePipe(message_pipe.Pass()); | 731 MojoShellConnectionImpl::CreateWithMessagePipe(message_pipe.Pass()); |
| 731 #endif // defined(MOJO_SHELL_CLIENT) | 732 #endif // defined(MOJO_SHELL_CLIENT) |
| 732 } | 733 } |
| 733 | 734 |
| 734 #if defined(OS_WIN) | |
| 735 void ChildThreadImpl::OnSetMojoParentPipeHandle( | 735 void ChildThreadImpl::OnSetMojoParentPipeHandle( |
| 736 const IPC::PlatformFileForTransit& file) { | 736 const IPC::PlatformFileForTransit& file) { |
| 737 mojo::embedder::SetParentPipeHandle(file); | 737 mojo::embedder::SetParentPipeHandle( |
| 738 mojo::embedder::ScopedPlatformHandle(mojo::embedder::PlatformHandle( |
| 739 IPC::PlatformFileForTransitToPlatformFile(file)))); |
| 738 } | 740 } |
| 739 #endif | |
| 740 | 741 |
| 741 ChildThreadImpl* ChildThreadImpl::current() { | 742 ChildThreadImpl* ChildThreadImpl::current() { |
| 742 return g_lazy_tls.Pointer()->Get(); | 743 return g_lazy_tls.Pointer()->Get(); |
| 743 } | 744 } |
| 744 | 745 |
| 745 #if defined(OS_ANDROID) | 746 #if defined(OS_ANDROID) |
| 746 // The method must NOT be called on the child thread itself. | 747 // The method must NOT be called on the child thread itself. |
| 747 // It may block the child thread if so. | 748 // It may block the child thread if so. |
| 748 void ChildThreadImpl::ShutdownThread() { | 749 void ChildThreadImpl::ShutdownThread() { |
| 749 DCHECK(!ChildThreadImpl::current()) << | 750 DCHECK(!ChildThreadImpl::current()) << |
| (...skipping 20 matching lines...) Expand all Loading... |
| 770 void ChildThreadImpl::EnsureConnected() { | 771 void ChildThreadImpl::EnsureConnected() { |
| 771 VLOG(0) << "ChildThreadImpl::EnsureConnected()"; | 772 VLOG(0) << "ChildThreadImpl::EnsureConnected()"; |
| 772 base::Process::Current().Terminate(0, false); | 773 base::Process::Current().Terminate(0, false); |
| 773 } | 774 } |
| 774 | 775 |
| 775 bool ChildThreadImpl::IsInBrowserProcess() const { | 776 bool ChildThreadImpl::IsInBrowserProcess() const { |
| 776 return browser_process_io_runner_; | 777 return browser_process_io_runner_; |
| 777 } | 778 } |
| 778 | 779 |
| 779 } // namespace content | 780 } // namespace content |
| OLD | NEW |