diff options
author | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-02-16 23:58:27 +0000 |
---|---|---|
committer | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-02-16 23:58:27 +0000 |
commit | b5ab398db97d13c76d332c6567c23a575858f8c4 (patch) | |
tree | 54a5771b49afbb92470d92b82bcac1a78d10f2f8 /base | |
parent | 77bd2cefb7f0f8f437b47b3d6a3dd458b8d4fe2e (diff) | |
download | chromium_src-b5ab398db97d13c76d332c6567c23a575858f8c4.zip chromium_src-b5ab398db97d13c76d332c6567c23a575858f8c4.tar.gz chromium_src-b5ab398db97d13c76d332c6567c23a575858f8c4.tar.bz2 |
Make SharedMemory use uint32 instead of size_t. This removes the remaining size_t's from the IPC code.
Review URL: http://codereview.chromium.org/581001
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@39164 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base')
-rw-r--r-- | base/shared_memory.h | 10 | ||||
-rw-r--r-- | base/shared_memory_posix.cc | 8 | ||||
-rw-r--r-- | base/shared_memory_unittest.cc | 10 | ||||
-rw-r--r-- | base/shared_memory_win.cc | 4 |
4 files changed, 16 insertions, 16 deletions
diff --git a/base/shared_memory.h b/base/shared_memory.h index 90bed59..48ba857 100644 --- a/base/shared_memory.h +++ b/base/shared_memory.h @@ -73,7 +73,7 @@ class SharedMemory { // If name is the empty string, use a unique name. // Returns true on success, false on failure. bool Create(const std::wstring& name, bool read_only, bool open_existing, - size_t size); + uint32 size); // Deletes resources associated with a shared memory segment based on name. // Not all platforms require this call. @@ -88,7 +88,7 @@ class SharedMemory { // Maps the shared memory into the caller's address space. // Returns true on success, false otherwise. The memory address // is accessed via the memory() accessor. - bool Map(size_t bytes); + bool Map(uint32 bytes); // Unmaps the shared memory from the caller's address space. // Returns true if successful; returns false on error or if the @@ -100,7 +100,7 @@ class SharedMemory { // shared memory, and not to those that opened shared memory // created externally. // Returns 0 if not opened or unknown. - size_t max_size() const { return max_size_; } + uint32 max_size() const { return max_size_; } // Gets a pointer to the opened memory space if it has been // Mapped via Map(). Returns NULL if it is not mapped. @@ -161,7 +161,7 @@ class SharedMemory { private: #if defined(OS_POSIX) - bool CreateOrOpen(const std::wstring &name, int posix_flags, size_t size); + bool CreateOrOpen(const std::wstring &name, int posix_flags, uint32 size); bool FilePathForMemoryName(const std::wstring& memname, FilePath* path); void LockOrUnlockCommon(int function); @@ -179,7 +179,7 @@ class SharedMemory { #endif void* memory_; bool read_only_; - size_t max_size_; + uint32 max_size_; #if !defined(OS_POSIX) SharedMemoryLock lock_; #endif diff --git a/base/shared_memory_posix.cc b/base/shared_memory_posix.cc index 5fff095..373ebf7 100644 --- a/base/shared_memory_posix.cc +++ b/base/shared_memory_posix.cc @@ -78,7 +78,7 @@ void SharedMemory::CloseHandle(const SharedMemoryHandle& handle) { } bool SharedMemory::Create(const std::wstring &name, bool read_only, - bool open_existing, size_t size) { + bool open_existing, uint32 size) { read_only_ = read_only; int posix_flags = 0; @@ -144,7 +144,7 @@ bool SharedMemory::FilePathForMemoryName(const std::wstring& memname, // 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, - int posix_flags, size_t size) { + int posix_flags, uint32 size) { DCHECK(mapped_file_ == -1); file_util::ScopedFILE file_closer; @@ -206,7 +206,7 @@ bool SharedMemory::CreateOrOpen(const std::wstring &name, struct stat stat; if (fstat(fileno(fp), &stat) != 0) return false; - const size_t current_size = stat.st_size; + const uint32 current_size = stat.st_size; if (current_size != size) { if (ftruncate(fileno(fp), size) != 0) return false; @@ -233,7 +233,7 @@ bool SharedMemory::CreateOrOpen(const std::wstring &name, return true; } -bool SharedMemory::Map(size_t bytes) { +bool SharedMemory::Map(uint32 bytes) { if (mapped_file_ == -1) return false; diff --git a/base/shared_memory_unittest.cc b/base/shared_memory_unittest.cc index 6b95021..459b423 100644 --- a/base/shared_memory_unittest.cc +++ b/base/shared_memory_unittest.cc @@ -33,7 +33,7 @@ class MultipleThreadMain : public PlatformThread::Delegate { // PlatformThread::Delegate interface. void ThreadMain() { ScopedNSAutoreleasePool pool; // noop if not OSX - const int kDataSize = 1024; + const uint32 kDataSize = 1024; SharedMemory memory; bool rv = memory.Create(s_test_name_, false, true, kDataSize); EXPECT_TRUE(rv); @@ -77,7 +77,7 @@ class MultipleLockThread : public PlatformThread::Delegate { // PlatformThread::Delegate interface. void ThreadMain() { - const int kDataSize = sizeof(int); + const uint32 kDataSize = sizeof(int); SharedMemoryHandle handle = NULL; { SharedMemory memory1; @@ -115,7 +115,7 @@ class MultipleLockThread : public PlatformThread::Delegate { } // namespace TEST(SharedMemoryTest, OpenClose) { - const int kDataSize = 1024; + const uint32 kDataSize = 1024; std::wstring test_name = L"SharedMemoryOpenCloseTest"; // Open two handles to a memory segment, confirm that they are mapped @@ -234,7 +234,7 @@ TEST(SharedMemoryTest, AnonymousPrivate) { int i, j; int count = 4; bool rv; - const int kDataSize = 8192; + const uint32 kDataSize = 8192; scoped_array<SharedMemory> memories(new SharedMemory[count]); scoped_array<int*> pointers(new int*[count]); @@ -288,7 +288,7 @@ class SharedMemoryProcessTest : public MultiProcessTest { static int TaskTestMain() { int errors = 0; ScopedNSAutoreleasePool pool; // noop if not OSX - const int kDataSize = 1024; + const uint32 kDataSize = 1024; SharedMemory memory; bool rv = memory.Create(s_test_name_, false, true, kDataSize); EXPECT_TRUE(rv); diff --git a/base/shared_memory_win.cc b/base/shared_memory_win.cc index dd4c73b..4afad3a 100644 --- a/base/shared_memory_win.cc +++ b/base/shared_memory_win.cc @@ -62,7 +62,7 @@ void SharedMemory::CloseHandle(const SharedMemoryHandle& handle) { } bool SharedMemory::Create(const std::wstring &name, bool read_only, - bool open_existing, size_t size) { + bool open_existing, uint32 size) { DCHECK(mapped_file_ == NULL); name_ = name; @@ -102,7 +102,7 @@ bool SharedMemory::Open(const std::wstring &name, bool read_only) { return false; } -bool SharedMemory::Map(size_t bytes) { +bool SharedMemory::Map(uint32 bytes) { if (mapped_file_ == NULL) return false; |