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

Side by Side Diff: content/common/one_writer_seqlock_unittest.cc

Issue 2349393002: Use platform sized counters for the refcounted classes in base. (Closed)
Patch Set: fix implicit cast in seqlock test Created 4 years, 3 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
« base/memory/ref_counted.h ('K') | « base/memory/ref_counted.h ('k') | no next file » | 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "content/common/one_writer_seqlock.h" 5 #include "content/common/one_writer_seqlock.h"
6 6
7 #include <stdlib.h> 7 #include <stdlib.h>
8 8
9 #include "base/atomic_ref_count.h" 9 #include "base/atomic_ref_count.h"
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 10 matching lines...) Expand all
21 unsigned a, b, c; 21 unsigned a, b, c;
22 }; 22 };
23 23
24 class BasicSeqLockTestThread : public PlatformThread::Delegate { 24 class BasicSeqLockTestThread : public PlatformThread::Delegate {
25 public: 25 public:
26 BasicSeqLockTestThread() {} 26 BasicSeqLockTestThread() {}
27 27
28 void Init( 28 void Init(
29 content::OneWriterSeqLock* seqlock, 29 content::OneWriterSeqLock* seqlock,
30 TestData* data, 30 TestData* data,
31 base::subtle::Atomic32* ready) { 31 base::AtomicRefCount* ready) {
32 seqlock_ = seqlock; 32 seqlock_ = seqlock;
33 data_ = data; 33 data_ = data;
34 ready_ = ready; 34 ready_ = ready;
35 } 35 }
36 void ThreadMain() override { 36 void ThreadMain() override {
37 while (AtomicRefCountIsZero(ready_)) { 37 while (AtomicRefCountIsZero(ready_)) {
38 PlatformThread::YieldCurrentThread(); 38 PlatformThread::YieldCurrentThread();
39 } 39 }
40 40
41 for (unsigned i = 0; i < 1000; ++i) { 41 for (unsigned i = 0; i < 1000; ++i) {
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 96
97 if (AtomicRefCountIsZero(&ready)) 97 if (AtomicRefCountIsZero(&ready))
98 break; 98 break;
99 } 99 }
100 100
101 for (unsigned i = 0; i < kNumReaderThreads; ++i) 101 for (unsigned i = 0; i < kNumReaderThreads; ++i)
102 PlatformThread::Join(handles[i]); 102 PlatformThread::Join(handles[i]);
103 } 103 }
104 104
105 } // namespace base 105 } // namespace base
OLDNEW
« base/memory/ref_counted.h ('K') | « base/memory/ref_counted.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698