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

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

Issue 7461141: Rename BASE_API to BASE_EXPORT. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 4 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 | Annotate | Revision Log
« no previous file with comments | « base/memory/memory_debug.h ('k') | base/memory/ref_counted_memory.h » ('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) 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 #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 #pragma once 7 #pragma once
8 8
9 #include "base/atomic_ref_count.h" 9 #include "base/atomic_ref_count.h"
10 #include "base/base_api.h" 10 #include "base/base_export.h"
11 #include "base/threading/thread_collision_warner.h" 11 #include "base/threading/thread_collision_warner.h"
12 12
13 namespace base { 13 namespace base {
14 14
15 namespace subtle { 15 namespace subtle {
16 16
17 class BASE_API RefCountedBase { 17 class BASE_EXPORT RefCountedBase {
18 public: 18 public:
19 static bool ImplementsThreadSafeReferenceCounting() { return false; } 19 static bool ImplementsThreadSafeReferenceCounting() { return false; }
20 20
21 bool HasOneRef() const { return ref_count_ == 1; } 21 bool HasOneRef() const { return ref_count_ == 1; }
22 22
23 protected: 23 protected:
24 RefCountedBase(); 24 RefCountedBase();
25 ~RefCountedBase(); 25 ~RefCountedBase();
26 26
27 void AddRef() const; 27 void AddRef() const;
28 28
29 // Returns true if the object should self-delete. 29 // Returns true if the object should self-delete.
30 bool Release() const; 30 bool Release() const;
31 31
32 private: 32 private:
33 mutable int ref_count_; 33 mutable int ref_count_;
34 #ifndef NDEBUG 34 #ifndef NDEBUG
35 mutable bool in_dtor_; 35 mutable bool in_dtor_;
36 #endif 36 #endif
37 37
38 DFAKE_MUTEX(add_release_); 38 DFAKE_MUTEX(add_release_);
39 39
40 DISALLOW_COPY_AND_ASSIGN(RefCountedBase); 40 DISALLOW_COPY_AND_ASSIGN(RefCountedBase);
41 }; 41 };
42 42
43 class BASE_API RefCountedThreadSafeBase { 43 class BASE_EXPORT RefCountedThreadSafeBase {
44 public: 44 public:
45 static bool ImplementsThreadSafeReferenceCounting() { return true; } 45 static bool ImplementsThreadSafeReferenceCounting() { return true; }
46 46
47 bool HasOneRef() const; 47 bool HasOneRef() const;
48 48
49 protected: 49 protected:
50 RefCountedThreadSafeBase(); 50 RefCountedThreadSafeBase();
51 ~RefCountedThreadSafeBase(); 51 ~RefCountedThreadSafeBase();
52 52
53 void AddRef() const; 53 void AddRef() const;
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after
290 }; 290 };
291 291
292 // Handy utility for creating a scoped_refptr<T> out of a T* explicitly without 292 // Handy utility for creating a scoped_refptr<T> out of a T* explicitly without
293 // having to retype all the template arguments 293 // having to retype all the template arguments
294 template <typename T> 294 template <typename T>
295 scoped_refptr<T> make_scoped_refptr(T* t) { 295 scoped_refptr<T> make_scoped_refptr(T* t) {
296 return scoped_refptr<T>(t); 296 return scoped_refptr<T>(t);
297 } 297 }
298 298
299 #endif // BASE_MEMORY_REF_COUNTED_H_ 299 #endif // BASE_MEMORY_REF_COUNTED_H_
OLDNEW
« no previous file with comments | « base/memory/memory_debug.h ('k') | base/memory/ref_counted_memory.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698