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

Side by Side Diff: base/ref_counted.h

Issue 18319: Reverting 8180. (Closed) Base URL: svn://chrome-svn.corp.google.com/chrome/trunk/src/
Patch Set: Created 11 years, 11 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 | « no previous file | base/ref_counted.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) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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_REF_COUNTED_H_ 5 #ifndef BASE_REF_COUNTED_H_
6 #define BASE_REF_COUNTED_H_ 6 #define BASE_REF_COUNTED_H_
7 7
8 #include "base/atomic_ref_count.h" 8 #include "base/atomic_ref_count.h"
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/thread_collision_warner.h"
11 10
12 namespace base { 11 namespace base {
13 12
14 namespace subtle { 13 namespace subtle {
15 14
16 class RefCountedBase { 15 class RefCountedBase {
17 protected: 16 protected:
18 RefCountedBase(); 17 RefCountedBase();
19 ~RefCountedBase(); 18 ~RefCountedBase();
20 19
21 void AddRef(); 20 void AddRef();
22 21
23 // Returns true if the object should self-delete. 22 // Returns true if the object should self-delete.
24 bool Release(); 23 bool Release();
25 24
26 private: 25 private:
27 int ref_count_; 26 int ref_count_;
28 #ifndef NDEBUG 27 #ifndef NDEBUG
29 bool in_dtor_; 28 bool in_dtor_;
30 #endif 29 #endif
31 30
32 DFAKE_MUTEX(add_release_);
33
34 DISALLOW_COPY_AND_ASSIGN(RefCountedBase); 31 DISALLOW_COPY_AND_ASSIGN(RefCountedBase);
35 }; 32 };
36 33
37 class RefCountedThreadSafeBase { 34 class RefCountedThreadSafeBase {
38 protected: 35 protected:
39 RefCountedThreadSafeBase(); 36 RefCountedThreadSafeBase();
40 ~RefCountedThreadSafeBase(); 37 ~RefCountedThreadSafeBase();
41 38
42 void AddRef(); 39 void AddRef();
43 40
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
223 220
224 void swap(scoped_refptr<T>& r) { 221 void swap(scoped_refptr<T>& r) {
225 swap(&r.ptr_); 222 swap(&r.ptr_);
226 } 223 }
227 224
228 protected: 225 protected:
229 T* ptr_; 226 T* ptr_;
230 }; 227 };
231 228
232 #endif // BASE_REF_COUNTED_H_ 229 #endif // BASE_REF_COUNTED_H_
OLDNEW
« no previous file with comments | « no previous file | base/ref_counted.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698