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

Unified Diff: base/memory/ref_counted.h

Issue 7210053: Implementation of PostTaskAndReply() in MessageLoopProxy and BrowserThread. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: missed something small Created 9 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | base/task.h » ('j') | base/task.h » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/memory/ref_counted.h
diff --git a/base/memory/ref_counted.h b/base/memory/ref_counted.h
index 1207ed4cdbb572ae274d5a9c3ac353d698688ed7..d8ed15035e5c6cce1200f0ac8cf026441eee5355 100644
--- a/base/memory/ref_counted.h
+++ b/base/memory/ref_counted.h
@@ -116,6 +116,26 @@ struct DefaultRefCountedThreadSafeTraits {
}
};
+// Use as Traits parameter to RefCountedThreadSafe in order to override how the
+// RefCountedThreadSafe subclass is destroyed.
+//
+// class MyFoo : public base::RefCountedThreadSafe<MyFoo, ManualDestruction> {
+// ...
+// private:
+// friend class ManualDestruction;
+// void DoManualDestruction() {
+// delete this; // Or something else that's appropriate.
+// }
+// };
+//
+class ManualDestruction {
+ public:
+ template <class T>
+ static void Destruct(const T* x) {
+ T::DoManualDestruction(x);
+ }
+};
+
//
// A thread-safe variant of RefCounted<T>
//
« no previous file with comments | « no previous file | base/task.h » ('j') | base/task.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698