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

Side by Side Diff: content/child/child_thread_impl.cc

Issue 1738663002: Hook embedded shell up to MojoShellConnection (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: self review Created 4 years, 10 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
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/child/child_thread_impl.h" 5 #include "content/child/child_thread_impl.h"
6 6
7 #include <signal.h> 7 #include <signal.h>
8 #include <string> 8 #include <string>
9 #include <utility> 9 #include <utility>
10 10
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 #include "content/child/push_messaging/push_dispatcher.h" 46 #include "content/child/push_messaging/push_dispatcher.h"
47 #include "content/child/quota_dispatcher.h" 47 #include "content/child/quota_dispatcher.h"
48 #include "content/child/quota_message_filter.h" 48 #include "content/child/quota_message_filter.h"
49 #include "content/child/resource_dispatcher.h" 49 #include "content/child/resource_dispatcher.h"
50 #include "content/child/service_worker/service_worker_message_filter.h" 50 #include "content/child/service_worker/service_worker_message_filter.h"
51 #include "content/child/thread_safe_sender.h" 51 #include "content/child/thread_safe_sender.h"
52 #include "content/child/websocket_dispatcher.h" 52 #include "content/child/websocket_dispatcher.h"
53 #include "content/common/child_process_messages.h" 53 #include "content/common/child_process_messages.h"
54 #include "content/common/in_process_child_thread_params.h" 54 #include "content/common/in_process_child_thread_params.h"
55 #include "content/common/mojo/mojo_messages.h" 55 #include "content/common/mojo/mojo_messages.h"
56 #include "content/common/mojo/mojo_shell_connection_impl.h"
56 #include "content/public/common/content_switches.h" 57 #include "content/public/common/content_switches.h"
57 #include "ipc/attachment_broker.h" 58 #include "ipc/attachment_broker.h"
58 #include "ipc/attachment_broker_unprivileged.h" 59 #include "ipc/attachment_broker_unprivileged.h"
59 #include "ipc/ipc_logging.h" 60 #include "ipc/ipc_logging.h"
60 #include "ipc/ipc_platform_file.h" 61 #include "ipc/ipc_platform_file.h"
61 #include "ipc/ipc_switches.h" 62 #include "ipc/ipc_switches.h"
62 #include "ipc/ipc_sync_channel.h" 63 #include "ipc/ipc_sync_channel.h"
63 #include "ipc/ipc_sync_message_filter.h" 64 #include "ipc/ipc_sync_message_filter.h"
64 #include "ipc/mojo/ipc_channel_mojo.h" 65 #include "ipc/mojo/ipc_channel_mojo.h"
65 #include "mojo/edk/embedder/embedder.h" 66 #include "mojo/edk/embedder/embedder.h"
66 67
67 #if defined(USE_OZONE) 68 #if defined(USE_OZONE)
68 #include "ui/ozone/public/client_native_pixmap_factory.h" 69 #include "ui/ozone/public/client_native_pixmap_factory.h"
69 #endif 70 #endif
70 71
71 #if defined(MOJO_SHELL_CLIENT)
72 #include "content/common/mojo/mojo_shell_connection_impl.h"
73 #endif
74
75 using tracked_objects::ThreadData; 72 using tracked_objects::ThreadData;
76 73
77 namespace content { 74 namespace content {
78 namespace { 75 namespace {
79 76
80 // How long to wait for a connection to the browser process before giving up. 77 // How long to wait for a connection to the browser process before giving up.
81 const int kConnectionTimeoutS = 15; 78 const int kConnectionTimeoutS = 15;
82 79
83 base::LazyInstance<base::ThreadLocalPointer<ChildThreadImpl> > g_lazy_tls = 80 base::LazyInstance<base::ThreadLocalPointer<ChildThreadImpl> > g_lazy_tls =
84 LAZY_INSTANCE_INITIALIZER; 81 LAZY_INSTANCE_INITIALIZER;
(...skipping 580 matching lines...) Expand 10 before | Expand all | Expand 10 after
665 Send( 662 Send(
666 new ChildProcessHostMsg_ChildProfilerData(sequence_number, process_data)); 663 new ChildProcessHostMsg_ChildProfilerData(sequence_number, process_data));
667 } 664 }
668 665
669 void ChildThreadImpl::OnProfilingPhaseCompleted(int profiling_phase) { 666 void ChildThreadImpl::OnProfilingPhaseCompleted(int profiling_phase) {
670 ThreadData::OnProfilingPhaseCompleted(profiling_phase); 667 ThreadData::OnProfilingPhaseCompleted(profiling_phase);
671 } 668 }
672 669
673 void ChildThreadImpl::OnBindExternalMojoShellHandle( 670 void ChildThreadImpl::OnBindExternalMojoShellHandle(
674 const IPC::PlatformFileForTransit& file) { 671 const IPC::PlatformFileForTransit& file) {
675 #if defined(MOJO_SHELL_CLIENT) 672 if (!MojoShellConnectionImpl::Get())
673 return;
676 #if defined(OS_POSIX) 674 #if defined(OS_POSIX)
677 base::PlatformFile handle = file.fd; 675 base::PlatformFile handle = file.fd;
678 #elif defined(OS_WIN) 676 #elif defined(OS_WIN)
679 base::PlatformFile handle = file; 677 base::PlatformFile handle = file;
680 #endif 678 #endif
681 mojo::ScopedMessagePipeHandle pipe = 679 mojo::ScopedMessagePipeHandle pipe =
682 mojo_shell_channel_init_.Init(handle, GetIOTaskRunner()); 680 mojo_shell_channel_init_.Init(handle, GetIOTaskRunner());
683 MojoShellConnectionImpl::Get()->BindToMessagePipe(std::move(pipe)); 681 MojoShellConnectionImpl::Get()->BindToMessagePipe(std::move(pipe));
684 #endif // defined(MOJO_SHELL_CLIENT)
685 } 682 }
686 683
687 void ChildThreadImpl::OnSetMojoParentPipeHandle( 684 void ChildThreadImpl::OnSetMojoParentPipeHandle(
688 const IPC::PlatformFileForTransit& file) { 685 const IPC::PlatformFileForTransit& file) {
689 mojo::edk::SetParentPipeHandle( 686 mojo::edk::SetParentPipeHandle(
690 mojo::edk::ScopedPlatformHandle(mojo::edk::PlatformHandle( 687 mojo::edk::ScopedPlatformHandle(mojo::edk::PlatformHandle(
691 IPC::PlatformFileForTransitToPlatformFile(file)))); 688 IPC::PlatformFileForTransitToPlatformFile(file))));
692 } 689 }
693 690
694 ChildThreadImpl* ChildThreadImpl::current() { 691 ChildThreadImpl* ChildThreadImpl::current() {
(...skipping 26 matching lines...) Expand all
721 void ChildThreadImpl::EnsureConnected() { 718 void ChildThreadImpl::EnsureConnected() {
722 VLOG(0) << "ChildThreadImpl::EnsureConnected()"; 719 VLOG(0) << "ChildThreadImpl::EnsureConnected()";
723 base::Process::Current().Terminate(0, false); 720 base::Process::Current().Terminate(0, false);
724 } 721 }
725 722
726 bool ChildThreadImpl::IsInBrowserProcess() const { 723 bool ChildThreadImpl::IsInBrowserProcess() const {
727 return browser_process_io_runner_; 724 return browser_process_io_runner_;
728 } 725 }
729 726
730 } // namespace content 727 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698