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

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

Issue 18286004: Move PathExists to 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/mac/mac_util_unittest.mm ('k') | base/nix/mime_util_xdg.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 218 matching lines...) Expand 10 before | Expand all | Expand 10 after
229 } 229 }
230 230
231 // Our current implementation of shmem is with mmap()ing of files. 231 // Our current implementation of shmem is with mmap()ing of files.
232 // These files need to be deleted explicitly. 232 // These files need to be deleted explicitly.
233 // In practice this call is only needed for unit tests. 233 // In practice this call is only needed for unit tests.
234 bool SharedMemory::Delete(const std::string& name) { 234 bool SharedMemory::Delete(const std::string& name) {
235 FilePath path; 235 FilePath path;
236 if (!FilePathForMemoryName(name, &path)) 236 if (!FilePathForMemoryName(name, &path))
237 return false; 237 return false;
238 238
239 if (file_util::PathExists(path)) { 239 if (PathExists(path))
240 return base::Delete(path, false); 240 return base::Delete(path, false);
241 }
242 241
243 // Doesn't exist, so success. 242 // Doesn't exist, so success.
244 return true; 243 return true;
245 } 244 }
246 245
247 bool SharedMemory::Open(const std::string& name, bool read_only) { 246 bool SharedMemory::Open(const std::string& name, bool read_only) {
248 FilePath path; 247 FilePath path;
249 if (!FilePathForMemoryName(name, &path)) 248 if (!FilePathForMemoryName(name, &path))
250 return false; 249 return false;
251 250
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
415 new_handle->fd = new_fd; 414 new_handle->fd = new_fd;
416 new_handle->auto_close = true; 415 new_handle->auto_close = true;
417 416
418 if (close_self) 417 if (close_self)
419 Close(); 418 Close();
420 419
421 return true; 420 return true;
422 } 421 }
423 422
424 } // namespace base 423 } // namespace base
OLDNEW
« no previous file with comments | « base/mac/mac_util_unittest.mm ('k') | base/nix/mime_util_xdg.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698