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

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

Issue 105823009: Revert 239280 "Move more file_util functions to base namespace." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 7 years 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 | « trunk/src/base/files/file_util_proxy_unittest.cc ('k') | trunk/src/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 246 matching lines...) Expand 10 before | Expand all | Expand 10 after
257 } 257 }
258 258
259 bool SharedMemory::Open(const std::string& name, bool read_only) { 259 bool SharedMemory::Open(const std::string& name, bool read_only) {
260 FilePath path; 260 FilePath path;
261 if (!FilePathForMemoryName(name, &path)) 261 if (!FilePathForMemoryName(name, &path))
262 return false; 262 return false;
263 263
264 read_only_ = read_only; 264 read_only_ = read_only;
265 265
266 const char *mode = read_only ? "r" : "r+"; 266 const char *mode = read_only ? "r" : "r+";
267 ScopedFILE fp(base::OpenFile(path, mode)); 267 ScopedFILE fp(file_util::OpenFile(path, mode));
268 int readonly_fd_storage = -1; 268 int readonly_fd_storage = -1;
269 ScopedFD readonly_fd(&readonly_fd_storage); 269 ScopedFD readonly_fd(&readonly_fd_storage);
270 *readonly_fd = HANDLE_EINTR(open(path.value().c_str(), O_RDONLY)); 270 *readonly_fd = HANDLE_EINTR(open(path.value().c_str(), O_RDONLY));
271 if (*readonly_fd < 0) { 271 if (*readonly_fd < 0) {
272 DPLOG(ERROR) << "open(\"" << path.value() << "\", O_RDONLY) failed"; 272 DPLOG(ERROR) << "open(\"" << path.value() << "\", O_RDONLY) failed";
273 } 273 }
274 return PrepareMapFile(fp.Pass(), readonly_fd.Pass()); 274 return PrepareMapFile(fp.Pass(), readonly_fd.Pass());
275 } 275 }
276 276
277 #endif // !defined(OS_ANDROID) 277 #endif // !defined(OS_ANDROID)
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
459 new_handle->fd = new_fd; 459 new_handle->fd = new_fd;
460 new_handle->auto_close = true; 460 new_handle->auto_close = true;
461 461
462 if (close_self) 462 if (close_self)
463 Close(); 463 Close();
464 464
465 return true; 465 return true;
466 } 466 }
467 467
468 } // namespace base 468 } // namespace base
OLDNEW
« no previous file with comments | « trunk/src/base/files/file_util_proxy_unittest.cc ('k') | trunk/src/base/nix/mime_util_xdg.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698