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

Side by Side Diff: content/browser/child_process_launcher_helper_mac.cc

Issue 2684433003: Files required by a service now listed in manifest. (Closed)
Patch Set: Clean-up + Windows' build fix Created 3 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 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 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 "base/memory/ptr_util.h" 5 #include "base/memory/ptr_util.h"
6 #include "base/path_service.h"
6 #include "base/posix/global_descriptors.h" 7 #include "base/posix/global_descriptors.h"
7 #include "content/browser/bootstrap_sandbox_manager_mac.h" 8 #include "content/browser/bootstrap_sandbox_manager_mac.h"
8 #include "content/browser/child_process_launcher.h" 9 #include "content/browser/child_process_launcher.h"
9 #include "content/browser/child_process_launcher_helper.h" 10 #include "content/browser/child_process_launcher_helper.h"
10 #include "content/browser/child_process_launcher_helper_posix.h" 11 #include "content/browser/child_process_launcher_helper_posix.h"
11 #include "content/browser/mach_broker_mac.h" 12 #include "content/browser/mach_broker_mac.h"
12 #include "content/public/common/result_codes.h" 13 #include "content/public/common/result_codes.h"
13 #include "content/public/common/sandboxed_process_launcher_delegate.h" 14 #include "content/public/common/sandboxed_process_launcher_delegate.h"
14 #include "mojo/edk/embedder/scoped_platform_handle.h" 15 #include "mojo/edk/embedder/scoped_platform_handle.h"
15 #include "sandbox/mac/bootstrap_sandbox.h" 16 #include "sandbox/mac/bootstrap_sandbox.h"
16 #include "sandbox/mac/pre_exec_delegate.h" 17 #include "sandbox/mac/pre_exec_delegate.h"
17 18
18 namespace content { 19 namespace content {
19 namespace internal { 20 namespace internal {
20 21
21 mojo::edk::ScopedPlatformHandle 22 mojo::edk::ScopedPlatformHandle
22 ChildProcessLauncherHelper::PrepareMojoPipeHandlesOnClientThread() { 23 ChildProcessLauncherHelper::PrepareMojoPipeHandlesOnClientThread() {
23 DCHECK_CURRENTLY_ON(client_thread_id_); 24 DCHECK_CURRENTLY_ON(client_thread_id_);
24 return mojo::edk::ScopedPlatformHandle(); 25 return mojo::edk::ScopedPlatformHandle();
25 } 26 }
26 27
27 void ChildProcessLauncherHelper::BeforeLaunchOnClientThread() { 28 void ChildProcessLauncherHelper::BeforeLaunchOnClientThread() {
28 DCHECK_CURRENTLY_ON(client_thread_id_); 29 DCHECK_CURRENTLY_ON(client_thread_id_);
29 } 30 }
30 31
31 std::unique_ptr<FileDescriptorInfo> 32 std::unique_ptr<FileDescriptorInfo>
32 ChildProcessLauncherHelper::GetFilesToMap() { 33 ChildProcessLauncherHelper::GetFilesToMap() {
33 DCHECK_CURRENTLY_ON(BrowserThread::PROCESS_LAUNCHER); 34 DCHECK_CURRENTLY_ON(BrowserThread::PROCESS_LAUNCHER);
34 return CreateDefaultPosixFilesToMap(*command_line(), child_process_id(), 35 return CreateDefaultPosixFilesToMap(
35 mojo_client_handle()); 36 child_process_id(),
37 mojo_client_handle(),
38 false /* include_service_required_files */,
39 GetProcessType(),
40 command_line());
36 } 41 }
37 42
38 void ChildProcessLauncherHelper::BeforeLaunchOnLauncherThread( 43 void ChildProcessLauncherHelper::BeforeLaunchOnLauncherThread(
39 const FileMappedForLaunch& files_to_register, 44 const FileMappedForLaunch& files_to_register,
40 base::LaunchOptions* options) { 45 base::LaunchOptions* options) {
41 // Convert FD mapping to FileHandleMappingVector. 46 // Convert FD mapping to FileHandleMappingVector.
42 std::unique_ptr<base::FileHandleMappingVector> fds_to_map = 47 std::unique_ptr<base::FileHandleMappingVector> fds_to_map =
43 files_to_register.GetMappingWithIDAdjustment( 48 files_to_register.GetMappingWithIDAdjustment(
44 base::GlobalDescriptors::kBaseDescriptor); 49 base::GlobalDescriptors::kBaseDescriptor);
45 50
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 base::EnsureProcessTerminated(std::move(process.process)); 144 base::EnsureProcessTerminated(std::move(process.process));
140 } 145 }
141 146
142 // static 147 // static
143 void ChildProcessLauncherHelper::SetProcessBackgroundedOnLauncherThread( 148 void ChildProcessLauncherHelper::SetProcessBackgroundedOnLauncherThread(
144 base::Process process, bool background) { 149 base::Process process, bool background) {
145 if (process.CanBackgroundProcesses()) 150 if (process.CanBackgroundProcesses())
146 process.SetProcessBackgrounded(MachBroker::GetInstance(), background); 151 process.SetProcessBackgrounded(MachBroker::GetInstance(), background);
147 } 152 }
148 153
154 // static
155 void ChildProcessLauncherHelper::SetRegisteredFilesForService(
156 const std::string& service_name,
157 std::unique_ptr<catalog::RequiredFileMap> required_files) {
158 // No file passing from the manifest on Mac yet.
159 DCHECK(required_files->empty());
160 }
161
162 // static
163 base::File OpenFileToShare(const base::FilePath& path,
164 base::MemoryMappedFile::Region* region) {
165 // Not used yet (until required files are described in the service manifest on
166 // Mac).
167 NOTREACHED();
168 return base::File();
169 }
170
149 } // namespace internal 171 } // namespace internal
150 } // namespace content 172 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698