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

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

Issue 2961413003: Outline RefCountedThreadSafeBase::AddRef and Release on non-X86 (Closed)
Patch Set: Created 3 years, 5 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 "base/memory/ref_counted.h" 5 #include "base/memory/ref_counted.h"
6 6
7 #include "base/threading/thread_collision_warner.h" 7 #include "base/threading/thread_collision_warner.h"
8 8
9 namespace base { 9 namespace base {
10 namespace { 10 namespace {
(...skipping 10 matching lines...) Expand all
21 return AtomicRefCountIsOne(&ref_count_); 21 return AtomicRefCountIsOne(&ref_count_);
22 } 22 }
23 23
24 RefCountedThreadSafeBase::~RefCountedThreadSafeBase() { 24 RefCountedThreadSafeBase::~RefCountedThreadSafeBase() {
25 #if DCHECK_IS_ON() 25 #if DCHECK_IS_ON()
26 DCHECK(in_dtor_) << "RefCountedThreadSafe object deleted without " 26 DCHECK(in_dtor_) << "RefCountedThreadSafe object deleted without "
27 "calling Release()"; 27 "calling Release()";
28 #endif 28 #endif
29 } 29 }
30 30
31 #if !defined(ARCH_CPU_X86_FAMILY)
32 bool RefCountedThreadSafeBase::Release() const {
33 return ReleaseImpl();
34 }
35 void RefCountedThreadSafeBase::AddRef() const {
36 AddRefImpl();
37 }
38 #endif
39
31 #if DCHECK_IS_ON() 40 #if DCHECK_IS_ON()
32 bool RefCountedBase::CalledOnValidSequence() const { 41 bool RefCountedBase::CalledOnValidSequence() const {
33 return sequence_checker_.CalledOnValidSequence() || 42 return sequence_checker_.CalledOnValidSequence() ||
34 !AtomicRefCountIsZero(&g_cross_thread_ref_count_access_allow_count); 43 !AtomicRefCountIsZero(&g_cross_thread_ref_count_access_allow_count);
35 } 44 }
36 #endif 45 #endif
37 46
38 } // namespace subtle 47 } // namespace subtle
39 48
40 #if DCHECK_IS_ON() 49 #if DCHECK_IS_ON()
41 ScopedAllowCrossThreadRefCountAccess::ScopedAllowCrossThreadRefCountAccess() { 50 ScopedAllowCrossThreadRefCountAccess::ScopedAllowCrossThreadRefCountAccess() {
42 AtomicRefCountInc(&g_cross_thread_ref_count_access_allow_count); 51 AtomicRefCountInc(&g_cross_thread_ref_count_access_allow_count);
43 } 52 }
44 53
45 ScopedAllowCrossThreadRefCountAccess::~ScopedAllowCrossThreadRefCountAccess() { 54 ScopedAllowCrossThreadRefCountAccess::~ScopedAllowCrossThreadRefCountAccess() {
46 AtomicRefCountDec(&g_cross_thread_ref_count_access_allow_count); 55 AtomicRefCountDec(&g_cross_thread_ref_count_access_allow_count);
47 } 56 }
48 #endif 57 #endif
49 58
50 } // namespace base 59 } // 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