| Index: base/memory/shared_memory_unittest.cc
|
| diff --git a/base/memory/shared_memory_unittest.cc b/base/memory/shared_memory_unittest.cc
|
| index 7a41b553761614e479341b37e2dea127e1f79b5c..226c5a7928156b0868037685fe36fefed5ddae59 100644
|
| --- a/base/memory/shared_memory_unittest.cc
|
| +++ b/base/memory/shared_memory_unittest.cc
|
| @@ -2,8 +2,11 @@
|
| // Use of this source code is governed by a BSD-style license that can be
|
| // found in the LICENSE file.
|
|
|
| +#include <stddef.h>
|
| +#include <stdint.h>
|
| +
|
| #include "base/atomicops.h"
|
| -#include "base/basictypes.h"
|
| +#include "base/macros.h"
|
| #include "base/memory/scoped_ptr.h"
|
| #include "base/memory/shared_memory.h"
|
| #include "base/memory/shared_memory_handle.h"
|
| @@ -14,6 +17,7 @@
|
| #include "base/test/multiprocess_test.h"
|
| #include "base/threading/platform_thread.h"
|
| #include "base/time/time.h"
|
| +#include "build/build_config.h"
|
| #include "testing/gtest/include/gtest/gtest.h"
|
| #include "testing/multiprocess_func_list.h"
|
|
|
| @@ -40,7 +44,7 @@ namespace {
|
| // Verify that each thread's value in the shared memory is always correct.
|
| class MultipleThreadMain : public PlatformThread::Delegate {
|
| public:
|
| - explicit MultipleThreadMain(int16 id) : id_(id) {}
|
| + explicit MultipleThreadMain(int16_t id) : id_(id) {}
|
| ~MultipleThreadMain() override {}
|
|
|
| static void CleanUp() {
|
| @@ -50,7 +54,7 @@ class MultipleThreadMain : public PlatformThread::Delegate {
|
|
|
| // PlatformThread::Delegate interface.
|
| void ThreadMain() override {
|
| - const uint32 kDataSize = 1024;
|
| + const uint32_t kDataSize = 1024;
|
| SharedMemory memory;
|
| bool rv = memory.CreateNamedDeprecated(s_test_name_, true, kDataSize);
|
| EXPECT_TRUE(rv);
|
| @@ -71,7 +75,7 @@ class MultipleThreadMain : public PlatformThread::Delegate {
|
| }
|
|
|
| private:
|
| - int16 id_;
|
| + int16_t id_;
|
|
|
| static const char s_test_name_[];
|
|
|
| @@ -88,7 +92,7 @@ const char MultipleThreadMain::s_test_name_[] =
|
| // CreateNamedDeprecated(openExisting=true)
|
| #if !defined(OS_ANDROID) && !defined(OS_MACOSX)
|
| TEST(SharedMemoryTest, OpenClose) {
|
| - const uint32 kDataSize = 1024;
|
| + const uint32_t kDataSize = 1024;
|
| std::string test_name = "SharedMemoryOpenCloseTest";
|
|
|
| // Open two handles to a memory segment, confirm that they are mapped
|
| @@ -136,8 +140,8 @@ TEST(SharedMemoryTest, OpenClose) {
|
| }
|
|
|
| TEST(SharedMemoryTest, OpenExclusive) {
|
| - const uint32 kDataSize = 1024;
|
| - const uint32 kDataSize2 = 2048;
|
| + const uint32_t kDataSize = 1024;
|
| + const uint32_t kDataSize2 = 2048;
|
| std::ostringstream test_name_stream;
|
| test_name_stream << "SharedMemoryOpenExclusiveTest."
|
| << Time::Now().ToDoubleT();
|
| @@ -249,7 +253,7 @@ TEST(SharedMemoryTest, MultipleThreads) {
|
| thread_delegates.reset(new MultipleThreadMain*[numthreads]);
|
|
|
| // Spawn the threads.
|
| - for (int16 index = 0; index < numthreads; index++) {
|
| + for (int16_t index = 0; index < numthreads; index++) {
|
| PlatformThreadHandle pth;
|
| thread_delegates[index] = new MultipleThreadMain(index);
|
| EXPECT_TRUE(PlatformThread::Create(0, thread_delegates[index], &pth));
|
| @@ -273,7 +277,7 @@ TEST(SharedMemoryTest, AnonymousPrivate) {
|
| int i, j;
|
| int count = 4;
|
| bool rv;
|
| - const uint32 kDataSize = 8192;
|
| + const uint32_t kDataSize = 8192;
|
|
|
| scoped_ptr<SharedMemory[]> memories(new SharedMemory[count]);
|
| scoped_ptr<int*[]> pointers(new int*[count]);
|
| @@ -425,13 +429,13 @@ TEST(SharedMemoryTest, ShareToSelf) {
|
| }
|
|
|
| TEST(SharedMemoryTest, MapAt) {
|
| - ASSERT_TRUE(SysInfo::VMAllocationGranularity() >= sizeof(uint32));
|
| + ASSERT_TRUE(SysInfo::VMAllocationGranularity() >= sizeof(uint32_t));
|
| const size_t kCount = SysInfo::VMAllocationGranularity();
|
| - const size_t kDataSize = kCount * sizeof(uint32);
|
| + const size_t kDataSize = kCount * sizeof(uint32_t);
|
|
|
| SharedMemory memory;
|
| ASSERT_TRUE(memory.CreateAndMapAnonymous(kDataSize));
|
| - uint32* ptr = static_cast<uint32*>(memory.memory());
|
| + uint32_t* ptr = static_cast<uint32_t*>(memory.memory());
|
| ASSERT_NE(ptr, static_cast<void*>(NULL));
|
|
|
| for (size_t i = 0; i < kCount; ++i) {
|
| @@ -442,8 +446,8 @@ TEST(SharedMemoryTest, MapAt) {
|
|
|
| off_t offset = SysInfo::VMAllocationGranularity();
|
| ASSERT_TRUE(memory.MapAt(offset, kDataSize - offset));
|
| - offset /= sizeof(uint32);
|
| - ptr = static_cast<uint32*>(memory.memory());
|
| + offset /= sizeof(uint32_t);
|
| + ptr = static_cast<uint32_t*>(memory.memory());
|
| ASSERT_NE(ptr, static_cast<void*>(NULL));
|
| for (size_t i = offset; i < kCount; ++i) {
|
| EXPECT_EQ(ptr[i - offset], i);
|
| @@ -451,7 +455,7 @@ TEST(SharedMemoryTest, MapAt) {
|
| }
|
|
|
| TEST(SharedMemoryTest, MapTwice) {
|
| - const uint32 kDataSize = 1024;
|
| + const uint32_t kDataSize = 1024;
|
| SharedMemory memory;
|
| bool rv = memory.CreateAndMapAnonymous(kDataSize);
|
| EXPECT_TRUE(rv);
|
| @@ -468,7 +472,7 @@ TEST(SharedMemoryTest, MapTwice) {
|
| #if !defined(OS_IOS)
|
| // Create a shared memory object, mmap it, and mprotect it to PROT_EXEC.
|
| TEST(SharedMemoryTest, AnonymousExecutable) {
|
| - const uint32 kTestSize = 1 << 16;
|
| + const uint32_t kTestSize = 1 << 16;
|
|
|
| SharedMemory shared_memory;
|
| SharedMemoryCreateOptions options;
|
| @@ -506,7 +510,7 @@ class ScopedUmaskSetter {
|
|
|
| // Create a shared memory object, check its permissions.
|
| TEST(SharedMemoryTest, FilePermissionsAnonymous) {
|
| - const uint32 kTestSize = 1 << 8;
|
| + const uint32_t kTestSize = 1 << 8;
|
|
|
| SharedMemory shared_memory;
|
| SharedMemoryCreateOptions options;
|
| @@ -654,11 +658,11 @@ class SharedMemoryProcessTest : public MultiProcessTest {
|
| }
|
|
|
| static const char s_test_name_[];
|
| - static const uint32 s_data_size_;
|
| + static const uint32_t s_data_size_;
|
| };
|
|
|
| const char SharedMemoryProcessTest::s_test_name_[] = "MPMem";
|
| -const uint32 SharedMemoryProcessTest::s_data_size_ = 1024;
|
| +const uint32_t SharedMemoryProcessTest::s_data_size_ = 1024;
|
|
|
| TEST_F(SharedMemoryProcessTest, SharedMemoryAcrossProcesses) {
|
| const int kNumTasks = 5;
|
|
|