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

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

Issue 2009033002: Revert of [mojo] Use a pipe path to initialise Mojo in elevated utility processes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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/utility_process_host_impl_browsertest.cc ('k') | mojo/edk/embedder/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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 #include "ipc/attachment_broker.h" 59 #include "ipc/attachment_broker.h"
60 #include "ipc/attachment_broker_unprivileged.h" 60 #include "ipc/attachment_broker_unprivileged.h"
61 #include "ipc/ipc_logging.h" 61 #include "ipc/ipc_logging.h"
62 #include "ipc/ipc_platform_file.h" 62 #include "ipc/ipc_platform_file.h"
63 #include "ipc/ipc_switches.h" 63 #include "ipc/ipc_switches.h"
64 #include "ipc/ipc_sync_channel.h" 64 #include "ipc/ipc_sync_channel.h"
65 #include "ipc/ipc_sync_message_filter.h" 65 #include "ipc/ipc_sync_message_filter.h"
66 #include "ipc/mojo/ipc_channel_mojo.h" 66 #include "ipc/mojo/ipc_channel_mojo.h"
67 #include "ipc/mojo/scoped_ipc_support.h" 67 #include "ipc/mojo/scoped_ipc_support.h"
68 #include "mojo/edk/embedder/embedder.h" 68 #include "mojo/edk/embedder/embedder.h"
69 #include "mojo/edk/embedder/named_platform_channel_pair.h"
70 #include "mojo/edk/embedder/platform_channel_pair.h" 69 #include "mojo/edk/embedder/platform_channel_pair.h"
71 70
72 #if defined(OS_POSIX) 71 #if defined(OS_POSIX)
73 #include "base/posix/global_descriptors.h" 72 #include "base/posix/global_descriptors.h"
74 #include "content/public/common/content_descriptors.h" 73 #include "content/public/common/content_descriptors.h"
75 #endif 74 #endif
76 75
77 using tracked_objects::ThreadData; 76 using tracked_objects::ThreadData;
78 77
79 namespace content { 78 namespace content {
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
222 221
223 closure_.Run(); 222 closure_.Run();
224 } 223 }
225 224
226 base::LazyInstance<QuitClosure> g_quit_closure = LAZY_INSTANCE_INITIALIZER; 225 base::LazyInstance<QuitClosure> g_quit_closure = LAZY_INSTANCE_INITIALIZER;
227 #endif 226 #endif
228 227
229 void InitializeMojoIPCChannel() { 228 void InitializeMojoIPCChannel() {
230 mojo::edk::ScopedPlatformHandle platform_channel; 229 mojo::edk::ScopedPlatformHandle platform_channel;
231 #if defined(OS_WIN) 230 #if defined(OS_WIN)
232 if (base::CommandLine::ForCurrentProcess()->HasSwitch( 231 platform_channel =
233 mojo::edk::PlatformChannelPair::kMojoPlatformChannelHandleSwitch)) { 232 mojo::edk::PlatformChannelPair::PassClientHandleFromParentProcess(
234 platform_channel = 233 *base::CommandLine::ForCurrentProcess());
235 mojo::edk::PlatformChannelPair::PassClientHandleFromParentProcess(
236 *base::CommandLine::ForCurrentProcess());
237 } else {
238 // If this process is elevated, it will have a pipe path passed on the
239 // command line.
240 platform_channel =
241 mojo::edk::NamedPlatformChannelPair::PassClientHandleFromParentProcess(
242 *base::CommandLine::ForCurrentProcess());
243 }
244 #elif defined(OS_POSIX) 234 #elif defined(OS_POSIX)
245 platform_channel.reset(mojo::edk::PlatformHandle( 235 platform_channel.reset(mojo::edk::PlatformHandle(
246 base::GlobalDescriptors::GetInstance()->Get(kMojoIPCChannel))); 236 base::GlobalDescriptors::GetInstance()->Get(kMojoIPCChannel)));
247 #endif 237 #endif
248 // Mojo isn't supported on all child process types. 238 // Mojo isn't supported on all child process types.
249 // TODO(crbug.com/604282): Support Mojo in the remaining processes. 239 // TODO(crbug.com/604282): Support Mojo in the remaining processes.
250 if (!platform_channel.is_valid()) 240 if (!platform_channel.is_valid())
251 return; 241 return;
252 mojo::edk::SetParentPipeHandle(std::move(platform_channel)); 242 mojo::edk::SetParentPipeHandle(std::move(platform_channel));
253 } 243 }
(...skipping 489 matching lines...) Expand 10 before | Expand all | Expand 10 after
743 void ChildThreadImpl::EnsureConnected() { 733 void ChildThreadImpl::EnsureConnected() {
744 VLOG(0) << "ChildThreadImpl::EnsureConnected()"; 734 VLOG(0) << "ChildThreadImpl::EnsureConnected()";
745 base::Process::Current().Terminate(0, false); 735 base::Process::Current().Terminate(0, false);
746 } 736 }
747 737
748 bool ChildThreadImpl::IsInBrowserProcess() const { 738 bool ChildThreadImpl::IsInBrowserProcess() const {
749 return static_cast<bool>(browser_process_io_runner_); 739 return static_cast<bool>(browser_process_io_runner_);
750 } 740 }
751 741
752 } // namespace content 742 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/utility_process_host_impl_browsertest.cc ('k') | mojo/edk/embedder/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698