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

Side by Side Diff: base/memory/shared_memory_posix.cc

Issue 16950028: Move file_util::Delete to the base namespace (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 5 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/json/json_value_serializer_unittest.cc ('k') | base/prefs/json_pref_store_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 "base/memory/shared_memory.h" 5 #include "base/memory/shared_memory.h"
6 6
7 #include <errno.h> 7 #include <errno.h>
8 #include <fcntl.h> 8 #include <fcntl.h>
9 #include <sys/mman.h> 9 #include <sys/mman.h>
10 #include <sys/stat.h> 10 #include <sys/stat.h>
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
194 194
195 // Our current implementation of shmem is with mmap()ing of files. 195 // Our current implementation of shmem is with mmap()ing of files.
196 // These files need to be deleted explicitly. 196 // These files need to be deleted explicitly.
197 // In practice this call is only needed for unit tests. 197 // In practice this call is only needed for unit tests.
198 bool SharedMemory::Delete(const std::string& name) { 198 bool SharedMemory::Delete(const std::string& name) {
199 FilePath path; 199 FilePath path;
200 if (!FilePathForMemoryName(name, &path)) 200 if (!FilePathForMemoryName(name, &path))
201 return false; 201 return false;
202 202
203 if (file_util::PathExists(path)) { 203 if (file_util::PathExists(path)) {
204 return file_util::Delete(path, false); 204 return base::Delete(path, false);
205 } 205 }
206 206
207 // Doesn't exist, so success. 207 // Doesn't exist, so success.
208 return true; 208 return true;
209 } 209 }
210 210
211 bool SharedMemory::Open(const std::string& name, bool read_only) { 211 bool SharedMemory::Open(const std::string& name, bool read_only) {
212 FilePath path; 212 FilePath path;
213 if (!FilePathForMemoryName(name, &path)) 213 if (!FilePathForMemoryName(name, &path))
214 return false; 214 return false;
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
379 new_handle->fd = new_fd; 379 new_handle->fd = new_fd;
380 new_handle->auto_close = true; 380 new_handle->auto_close = true;
381 381
382 if (close_self) 382 if (close_self)
383 Close(); 383 Close();
384 384
385 return true; 385 return true;
386 } 386 }
387 387
388 } // namespace base 388 } // namespace base
OLDNEW
« no previous file with comments | « base/json/json_value_serializer_unittest.cc ('k') | base/prefs/json_pref_store_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698