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

Side by Side Diff: base/memory/ref_counted.h

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
« no previous file with comments | « base/atomic_ref_count.h ('k') | content/common/one_writer_seqlock_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 #ifndef BASE_MEMORY_REF_COUNTED_H_ 5 #ifndef BASE_MEMORY_REF_COUNTED_H_
6 #define BASE_MEMORY_REF_COUNTED_H_ 6 #define BASE_MEMORY_REF_COUNTED_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 9
10 #include <cassert> 10 #include <cassert>
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 if (--ref_count_ == 0) { 68 if (--ref_count_ == 0) {
69 #ifndef NDEBUG 69 #ifndef NDEBUG
70 in_dtor_ = true; 70 in_dtor_ = true;
71 #endif 71 #endif
72 return true; 72 return true;
73 } 73 }
74 return false; 74 return false;
75 } 75 }
76 76
77 private: 77 private:
78 mutable int ref_count_; 78 mutable size_t ref_count_;
Tom Sepez 2016/09/22 17:55:35 nit: should really be an intprt_t, in case we go b
79 #ifndef NDEBUG 79 #ifndef NDEBUG
80 mutable bool in_dtor_; 80 mutable bool in_dtor_;
81 #endif 81 #endif
82 82
83 DFAKE_MUTEX(add_release_); 83 DFAKE_MUTEX(add_release_);
84 84
85 DISALLOW_COPY_AND_ASSIGN(RefCountedBase); 85 DISALLOW_COPY_AND_ASSIGN(RefCountedBase);
86 }; 86 };
87 87
88 class BASE_EXPORT RefCountedThreadSafeBase { 88 class BASE_EXPORT RefCountedThreadSafeBase {
(...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after
453 bool operator!=(std::nullptr_t null, const scoped_refptr<T>& rhs) { 453 bool operator!=(std::nullptr_t null, const scoped_refptr<T>& rhs) {
454 return !operator==(null, rhs); 454 return !operator==(null, rhs);
455 } 455 }
456 456
457 template <typename T> 457 template <typename T>
458 std::ostream& operator<<(std::ostream& out, const scoped_refptr<T>& p) { 458 std::ostream& operator<<(std::ostream& out, const scoped_refptr<T>& p) {
459 return out << p.get(); 459 return out << p.get();
460 } 460 }
461 461
462 #endif // BASE_MEMORY_REF_COUNTED_H_ 462 #endif // BASE_MEMORY_REF_COUNTED_H_
OLDNEW
« no previous file with comments | « base/atomic_ref_count.h ('k') | content/common/one_writer_seqlock_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698