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/command_line.h" | 10 #include "base/command_line.h" |
| 11 #include "base/feature_list.h" |
11 #include "base/files/file_path.h" | 12 #include "base/files/file_path.h" |
12 #include "base/hash.h" | 13 #include "base/hash.h" |
13 #include "base/logging.h" | 14 #include "base/logging.h" |
14 #include "base/message_loop/message_loop.h" | 15 #include "base/message_loop/message_loop.h" |
15 #include "base/metrics/histogram.h" | 16 #include "base/metrics/histogram.h" |
16 #include "base/numerics/safe_math.h" | 17 #include "base/numerics/safe_math.h" |
17 #include "base/path_service.h" | 18 #include "base/path_service.h" |
18 #include "base/process/process_metrics.h" | 19 #include "base/process/process_metrics.h" |
19 #include "base/rand_util.h" | 20 #include "base/rand_util.h" |
20 #include "base/strings/stringprintf.h" | 21 #include "base/strings/stringprintf.h" |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
196 // places in the code a value of 0 (rather than kInvalidUniqueID) was used as | 197 // places in the code a value of 0 (rather than kInvalidUniqueID) was used as |
197 // an invalid value. So we retain those semantics. | 198 // an invalid value. So we retain those semantics. |
198 int id = g_unique_id.GetNext() + 1; | 199 int id = g_unique_id.GetNext() + 1; |
199 | 200 |
200 CHECK_NE(0, id); | 201 CHECK_NE(0, id); |
201 CHECK_NE(kInvalidUniqueID, id); | 202 CHECK_NE(kInvalidUniqueID, id); |
202 | 203 |
203 return id; | 204 return id; |
204 } | 205 } |
205 | 206 |
| 207 void ChildProcessHostImpl::CopyEnableDisableFeatureFlags( |
| 208 base::CommandLine* cmd_line) { |
| 209 std::string enabled_features; |
| 210 std::string disabled_features; |
| 211 base::FeatureList::GetInstance()->GetFeatureOverrides(&enabled_features, |
| 212 &disabled_features); |
| 213 if (!enabled_features.empty()) |
| 214 cmd_line->AppendSwitchASCII(switches::kEnableFeatures, enabled_features); |
| 215 if (!disabled_features.empty()) |
| 216 cmd_line->AppendSwitchASCII(switches::kDisableFeatures, disabled_features); |
| 217 } |
| 218 |
206 uint64_t ChildProcessHostImpl::ChildProcessUniqueIdToTracingProcessId( | 219 uint64_t ChildProcessHostImpl::ChildProcessUniqueIdToTracingProcessId( |
207 int child_process_id) { | 220 int child_process_id) { |
208 // In single process mode, all the children are hosted in the same process, | 221 // In single process mode, all the children are hosted in the same process, |
209 // therefore the generated memory dump guids should not be conditioned by the | 222 // therefore the generated memory dump guids should not be conditioned by the |
210 // child process id. The clients need not be aware of SPM and the conversion | 223 // child process id. The clients need not be aware of SPM and the conversion |
211 // takes care of the SPM special case while translating child process ids to | 224 // takes care of the SPM special case while translating child process ids to |
212 // tracing process ids. | 225 // tracing process ids. |
213 if (base::CommandLine::ForCurrentProcess()->HasSwitch( | 226 if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
214 switches::kSingleProcess)) | 227 switches::kSingleProcess)) |
215 return ChildProcessHost::kBrowserTracingProcessId; | 228 return ChildProcessHost::kBrowserTracingProcessId; |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
329 } | 342 } |
330 | 343 |
331 void ChildProcessHostImpl::OnDeletedGpuMemoryBuffer( | 344 void ChildProcessHostImpl::OnDeletedGpuMemoryBuffer( |
332 gfx::GpuMemoryBufferId id, | 345 gfx::GpuMemoryBufferId id, |
333 const gpu::SyncToken& sync_token) { | 346 const gpu::SyncToken& sync_token) { |
334 // Note: Nothing to do here as ownership of shared memory backed | 347 // Note: Nothing to do here as ownership of shared memory backed |
335 // GpuMemoryBuffers is passed with IPC. | 348 // GpuMemoryBuffers is passed with IPC. |
336 } | 349 } |
337 | 350 |
338 } // namespace content | 351 } // namespace content |
OLD | NEW |