| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/file_util.h" | 8 #include "base/file_util.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/memory/singleton.h" | 10 #include "base/memory/singleton.h" |
| (...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 220 return false; | 220 return false; |
| 221 } | 221 } |
| 222 | 222 |
| 223 scoped_ptr<base::SharedMemory> shared_mem_service_data( | 223 scoped_ptr<base::SharedMemory> shared_mem_service_data( |
| 224 new base::SharedMemory()); | 224 new base::SharedMemory()); |
| 225 if (!shared_mem_service_data.get()) | 225 if (!shared_mem_service_data.get()) |
| 226 return false; | 226 return false; |
| 227 | 227 |
| 228 uint32 alloc_size = sizeof(ServiceProcessSharedData); | 228 uint32 alloc_size = sizeof(ServiceProcessSharedData); |
| 229 if (!shared_mem_service_data->CreateNamed(GetServiceProcessSharedMemName(), | 229 if (!shared_mem_service_data->CreateNamed(GetServiceProcessSharedMemName(), |
| 230 true, alloc_size)) | 230 true, alloc_size, false)) |
| 231 return false; | 231 return false; |
| 232 | 232 |
| 233 if (!shared_mem_service_data->Map(alloc_size)) | 233 if (!shared_mem_service_data->Map(alloc_size)) |
| 234 return false; | 234 return false; |
| 235 | 235 |
| 236 memset(shared_mem_service_data->memory(), 0, alloc_size); | 236 memset(shared_mem_service_data->memory(), 0, alloc_size); |
| 237 ServiceProcessSharedData* shared_data = | 237 ServiceProcessSharedData* shared_data = |
| 238 reinterpret_cast<ServiceProcessSharedData*>( | 238 reinterpret_cast<ServiceProcessSharedData*>( |
| 239 shared_mem_service_data->memory()); | 239 shared_mem_service_data->memory()); |
| 240 memcpy(shared_data->service_process_version, version_info.Version().c_str(), | 240 memcpy(shared_data->service_process_version, version_info.Version().c_str(), |
| (...skipping 19 matching lines...) Expand all Loading... |
| 260 | 260 |
| 261 // The user data directory is the only other flag we currently want to | 261 // The user data directory is the only other flag we currently want to |
| 262 // possibly store. | 262 // possibly store. |
| 263 const CommandLine& browser_command_line = *CommandLine::ForCurrentProcess(); | 263 const CommandLine& browser_command_line = *CommandLine::ForCurrentProcess(); |
| 264 FilePath user_data_dir = | 264 FilePath user_data_dir = |
| 265 browser_command_line.GetSwitchValuePath(switches::kUserDataDir); | 265 browser_command_line.GetSwitchValuePath(switches::kUserDataDir); |
| 266 if (!user_data_dir.empty()) | 266 if (!user_data_dir.empty()) |
| 267 autorun_command_line_->AppendSwitchPath(switches::kUserDataDir, | 267 autorun_command_line_->AppendSwitchPath(switches::kUserDataDir, |
| 268 user_data_dir); | 268 user_data_dir); |
| 269 } | 269 } |
| OLD | NEW |