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

Side by Side Diff: chrome/common/service_process_util.cc

Issue 8585002: Give base::SharedMemory::CreateAnonymous an executable flag (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 1 month 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 | Annotate | Revision Log
OLDNEW
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
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
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 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698