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

Unified Diff: base/bind_helpers.h

Issue 8224026: Add a PassScopedPtr into base/memory. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed it. Created 9 years, 1 month 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 | « base/base.gypi ('k') | base/bind_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/bind_helpers.h
diff --git a/base/bind_helpers.h b/base/bind_helpers.h
index 1d5c7ca1e3df1c1fb5582b3f287a64c5897a031f..3834e4debb329f657b290a2309cda388379eb09f 100644
--- a/base/bind_helpers.h
+++ b/base/bind_helpers.h
@@ -322,6 +322,25 @@ struct UnwrapTraits<WeakPtr<T> > {
static ForwardType Unwrap(const WeakPtr<T>& o) { return o; }
};
+/*
+template <typename T>
+struct UnwrapTraits<subtle::PassScopedPtrAnchor<T> > {
+ typedef PassScopedPtr<T> ForwardType;
+ static PassScopedPtr<T> Unwrap(subtle::PassScopedPtrAnchor<T>& o) {
+ return &o;
+ }
+};
+*/
+
+template <typename T>
+struct UnwrapTraits<subtle::PassScopedPtrAnchor<T> > {
+ typedef subtle::PassScopedPtrAnchor<T>* ForwardType;
+ static subtle::PassScopedPtrAnchor<T>*
+ Unwrap(subtle::PassScopedPtrAnchor<T>& o) {
+ return &o;
+ }
+};
+
template <typename T>
struct UnwrapTraits<OwnedWrapper<T> > {
typedef T* ForwardType;
@@ -348,6 +367,12 @@ struct MaybeRefcount<false, T[n]> {
};
template <typename T>
+struct MaybeRefcount<false, PassScopedPtr<T> > {
+ static void AddRef(const subtle::PassScopedPtrAnchor<T>&) {}
+ static void Release(const subtle::PassScopedPtrAnchor<T>&) {}
+};
+
+template <typename T>
struct MaybeRefcount<true, T*> {
static void AddRef(T* o) { o->AddRef(); }
static void Release(T* o) { o->Release(); }
@@ -380,6 +405,12 @@ struct MaybeRefcount<true, const T*> {
};
template <typename T>
+struct MaybeRefcount<true, PassScopedPtr<T> > {
+ static void AddRef(const subtle::PassScopedPtrAnchor<T>&) {}
+ static void Release(const subtle::PassScopedPtrAnchor<T>&) {}
+};
+
+template <typename T>
struct MaybeRefcount<true, WeakPtr<T> > {
static void AddRef(const WeakPtr<T>&) {}
static void Release(const WeakPtr<T>&) {}
« no previous file with comments | « base/base.gypi ('k') | base/bind_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698