Index: base/memory/ref_counted.h |
diff --git a/base/memory/ref_counted.h b/base/memory/ref_counted.h |
index 26c65519664ee0eddb8cf7d2c8687232f8ec36f1..85dd433e0544160e2427c455abec80c48b028495 100644 |
--- a/base/memory/ref_counted.h |
+++ b/base/memory/ref_counted.h |
@@ -14,7 +14,6 @@ |
#ifndef NDEBUG |
#include "base/logging.h" |
#endif |
-#include "base/move.h" |
#include "base/threading/thread_collision_warner.h" |
#include "build/build_config.h" |
@@ -265,7 +264,6 @@ class RefCountedData |
// |
template <class T> |
class scoped_refptr { |
- TYPE_WITH_MOVE_CONSTRUCTOR_FOR_CPP_03(scoped_refptr) |
public: |
typedef T element_type; |
@@ -277,17 +275,24 @@ class scoped_refptr { |
AddRef(ptr_); |
} |
+ // Copy constructor. |
scoped_refptr(const scoped_refptr<T>& r) : ptr_(r.ptr_) { |
if (ptr_) |
AddRef(ptr_); |
} |
+ // Copy conversion constructor. |
template <typename U> |
scoped_refptr(const scoped_refptr<U>& r) : ptr_(r.get()) { |
if (ptr_) |
AddRef(ptr_); |
} |
+ // Move constructor. This is required in addition to the conversion |
+ // constructor below in order for clang to warn about pessimizing moves. |
+ scoped_refptr(scoped_refptr&& r) : ptr_(r.get()) { r.ptr_ = nullptr; } |
+ |
+ // Move conversion constructor. |
template <typename U> |
scoped_refptr(scoped_refptr<U>&& r) : ptr_(r.get()) { |
r.ptr_ = nullptr; |