OLD | NEW |
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 "content/browser/child_process_launcher_helper_posix.h" | 5 #include "content/browser/child_process_launcher_helper_posix.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/metrics/field_trial.h" | 8 #include "base/metrics/field_trial.h" |
9 #include "base/posix/global_descriptors.h" | 9 #include "base/posix/global_descriptors.h" |
10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 | 73 |
74 std::unique_ptr<FileDescriptorInfo> CreateDefaultPosixFilesToMap( | 74 std::unique_ptr<FileDescriptorInfo> CreateDefaultPosixFilesToMap( |
75 int child_process_id, | 75 int child_process_id, |
76 const mojo::edk::PlatformHandle& mojo_client_handle, | 76 const mojo::edk::PlatformHandle& mojo_client_handle, |
77 bool include_service_required_files, | 77 bool include_service_required_files, |
78 const std::string& process_type, | 78 const std::string& process_type, |
79 base::CommandLine* command_line) { | 79 base::CommandLine* command_line) { |
80 std::unique_ptr<FileDescriptorInfo> files_to_register( | 80 std::unique_ptr<FileDescriptorInfo> files_to_register( |
81 FileDescriptorInfoImpl::Create()); | 81 FileDescriptorInfoImpl::Create()); |
82 | 82 |
83 int field_trial_handle = base::FieldTrialList::GetFieldTrialHandle(); | 83 base::SharedMemoryHandle shm = base::FieldTrialList::GetFieldTrialHandle(); |
84 if (field_trial_handle != base::kInvalidPlatformFile) | 84 if (shm.IsValid()) { |
85 files_to_register->Share(kFieldTrialDescriptor, field_trial_handle); | 85 files_to_register->Share( |
| 86 kFieldTrialDescriptor, |
| 87 base::SharedMemory::GetFdFromSharedMemoryHandle(shm)); |
| 88 } |
86 | 89 |
87 DCHECK(mojo_client_handle.is_valid()); | 90 DCHECK(mojo_client_handle.is_valid()); |
88 files_to_register->Share(kMojoIPCChannel, mojo_client_handle.handle); | 91 files_to_register->Share(kMojoIPCChannel, mojo_client_handle.handle); |
89 | 92 |
90 // TODO(jcivelli): remove this "if defined" by making | 93 // TODO(jcivelli): remove this "if defined" by making |
91 // GetAdditionalMappedFilesForChildProcess a no op on Mac. | 94 // GetAdditionalMappedFilesForChildProcess a no op on Mac. |
92 #if !defined(OS_MACOSX) | 95 #if !defined(OS_MACOSX) |
93 GetContentClient()->browser()->GetAdditionalMappedFilesForChildProcess( | 96 GetContentClient()->browser()->GetAdditionalMappedFilesForChildProcess( |
94 *command_line, child_process_id, files_to_register.get()); | 97 *command_line, child_process_id, files_to_register.get()); |
95 #endif | 98 #endif |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
141 DCHECK(GetRequiredFilesByServiceMap().count(service_name) == 0); | 144 DCHECK(GetRequiredFilesByServiceMap().count(service_name) == 0); |
142 GetRequiredFilesByServiceMap()[service_name] = std::move(required_files); | 145 GetRequiredFilesByServiceMap()[service_name] = std::move(required_files); |
143 } | 146 } |
144 | 147 |
145 void ResetFilesToShareForTestingPosix() { | 148 void ResetFilesToShareForTestingPosix() { |
146 GetRequiredFilesByServiceMap().clear(); | 149 GetRequiredFilesByServiceMap().clear(); |
147 } | 150 } |
148 | 151 |
149 } // namespace internal | 152 } // namespace internal |
150 } // namespace content | 153 } // namespace content |
OLD | NEW |