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

Side by Side Diff: base/ref_counted.h

Issue 7388: Remove throttling code from the Browser process and... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 12 years, 2 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 | « no previous file | chrome/browser/render_view_host.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) 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 10
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 102
103 void Release() { 103 void Release() {
104 if (subtle::RefCountedThreadSafeBase::Release()) { 104 if (subtle::RefCountedThreadSafeBase::Release()) {
105 delete static_cast<T*>(this); 105 delete static_cast<T*>(this);
106 } 106 }
107 } 107 }
108 108
109 DISALLOW_COPY_AND_ASSIGN(RefCountedThreadSafe<T>); 109 DISALLOW_COPY_AND_ASSIGN(RefCountedThreadSafe<T>);
110 }; 110 };
111 111
112 //
113 // A wrapper for some piece of data so we can place other things in
114 // scoped_refptrs<>.
115 //
116 template<typename T>
117 class RefCountedData : public base::RefCounted< base::RefCountedData<T> > {
118 public:
119 RefCountedData() : data() {}
120 RefCountedData(const T& in_value) : data(in_value) {}
121
122 T data;
123 };
124
112 } // namespace base 125 } // namespace base
113 126
114 // 127 //
115 // A smart pointer class for reference counted objects. Use this class instead 128 // A smart pointer class for reference counted objects. Use this class instead
116 // of calling AddRef and Release manually on a reference counted object to 129 // of calling AddRef and Release manually on a reference counted object to
117 // avoid common memory leaks caused by forgetting to Release an object 130 // avoid common memory leaks caused by forgetting to Release an object
118 // reference. Sample usage: 131 // reference. Sample usage:
119 // 132 //
120 // class MyFoo : public RefCounted<MyFoo> { 133 // class MyFoo : public RefCounted<MyFoo> {
121 // ... 134 // ...
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
206 219
207 void swap(scoped_refptr<T>& r) { 220 void swap(scoped_refptr<T>& r) {
208 swap(&r.ptr_); 221 swap(&r.ptr_);
209 } 222 }
210 223
211 private: 224 private:
212 T* ptr_; 225 T* ptr_;
213 }; 226 };
214 227
215 #endif // BASE_REF_COUNTED_H_ 228 #endif // BASE_REF_COUNTED_H_
216
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/render_view_host.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698