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

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

Issue 93263002: Move some more file utils to the base namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
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 | « base/files/scoped_temp_dir_unittest.cc ('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 381 matching lines...) Expand 10 before | Expand all | Expand 10 after
392 // (and possibly create). Modifies |filename|. Return false on 392 // (and possibly create). Modifies |filename|. Return false on
393 // error, or true of we are happy. 393 // error, or true of we are happy.
394 bool SharedMemory::FilePathForMemoryName(const std::string& mem_name, 394 bool SharedMemory::FilePathForMemoryName(const std::string& mem_name,
395 FilePath* path) { 395 FilePath* path) {
396 // mem_name will be used for a filename; make sure it doesn't 396 // mem_name will be used for a filename; make sure it doesn't
397 // contain anything which will confuse us. 397 // contain anything which will confuse us.
398 DCHECK_EQ(std::string::npos, mem_name.find('/')); 398 DCHECK_EQ(std::string::npos, mem_name.find('/'));
399 DCHECK_EQ(std::string::npos, mem_name.find('\0')); 399 DCHECK_EQ(std::string::npos, mem_name.find('\0'));
400 400
401 FilePath temp_dir; 401 FilePath temp_dir;
402 if (!file_util::GetShmemTempDir(&temp_dir, false)) 402 if (!GetShmemTempDir(false, &temp_dir))
403 return false; 403 return false;
404 404
405 #if !defined(OS_MACOSX) 405 #if !defined(OS_MACOSX)
406 #if defined(GOOGLE_CHROME_BUILD) 406 #if defined(GOOGLE_CHROME_BUILD)
407 std::string name_base = std::string("com.google.Chrome"); 407 std::string name_base = std::string("com.google.Chrome");
408 #else 408 #else
409 std::string name_base = std::string("org.chromium.Chromium"); 409 std::string name_base = std::string("org.chromium.Chromium");
410 #endif 410 #endif
411 #else // OS_MACOSX 411 #else // OS_MACOSX
412 std::string name_base = std::string(base::mac::BaseBundleID()); 412 std::string name_base = std::string(base::mac::BaseBundleID());
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
460 new_handle->fd = new_fd; 460 new_handle->fd = new_fd;
461 new_handle->auto_close = true; 461 new_handle->auto_close = true;
462 462
463 if (close_self) 463 if (close_self)
464 Close(); 464 Close();
465 465
466 return true; 466 return true;
467 } 467 }
468 468
469 } // namespace base 469 } // namespace base
OLDNEW
« no previous file with comments | « base/files/scoped_temp_dir_unittest.cc ('k') | base/nix/mime_util_xdg.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698