Index: base/memory/weak_ptr.h |
diff --git a/base/memory/weak_ptr.h b/base/memory/weak_ptr.h |
index badf4ee016c837bf9b1ef6a0605df13683baab93..230feff7a67d862cc1a35a3a44227b3e856289df 100644 |
--- a/base/memory/weak_ptr.h |
+++ b/base/memory/weak_ptr.h |
@@ -109,10 +109,14 @@ class BASE_EXPORT WeakReference { |
}; |
WeakReference(); |
- WeakReference(const WeakReference& other); |
explicit WeakReference(const Flag* flag); |
~WeakReference(); |
+ WeakReference(WeakReference&& other); |
+ WeakReference(const WeakReference& other); |
+ WeakReference& operator=(WeakReference&& other) = default; |
+ WeakReference& operator=(const WeakReference& other) = default; |
+ |
bool is_valid() const; |
private: |
@@ -145,6 +149,11 @@ class BASE_EXPORT WeakPtrBase { |
WeakPtrBase(); |
~WeakPtrBase(); |
+ WeakPtrBase(const WeakPtrBase& other) = default; |
+ WeakPtrBase(WeakPtrBase&& other) = default; |
+ WeakPtrBase& operator=(const WeakPtrBase& other) = default; |
+ WeakPtrBase& operator=(WeakPtrBase&& other) = default; |
+ |
protected: |
explicit WeakPtrBase(const WeakReference& ref); |
@@ -205,10 +214,13 @@ class WeakPtr : public internal::WeakPtrBase { |
WeakPtr(std::nullptr_t) : ptr_(nullptr) {} |
// Allow conversion from U to T provided U "is a" T. Note that this |
- // is separate from the (implicit) copy constructor. |
+ // is separate from the (implicit) copy and move constructors. |
template <typename U> |
WeakPtr(const WeakPtr<U>& other) : WeakPtrBase(other), ptr_(other.ptr_) { |
} |
+ template <typename U> |
+ WeakPtr(WeakPtr<U>&& other) : WeakPtrBase(other), ptr_(other.ptr_) { |
vmpstr
2016/06/24 00:17:39
WeakPtrBase(std::move(other))
Marijn Kruisselbrink
2016/06/24 00:50:15
Done
|
+ } |
T* get() const { return ref_.is_valid() ? ptr_ : nullptr; } |