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 3 // found in the LICENSE file. 4 5 #include "base/memory/ref_counted.h" 6 7 namespace base { 8 9 namespace subtle { 10 HasOneRef() const11bool RefCountedThreadSafeBase::HasOneRef() const { 12 return ref_count_.IsOne(); 13 } 14 15 #if defined(ARCH_CPU_64_BIT) AddRefImpl() const16void RefCountedBase::AddRefImpl() const { 17 // Check if |ref_count_| overflow only on 64 bit archs since the number of 18 // objects may exceed 2^32. 19 // To avoid the binary size bloat, use non-inline function here. 20 CHECK(++ref_count_ > 0); 21 } 22 #endif 23 24 #if !defined(ARCH_CPU_X86_FAMILY) Release() const25bool RefCountedThreadSafeBase::Release() const { 26 return ReleaseImpl(); 27 } AddRef() const28void RefCountedThreadSafeBase::AddRef() const { 29 AddRefImpl(); 30 } 31 #endif 32 33 } // namespace subtle 34 35 } // namespace base 36