diff options
author | evan@chromium.org <evan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-09-29 20:32:22 +0000 |
---|---|---|
committer | evan@chromium.org <evan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-09-29 20:32:22 +0000 |
commit | b6413b49b4a1bf216bbc70cc330e905c42db5c5b (patch) | |
tree | 1ea76480a59217bd06dadcb071dad2d8150a6518 /base/shared_memory_posix.cc | |
parent | a6c642112b067d998e699e09302d8c48649b108f (diff) | |
download | chromium_src-b6413b49b4a1bf216bbc70cc330e905c42db5c5b.zip chromium_src-b6413b49b4a1bf216bbc70cc330e905c42db5c5b.tar.gz chromium_src-b6413b49b4a1bf216bbc70cc330e905c42db5c5b.tar.bz2 |
shared_memory: remove wstrings, fix callers.
BUG=23581
TEST=compiles
Review URL: http://codereview.chromium.org/3555002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@60985 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/shared_memory_posix.cc')
-rw-r--r-- | base/shared_memory_posix.cc | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/base/shared_memory_posix.cc b/base/shared_memory_posix.cc index 2dae8af..32b3dae7 100644 --- a/base/shared_memory_posix.cc +++ b/base/shared_memory_posix.cc @@ -77,7 +77,7 @@ void SharedMemory::CloseHandle(const SharedMemoryHandle& handle) { close(handle.fd); } -bool SharedMemory::Create(const std::wstring &name, bool read_only, +bool SharedMemory::Create(const std::string& name, bool read_only, bool open_existing, uint32 size) { read_only_ = read_only; @@ -96,7 +96,7 @@ bool SharedMemory::Create(const std::wstring &name, bool read_only, // Our current implementation of shmem is with mmap()ing of files. // These files need to be deleted explicitly. // In practice this call is only needed for unit tests. -bool SharedMemory::Delete(const std::wstring& name) { +bool SharedMemory::Delete(const std::string& name) { FilePath path; if (!FilePathForMemoryName(name, &path)) return false; @@ -109,7 +109,7 @@ bool SharedMemory::Delete(const std::wstring& name) { return true; } -bool SharedMemory::Open(const std::wstring &name, bool read_only) { +bool SharedMemory::Open(const std::string& name, bool read_only) { read_only_ = read_only; int posix_flags = 0; @@ -118,22 +118,21 @@ bool SharedMemory::Open(const std::wstring &name, bool read_only) { return CreateOrOpen(name, posix_flags, 0); } -// For the given shmem named |memname|, return a filename to mmap() +// For the given shmem named |mem_name|, return a filename to mmap() // (and possibly create). Modifies |filename|. Return false on // error, or true of we are happy. -bool SharedMemory::FilePathForMemoryName(const std::wstring& memname, +bool SharedMemory::FilePathForMemoryName(const std::string& mem_name, FilePath* path) { // mem_name will be used for a filename; make sure it doesn't // contain anything which will confuse us. - DCHECK(memname.find_first_of(L"/") == std::string::npos); - DCHECK(memname.find_first_of(L"\0") == std::string::npos); + DCHECK(mem_name.find('/') == std::string::npos); + DCHECK(mem_name.find('\0') == std::string::npos); FilePath temp_dir; - if (file_util::GetShmemTempDir(&temp_dir) == false) + if (!file_util::GetShmemTempDir(&temp_dir)) return false; - *path = temp_dir.AppendASCII("com.google.chrome.shmem." + - WideToUTF8(memname)); + *path = temp_dir.AppendASCII("com.google.chrome.shmem." + mem_name); return true; } @@ -143,7 +142,7 @@ bool SharedMemory::FilePathForMemoryName(const std::wstring& memname, // we restart from a crash. (That isn't a new problem, but it is a problem.) // In case we want to delete it later, it may be useful to save the value // of mem_filename after FilePathForMemoryName(). -bool SharedMemory::CreateOrOpen(const std::wstring &name, +bool SharedMemory::CreateOrOpen(const std::string& name, int posix_flags, uint32 size) { DCHECK(mapped_file_ == -1); @@ -151,7 +150,7 @@ bool SharedMemory::CreateOrOpen(const std::wstring &name, FILE *fp; FilePath path; - if (name == L"") { + if (name.empty()) { // It doesn't make sense to have a read-only private piece of shmem DCHECK(posix_flags & (O_RDWR | O_WRONLY)); |