X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=src%2Fthird_party%2FWebKit%2FSource%2Fwtf%2FRefPtr.h;h=5d81f9366761634fcc7f250d72e5a5ba786bea65;hb=ff3e2503a20db9193d323c1d19c38c68004dec4a;hp=a728a702687b27a74e1e04f4531bad82c9faa693;hpb=7338fba38ba696536d1cc9d389afd716a6ab2fe6;p=platform%2Fframework%2Fweb%2Fcrosswalk.git diff --git a/src/third_party/WebKit/Source/wtf/RefPtr.h b/src/third_party/WebKit/Source/wtf/RefPtr.h index a728a70..5d81f93 100644 --- a/src/third_party/WebKit/Source/wtf/RefPtr.h +++ b/src/third_party/WebKit/Source/wtf/RefPtr.h @@ -26,6 +26,7 @@ #include #include "wtf/HashTableDeletedValueType.h" #include "wtf/PassRefPtr.h" +#include "wtf/RawPtr.h" namespace WTF { @@ -35,6 +36,7 @@ namespace WTF { public: ALWAYS_INLINE RefPtr() : m_ptr(0) { } ALWAYS_INLINE RefPtr(T* ptr) : m_ptr(ptr) { refIfNotNull(ptr); } + template RefPtr(const RawPtr& ptr, EnsurePtrConvertibleArgDecl(U, T)) : m_ptr(ptr.get()) { refIfNotNull(m_ptr); } ALWAYS_INLINE explicit RefPtr(T& ref) : m_ptr(&ref) { m_ptr->ref(); } ALWAYS_INLINE RefPtr(const RefPtr& o) : m_ptr(o.m_ptr) { refIfNotNull(m_ptr); } template RefPtr(const RefPtr& o, EnsurePtrConvertibleArgDecl(U, T)) : m_ptr(o.get()) { refIfNotNull(m_ptr); } @@ -48,7 +50,7 @@ namespace WTF { ALWAYS_INLINE ~RefPtr() { derefIfNotNull(m_ptr); } - T* get() const { return m_ptr; } + ALWAYS_INLINE T* get() const { return m_ptr; } void clear(); PassRefPtr release() { PassRefPtr tmp = adoptRef(m_ptr); m_ptr = 0; return tmp; } @@ -70,6 +72,7 @@ namespace WTF { #endif template RefPtr& operator=(const RefPtr&); template RefPtr& operator=(const PassRefPtr&); + template RefPtr& operator=(const RawPtr&); void swap(RefPtr&); @@ -126,6 +129,13 @@ namespace WTF { return *this; } + template template inline RefPtr& RefPtr::operator=(const RawPtr& o) + { + RefPtr ptr = o.get(); + swap(ptr); + return *this; + } + template inline void RefPtr::swap(RefPtr& o) { std::swap(m_ptr, o.m_ptr);