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

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

Issue 668783004: Standardize usage of virtual/override/final in base/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Formatted Created 6 years, 2 months 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
« no previous file with comments | « base/memory/scoped_vector_unittest.cc ('k') | base/memory/weak_ptr_unittest.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/basictypes.h" 5 #include "base/basictypes.h"
6 #include "base/memory/scoped_ptr.h" 6 #include "base/memory/scoped_ptr.h"
7 #include "base/memory/shared_memory.h" 7 #include "base/memory/shared_memory.h"
8 #include "base/process/kill.h" 8 #include "base/process/kill.h"
9 #include "base/rand_util.h" 9 #include "base/rand_util.h"
10 #include "base/strings/string_number_conversions.h" 10 #include "base/strings/string_number_conversions.h"
(...skipping 29 matching lines...) Expand all
40 namespace base { 40 namespace base {
41 41
42 namespace { 42 namespace {
43 43
44 // Each thread will open the shared memory. Each thread will take a different 4 44 // Each thread will open the shared memory. Each thread will take a different 4
45 // byte int pointer, and keep changing it, with some small pauses in between. 45 // byte int pointer, and keep changing it, with some small pauses in between.
46 // Verify that each thread's value in the shared memory is always correct. 46 // Verify that each thread's value in the shared memory is always correct.
47 class MultipleThreadMain : public PlatformThread::Delegate { 47 class MultipleThreadMain : public PlatformThread::Delegate {
48 public: 48 public:
49 explicit MultipleThreadMain(int16 id) : id_(id) {} 49 explicit MultipleThreadMain(int16 id) : id_(id) {}
50 virtual ~MultipleThreadMain() {} 50 ~MultipleThreadMain() override {}
51 51
52 static void CleanUp() { 52 static void CleanUp() {
53 SharedMemory memory; 53 SharedMemory memory;
54 memory.Delete(s_test_name_); 54 memory.Delete(s_test_name_);
55 } 55 }
56 56
57 // PlatformThread::Delegate interface. 57 // PlatformThread::Delegate interface.
58 virtual void ThreadMain() override { 58 void ThreadMain() override {
59 #if defined(OS_MACOSX) 59 #if defined(OS_MACOSX)
60 mac::ScopedNSAutoreleasePool pool; 60 mac::ScopedNSAutoreleasePool pool;
61 #endif 61 #endif
62 const uint32 kDataSize = 1024; 62 const uint32 kDataSize = 1024;
63 SharedMemory memory; 63 SharedMemory memory;
64 bool rv = memory.CreateNamedDeprecated(s_test_name_, true, kDataSize); 64 bool rv = memory.CreateNamedDeprecated(s_test_name_, true, kDataSize);
65 EXPECT_TRUE(rv); 65 EXPECT_TRUE(rv);
66 rv = memory.Map(kDataSize); 66 rv = memory.Map(kDataSize);
67 EXPECT_TRUE(rv); 67 EXPECT_TRUE(rv);
68 int *ptr = static_cast<int*>(memory.memory()) + id_; 68 int *ptr = static_cast<int*>(memory.memory()) + id_;
(...skipping 622 matching lines...) Expand 10 before | Expand all | Expand 10 after
691 SharedMemoryProcessTest::CleanUp(); 691 SharedMemoryProcessTest::CleanUp();
692 } 692 }
693 693
694 MULTIPROCESS_TEST_MAIN(SharedMemoryTestMain) { 694 MULTIPROCESS_TEST_MAIN(SharedMemoryTestMain) {
695 return SharedMemoryProcessTest::TaskTestMain(); 695 return SharedMemoryProcessTest::TaskTestMain();
696 } 696 }
697 697
698 #endif // !OS_IOS 698 #endif // !OS_IOS
699 699
700 } // namespace base 700 } // namespace base
OLDNEW
« no previous file with comments | « base/memory/scoped_vector_unittest.cc ('k') | base/memory/weak_ptr_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698