OLD | NEW |
---|---|
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/common/child_process_host_impl.h" | 5 #include "content/common/child_process_host_impl.h" |
6 | 6 |
7 #include <limits> | 7 #include <limits> |
8 | 8 |
9 #include "base/atomic_sequence_num.h" | 9 #include "base/atomic_sequence_num.h" |
10 #include "base/base_switches.h" | |
10 #include "base/command_line.h" | 11 #include "base/command_line.h" |
12 #include "base/feature_list.h" | |
11 #include "base/files/file_path.h" | 13 #include "base/files/file_path.h" |
12 #include "base/hash.h" | 14 #include "base/hash.h" |
13 #include "base/logging.h" | 15 #include "base/logging.h" |
14 #include "base/message_loop/message_loop.h" | 16 #include "base/message_loop/message_loop.h" |
17 #include "base/metrics/field_trial.h" | |
15 #include "base/metrics/histogram.h" | 18 #include "base/metrics/histogram.h" |
16 #include "base/numerics/safe_math.h" | 19 #include "base/numerics/safe_math.h" |
17 #include "base/path_service.h" | 20 #include "base/path_service.h" |
18 #include "base/process/process_metrics.h" | 21 #include "base/process/process_metrics.h" |
19 #include "base/rand_util.h" | 22 #include "base/rand_util.h" |
20 #include "base/strings/stringprintf.h" | 23 #include "base/strings/stringprintf.h" |
21 #include "base/synchronization/lock.h" | 24 #include "base/synchronization/lock.h" |
22 #include "base/third_party/dynamic_annotations/dynamic_annotations.h" | 25 #include "base/third_party/dynamic_annotations/dynamic_annotations.h" |
23 #include "build/build_config.h" | 26 #include "build/build_config.h" |
24 #include "content/common/child_process_messages.h" | 27 #include "content/common/child_process_messages.h" |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
191 // places in the code a value of 0 (rather than kInvalidUniqueID) was used as | 194 // places in the code a value of 0 (rather than kInvalidUniqueID) was used as |
192 // an invalid value. So we retain those semantics. | 195 // an invalid value. So we retain those semantics. |
193 int id = g_unique_id.GetNext() + 1; | 196 int id = g_unique_id.GetNext() + 1; |
194 | 197 |
195 CHECK_NE(0, id); | 198 CHECK_NE(0, id); |
196 CHECK_NE(kInvalidUniqueID, id); | 199 CHECK_NE(kInvalidUniqueID, id); |
197 | 200 |
198 return id; | 201 return id; |
199 } | 202 } |
200 | 203 |
204 void ChildProcessHostImpl::CopyEnableDisableFeatureFlags( | |
Alexei Svitkine (slow)
2016/05/03 18:59:47
Nit: CopyFeatureAndFieldTrialFlags() since now thi
erikchen
2016/05/03 19:22:31
Done.
| |
205 base::CommandLine* cmd_line) { | |
206 std::string enabled_features; | |
207 std::string disabled_features; | |
208 base::FeatureList::GetInstance()->GetFeatureOverrides(&enabled_features, | |
209 &disabled_features); | |
210 if (!enabled_features.empty()) | |
211 cmd_line->AppendSwitchASCII(switches::kEnableFeatures, enabled_features); | |
212 if (!disabled_features.empty()) | |
213 cmd_line->AppendSwitchASCII(switches::kDisableFeatures, disabled_features); | |
214 | |
215 // If we run base::FieldTrials, we want to pass to their state to the | |
216 // child process so that it can act in accordance with each state, or record | |
217 // histograms relating to the base::FieldTrial states. | |
Alexei Svitkine (slow)
2016/05/03 18:59:47
Nit: I'd remove the ", or record histograms relati
erikchen
2016/05/03 19:22:31
Done.
| |
218 std::string field_trial_states; | |
219 base::FieldTrialList::AllStatesToString(&field_trial_states); | |
220 if (!field_trial_states.empty()) { | |
221 cmd_line->AppendSwitchASCII(switches::kForceFieldTrials, | |
222 field_trial_states); | |
223 } | |
224 } | |
225 | |
201 uint64_t ChildProcessHostImpl::ChildProcessUniqueIdToTracingProcessId( | 226 uint64_t ChildProcessHostImpl::ChildProcessUniqueIdToTracingProcessId( |
202 int child_process_id) { | 227 int child_process_id) { |
203 // In single process mode, all the children are hosted in the same process, | 228 // In single process mode, all the children are hosted in the same process, |
204 // therefore the generated memory dump guids should not be conditioned by the | 229 // therefore the generated memory dump guids should not be conditioned by the |
205 // child process id. The clients need not be aware of SPM and the conversion | 230 // child process id. The clients need not be aware of SPM and the conversion |
206 // takes care of the SPM special case while translating child process ids to | 231 // takes care of the SPM special case while translating child process ids to |
207 // tracing process ids. | 232 // tracing process ids. |
208 if (base::CommandLine::ForCurrentProcess()->HasSwitch( | 233 if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
209 switches::kSingleProcess)) | 234 switches::kSingleProcess)) |
210 return ChildProcessHost::kBrowserTracingProcessId; | 235 return ChildProcessHost::kBrowserTracingProcessId; |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
324 } | 349 } |
325 | 350 |
326 void ChildProcessHostImpl::OnDeletedGpuMemoryBuffer( | 351 void ChildProcessHostImpl::OnDeletedGpuMemoryBuffer( |
327 gfx::GpuMemoryBufferId id, | 352 gfx::GpuMemoryBufferId id, |
328 const gpu::SyncToken& sync_token) { | 353 const gpu::SyncToken& sync_token) { |
329 // Note: Nothing to do here as ownership of shared memory backed | 354 // Note: Nothing to do here as ownership of shared memory backed |
330 // GpuMemoryBuffers is passed with IPC. | 355 // GpuMemoryBuffers is passed with IPC. |
331 } | 356 } |
332 | 357 |
333 } // namespace content | 358 } // namespace content |
OLD | NEW |