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

Side by Side Diff: mojo/edk/util/ref_counted_internal.h

Issue 1423713009: EDK: Move ref counting classes to mojo/edk/util. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 5 years, 1 month 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 | « mojo/edk/util/ref_counted.h ('k') | mojo/edk/util/ref_counted_perftest.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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 // Internal implementation details for ref_counted.h. 5 // Internal implementation details for ref_counted.h.
6 6
7 #ifndef MOJO_EDK_SYSTEM_REF_COUNTED_INTERNAL_H_ 7 #ifndef MOJO_EDK_UTIL_REF_COUNTED_INTERNAL_H_
8 #define MOJO_EDK_SYSTEM_REF_COUNTED_INTERNAL_H_ 8 #define MOJO_EDK_UTIL_REF_COUNTED_INTERNAL_H_
9 9
10 #include <assert.h> 10 #include <assert.h>
11 11
12 #include <atomic> 12 #include <atomic>
13 13
14 #include "mojo/public/cpp/system/macros.h" 14 #include "mojo/public/cpp/system/macros.h"
15 15
16 namespace mojo { 16 namespace mojo {
17 namespace system { 17 namespace util {
18 namespace internal { 18 namespace internal {
19 19
20 class RefCountedThreadSafeBase { 20 class RefCountedThreadSafeBase {
21 public: 21 public:
22 void AddRef() const { 22 void AddRef() const {
23 assert(!adoption_required_); 23 assert(!adoption_required_);
24 assert(!destruction_started_); 24 assert(!destruction_started_);
25 ref_count_.fetch_add(1u, std::memory_order_relaxed); 25 ref_count_.fetch_add(1u, std::memory_order_relaxed);
26 } 26 }
27 27
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 { 88 {
89 } 89 }
90 90
91 inline RefCountedThreadSafeBase::~RefCountedThreadSafeBase() { 91 inline RefCountedThreadSafeBase::~RefCountedThreadSafeBase() {
92 assert(!adoption_required_); 92 assert(!adoption_required_);
93 // Should only be destroyed as a result of |Release()|. 93 // Should only be destroyed as a result of |Release()|.
94 assert(destruction_started_); 94 assert(destruction_started_);
95 } 95 }
96 96
97 } // namespace internal 97 } // namespace internal
98 } // namespace system 98 } // namespace util
99 } // namespace mojo 99 } // namespace mojo
100 100
101 #endif // MOJO_EDK_SYSTEM_REF_COUNTED_INTERNAL_H_ 101 #endif // MOJO_EDK_UTIL_REF_COUNTED_INTERNAL_H_
OLDNEW
« no previous file with comments | « mojo/edk/util/ref_counted.h ('k') | mojo/edk/util/ref_counted_perftest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698