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

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

Issue 186473002: Deprecate named base::SharedMemory. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix win Created 6 years, 9 months 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
« no previous file with comments | « base/metrics/stats_table.cc ('k') | content/child/resource_dispatcher_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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 }
OLDNEW
« no previous file with comments | « base/metrics/stats_table.cc ('k') | content/child/resource_dispatcher_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698