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

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: Created 4 years, 9 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
« no previous file with comments | « content/browser/renderer_host/render_process_host_impl.cc ('k') | content/common/BUILD.gn » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 590 matching lines...) Expand 10 before | Expand all | Expand 10 after
675 Send( 672 Send(
676 new ChildProcessHostMsg_ChildProfilerData(sequence_number, process_data)); 673 new ChildProcessHostMsg_ChildProfilerData(sequence_number, process_data));
677 } 674 }
678 675
679 void ChildThreadImpl::OnProfilingPhaseCompleted(int profiling_phase) { 676 void ChildThreadImpl::OnProfilingPhaseCompleted(int profiling_phase) {
680 ThreadData::OnProfilingPhaseCompleted(profiling_phase); 677 ThreadData::OnProfilingPhaseCompleted(profiling_phase);
681 } 678 }
682 679
683 void ChildThreadImpl::OnBindExternalMojoShellHandle( 680 void ChildThreadImpl::OnBindExternalMojoShellHandle(
684 const IPC::PlatformFileForTransit& file) { 681 const IPC::PlatformFileForTransit& file) {
685 #if defined(MOJO_SHELL_CLIENT) 682 if (!MojoShellConnectionImpl::Get())
683 return;
686 #if defined(OS_POSIX) 684 #if defined(OS_POSIX)
687 base::PlatformFile handle = file.fd; 685 base::PlatformFile handle = file.fd;
688 #elif defined(OS_WIN) 686 #elif defined(OS_WIN)
689 base::PlatformFile handle = file; 687 base::PlatformFile handle = file;
690 #endif 688 #endif
691 mojo::ScopedMessagePipeHandle pipe = 689 mojo::ScopedMessagePipeHandle pipe =
692 mojo_shell_channel_init_.Init(handle, GetIOTaskRunner()); 690 mojo_shell_channel_init_.Init(handle, GetIOTaskRunner());
693 MojoShellConnectionImpl::Get()->BindToMessagePipe(std::move(pipe)); 691 MojoShellConnectionImpl::Get()->BindToMessagePipe(std::move(pipe));
694 #endif // defined(MOJO_SHELL_CLIENT)
695 } 692 }
696 693
697 void ChildThreadImpl::OnSetMojoParentPipeHandle( 694 void ChildThreadImpl::OnSetMojoParentPipeHandle(
698 const IPC::PlatformFileForTransit& file) { 695 const IPC::PlatformFileForTransit& file) {
699 mojo::edk::SetParentPipeHandle( 696 mojo::edk::SetParentPipeHandle(
700 mojo::edk::ScopedPlatformHandle(mojo::edk::PlatformHandle( 697 mojo::edk::ScopedPlatformHandle(mojo::edk::PlatformHandle(
701 IPC::PlatformFileForTransitToPlatformFile(file)))); 698 IPC::PlatformFileForTransitToPlatformFile(file))));
702 } 699 }
703 700
704 ChildThreadImpl* ChildThreadImpl::current() { 701 ChildThreadImpl* ChildThreadImpl::current() {
(...skipping 26 matching lines...) Expand all
731 void ChildThreadImpl::EnsureConnected() { 728 void ChildThreadImpl::EnsureConnected() {
732 VLOG(0) << "ChildThreadImpl::EnsureConnected()"; 729 VLOG(0) << "ChildThreadImpl::EnsureConnected()";
733 base::Process::Current().Terminate(0, false); 730 base::Process::Current().Terminate(0, false);
734 } 731 }
735 732
736 bool ChildThreadImpl::IsInBrowserProcess() const { 733 bool ChildThreadImpl::IsInBrowserProcess() const {
737 return browser_process_io_runner_; 734 return browser_process_io_runner_;
738 } 735 }
739 736
740 } // namespace content 737 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/renderer_host/render_process_host_impl.cc ('k') | content/common/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698