| 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 <algorithm> | 5 #include <algorithm> |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/memory/singleton.h" | 9 #include "base/memory/singleton.h" |
| 10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
| (...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 216 kMaxVersionStringLength; | 216 kMaxVersionStringLength; |
| 217 return false; | 217 return false; |
| 218 } | 218 } |
| 219 | 219 |
| 220 scoped_ptr<base::SharedMemory> shared_mem_service_data( | 220 scoped_ptr<base::SharedMemory> shared_mem_service_data( |
| 221 new base::SharedMemory()); | 221 new base::SharedMemory()); |
| 222 if (!shared_mem_service_data.get()) | 222 if (!shared_mem_service_data.get()) |
| 223 return false; | 223 return false; |
| 224 | 224 |
| 225 uint32 alloc_size = sizeof(ServiceProcessSharedData); | 225 uint32 alloc_size = sizeof(ServiceProcessSharedData); |
| 226 if (!shared_mem_service_data->CreateNamed(GetServiceProcessSharedMemName(), | 226 // TODO(viettrungluu): Named shared memory is deprecated (crbug.com/345734). |
| 227 true, alloc_size)) | 227 if (!shared_mem_service_data->CreateNamedDeprecated |
| 228 (GetServiceProcessSharedMemName(), true, alloc_size)) |
| 228 return false; | 229 return false; |
| 229 | 230 |
| 230 if (!shared_mem_service_data->Map(alloc_size)) | 231 if (!shared_mem_service_data->Map(alloc_size)) |
| 231 return false; | 232 return false; |
| 232 | 233 |
| 233 memset(shared_mem_service_data->memory(), 0, alloc_size); | 234 memset(shared_mem_service_data->memory(), 0, alloc_size); |
| 234 ServiceProcessSharedData* shared_data = | 235 ServiceProcessSharedData* shared_data = |
| 235 reinterpret_cast<ServiceProcessSharedData*>( | 236 reinterpret_cast<ServiceProcessSharedData*>( |
| 236 shared_mem_service_data->memory()); | 237 shared_mem_service_data->memory()); |
| 237 memcpy(shared_data->service_process_version, version_info.Version().c_str(), | 238 memcpy(shared_data->service_process_version, version_info.Version().c_str(), |
| (...skipping 19 matching lines...) Expand all Loading... |
| 257 | 258 |
| 258 // The user data directory is the only other flag we currently want to | 259 // The user data directory is the only other flag we currently want to |
| 259 // possibly store. | 260 // possibly store. |
| 260 const CommandLine& browser_command_line = *CommandLine::ForCurrentProcess(); | 261 const CommandLine& browser_command_line = *CommandLine::ForCurrentProcess(); |
| 261 base::FilePath user_data_dir = | 262 base::FilePath user_data_dir = |
| 262 browser_command_line.GetSwitchValuePath(switches::kUserDataDir); | 263 browser_command_line.GetSwitchValuePath(switches::kUserDataDir); |
| 263 if (!user_data_dir.empty()) | 264 if (!user_data_dir.empty()) |
| 264 autorun_command_line_->AppendSwitchPath(switches::kUserDataDir, | 265 autorun_command_line_->AppendSwitchPath(switches::kUserDataDir, |
| 265 user_data_dir); | 266 user_data_dir); |
| 266 } | 267 } |
| OLD | NEW |