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

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

Issue 2862123002: Pass the GUID for the SharedMemoryHandle used by base::FieldTrialList. (Closed)
Patch Set: Pass string piece by value. Created 3 years, 7 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 | « base/metrics/field_trial_unittest.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "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
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
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
OLDNEW
« no previous file with comments | « base/metrics/field_trial_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698