Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
michael@0 | 1 | // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. |
michael@0 | 2 | // Use of this source code is governed by a BSD-style license that can be |
michael@0 | 3 | // found in the LICENSE file. |
michael@0 | 4 | |
michael@0 | 5 | #ifndef BASE_ATOMIC_SEQUENCE_NUM_H_ |
michael@0 | 6 | #define BASE_ATOMIC_SEQUENCE_NUM_H_ |
michael@0 | 7 | |
michael@0 | 8 | #include "base/atomicops.h" |
michael@0 | 9 | #include "base/basictypes.h" |
michael@0 | 10 | |
michael@0 | 11 | namespace base { |
michael@0 | 12 | |
michael@0 | 13 | class AtomicSequenceNumber { |
michael@0 | 14 | public: |
michael@0 | 15 | AtomicSequenceNumber() : seq_(0) { } |
michael@0 | 16 | explicit AtomicSequenceNumber(base::LinkerInitialized x) { /* seq_ is 0 */ } |
michael@0 | 17 | |
michael@0 | 18 | int GetNext() { |
michael@0 | 19 | return static_cast<int>( |
michael@0 | 20 | base::subtle::NoBarrier_AtomicIncrement(&seq_, 1) - 1); |
michael@0 | 21 | } |
michael@0 | 22 | |
michael@0 | 23 | private: |
michael@0 | 24 | base::subtle::Atomic32 seq_; |
michael@0 | 25 | DISALLOW_COPY_AND_ASSIGN(AtomicSequenceNumber); |
michael@0 | 26 | }; |
michael@0 | 27 | |
michael@0 | 28 | } // namespace base |
michael@0 | 29 | |
michael@0 | 30 | #endif // BASE_ATOMIC_SEQUENCE_NUM_H_ |