<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[177696] trunk/Source/WTF</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/177696">177696</a></dd>
<dt>Author</dt> <dd>andersca@apple.com</dd>
<dt>Date</dt> <dd>2014-12-23 14:16:46 -0800 (Tue, 23 Dec 2014)</dd>
</dl>
<h3>Log Message</h3>
<pre>Re-indent RefPtr.h and RetainPtr.h.
Rubber-stamped by Sam Weinig.
* wtf/RefPtr.h:
* wtf/RetainPtr.h:</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWTFChangeLog">trunk/Source/WTF/ChangeLog</a></li>
<li><a href="#trunkSourceWTFwtfRefPtrh">trunk/Source/WTF/wtf/RefPtr.h</a></li>
<li><a href="#trunkSourceWTFwtfRetainPtrh">trunk/Source/WTF/wtf/RetainPtr.h</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWTFChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WTF/ChangeLog (177695 => 177696)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WTF/ChangeLog        2014-12-23 22:14:48 UTC (rev 177695)
+++ trunk/Source/WTF/ChangeLog        2014-12-23 22:16:46 UTC (rev 177696)
</span><span class="lines">@@ -1,3 +1,12 @@
</span><ins>+2014-12-23 Anders Carlsson <andersca@apple.com>
+
+ Re-indent RefPtr.h and RetainPtr.h.
+
+ Rubber-stamped by Sam Weinig.
+
+ * wtf/RefPtr.h:
+ * wtf/RetainPtr.h:
+
</ins><span class="cx"> 2014-12-20 Eric Carlson <eric.carlson@apple.com>
</span><span class="cx">
</span><span class="cx"> [iOS] add optimized fullscreen API
</span></span></pre></div>
<a id="trunkSourceWTFwtfRefPtrh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WTF/wtf/RefPtr.h (177695 => 177696)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WTF/wtf/RefPtr.h        2014-12-23 22:14:48 UTC (rev 177695)
+++ trunk/Source/WTF/wtf/RefPtr.h        2014-12-23 22:16:46 UTC (rev 177696)
</span><span class="lines">@@ -31,200 +31,200 @@
</span><span class="cx">
</span><span class="cx"> namespace WTF {
</span><span class="cx">
</span><del>- enum HashTableDeletedValueType { HashTableDeletedValue };
</del><ins>+enum HashTableDeletedValueType { HashTableDeletedValue };
</ins><span class="cx">
</span><del>- template<typename T> class RefPtr {
- WTF_MAKE_FAST_ALLOCATED;
- public:
- typedef T ValueType;
- typedef ValueType* PtrType;
</del><ins>+template<typename T> class RefPtr {
+ WTF_MAKE_FAST_ALLOCATED;
+public:
+ typedef T ValueType;
+ typedef ValueType* PtrType;
</ins><span class="cx">
</span><del>- ALWAYS_INLINE RefPtr() : m_ptr(nullptr) { }
- ALWAYS_INLINE RefPtr(T* ptr) : m_ptr(ptr) { refIfNotNull(ptr); }
- ALWAYS_INLINE RefPtr(const RefPtr& o) : m_ptr(o.m_ptr) { refIfNotNull(m_ptr); }
- template<typename U> RefPtr(const RefPtr<U>& o) : m_ptr(o.get()) { refIfNotNull(m_ptr); }
</del><ins>+ ALWAYS_INLINE RefPtr() : m_ptr(nullptr) { }
+ ALWAYS_INLINE RefPtr(T* ptr) : m_ptr(ptr) { refIfNotNull(ptr); }
+ ALWAYS_INLINE RefPtr(const RefPtr& o) : m_ptr(o.m_ptr) { refIfNotNull(m_ptr); }
+ template<typename U> RefPtr(const RefPtr<U>& o) : m_ptr(o.get()) { refIfNotNull(m_ptr); }
</ins><span class="cx">
</span><del>- ALWAYS_INLINE RefPtr(RefPtr&& o) : m_ptr(o.release().leakRef()) { }
- template<typename U> RefPtr(RefPtr<U>&& o) : m_ptr(o.release().leakRef()) { }
</del><ins>+ ALWAYS_INLINE RefPtr(RefPtr&& o) : m_ptr(o.release().leakRef()) { }
+ template<typename U> RefPtr(RefPtr<U>&& o) : m_ptr(o.release().leakRef()) { }
</ins><span class="cx">
</span><del>- // See comments in PassRefPtr.h for an explanation of why this takes a const reference.
- template<typename U> RefPtr(const PassRefPtr<U>&);
</del><ins>+ // See comments in PassRefPtr.h for an explanation of why this takes a const reference.
+ template<typename U> RefPtr(const PassRefPtr<U>&);
</ins><span class="cx">
</span><del>- template<typename U> RefPtr(Ref<U>&&);
</del><ins>+ template<typename U> RefPtr(Ref<U>&&);
</ins><span class="cx">
</span><del>- // Hash table deleted values, which are only constructed and never copied or destroyed.
- RefPtr(HashTableDeletedValueType) : m_ptr(hashTableDeletedValue()) { }
- bool isHashTableDeletedValue() const { return m_ptr == hashTableDeletedValue(); }
</del><ins>+ // Hash table deleted values, which are only constructed and never copied or destroyed.
+ RefPtr(HashTableDeletedValueType) : m_ptr(hashTableDeletedValue()) { }
+ bool isHashTableDeletedValue() const { return m_ptr == hashTableDeletedValue(); }
</ins><span class="cx">
</span><del>- ALWAYS_INLINE ~RefPtr() { derefIfNotNull(m_ptr); }
</del><ins>+ ALWAYS_INLINE ~RefPtr() { derefIfNotNull(m_ptr); }
</ins><span class="cx">
</span><del>- T* get() const { return m_ptr; }
-
- void clear();
- PassRefPtr<T> release() { PassRefPtr<T> tmp = adoptRef(m_ptr); m_ptr = nullptr; return tmp; }
- Ref<T> releaseNonNull() { ASSERT(m_ptr); Ref<T> tmp(adoptRef(*m_ptr)); m_ptr = nullptr; return tmp; }
</del><ins>+ T* get() const { return m_ptr; }
+
+ void clear();
+ PassRefPtr<T> release() { PassRefPtr<T> tmp = adoptRef(m_ptr); m_ptr = nullptr; return tmp; }
+ Ref<T> releaseNonNull() { ASSERT(m_ptr); Ref<T> tmp(adoptRef(*m_ptr)); m_ptr = nullptr; return tmp; }
</ins><span class="cx">
</span><del>- T* leakRef() WARN_UNUSED_RETURN;
</del><ins>+ T* leakRef() WARN_UNUSED_RETURN;
</ins><span class="cx">
</span><del>- T& operator*() const { return *m_ptr; }
- ALWAYS_INLINE T* operator->() const { return m_ptr; }
-
- bool operator!() const { return !m_ptr; }
</del><ins>+ T& operator*() const { return *m_ptr; }
+ ALWAYS_INLINE T* operator->() const { return m_ptr; }
</ins><span class="cx">
</span><del>- // This conversion operator allows implicit conversion to bool but not to other integer types.
- typedef T* (RefPtr::*UnspecifiedBoolType);
- operator UnspecifiedBoolType() const { return m_ptr ? &RefPtr::m_ptr : nullptr; }
-
- RefPtr& operator=(const RefPtr&);
- RefPtr& operator=(T*);
- RefPtr& operator=(const PassRefPtr<T>&);
- template<typename U> RefPtr& operator=(const RefPtr<U>&);
- template<typename U> RefPtr& operator=(const PassRefPtr<U>&);
- RefPtr& operator=(RefPtr&&);
- template<typename U> RefPtr& operator=(RefPtr<U>&&);
- template<typename U> RefPtr& operator=(Ref<U>&&);
</del><ins>+ bool operator!() const { return !m_ptr; }
</ins><span class="cx">
</span><del>- void swap(RefPtr&);
</del><ins>+ // This conversion operator allows implicit conversion to bool but not to other integer types.
+ typedef T* (RefPtr::*UnspecifiedBoolType);
+ operator UnspecifiedBoolType() const { return m_ptr ? &RefPtr::m_ptr : nullptr; }
+
+ RefPtr& operator=(const RefPtr&);
+ RefPtr& operator=(T*);
+ RefPtr& operator=(const PassRefPtr<T>&);
+ template<typename U> RefPtr& operator=(const RefPtr<U>&);
+ template<typename U> RefPtr& operator=(const PassRefPtr<U>&);
+ RefPtr& operator=(RefPtr&&);
+ template<typename U> RefPtr& operator=(RefPtr<U>&&);
+ template<typename U> RefPtr& operator=(Ref<U>&&);
</ins><span class="cx">
</span><del>- static T* hashTableDeletedValue() { return reinterpret_cast<T*>(-1); }
</del><ins>+ void swap(RefPtr&);
</ins><span class="cx">
</span><ins>+ static T* hashTableDeletedValue() { return reinterpret_cast<T*>(-1); }
+
</ins><span class="cx"> #if COMPILER_SUPPORTS(CXX_REFERENCE_QUALIFIED_FUNCTIONS)
</span><del>- RefPtr copyRef() && = delete;
- RefPtr copyRef() const & WARN_UNUSED_RETURN { return RefPtr(m_ptr); }
</del><ins>+ RefPtr copyRef() && = delete;
+ RefPtr copyRef() const & WARN_UNUSED_RETURN { return RefPtr(m_ptr); }
</ins><span class="cx"> #else
</span><del>- RefPtr copyRef() const WARN_UNUSED_RETURN { return RefPtr(m_ptr); }
</del><ins>+ RefPtr copyRef() const WARN_UNUSED_RETURN { return RefPtr(m_ptr); }
</ins><span class="cx"> #endif
</span><span class="cx">
</span><del>- private:
- T* m_ptr;
- };
-
- template<typename T> template<typename U> inline RefPtr<T>::RefPtr(const PassRefPtr<U>& o)
- : m_ptr(o.leakRef())
- {
- }
</del><ins>+private:
+ T* m_ptr;
+};
</ins><span class="cx">
</span><del>- template<typename T> template<typename U> inline RefPtr<T>::RefPtr(Ref<U>&& reference)
- : m_ptr(&reference.leakRef())
- {
- }
</del><ins>+template<typename T> template<typename U> inline RefPtr<T>::RefPtr(const PassRefPtr<U>& o)
+ : m_ptr(o.leakRef())
+{
+}
</ins><span class="cx">
</span><del>- template<typename T> inline void RefPtr<T>::clear()
- {
- derefIfNotNull(std::exchange(m_ptr, nullptr));
- }
</del><ins>+template<typename T> template<typename U> inline RefPtr<T>::RefPtr(Ref<U>&& reference)
+ : m_ptr(&reference.leakRef())
+{
+}
</ins><span class="cx">
</span><del>- template<typename T>
- inline T* RefPtr<T>::leakRef()
- {
- return std::exchange(m_ptr, nullptr);
- }
</del><ins>+template<typename T> inline void RefPtr<T>::clear()
+{
+ derefIfNotNull(std::exchange(m_ptr, nullptr));
+}
</ins><span class="cx">
</span><del>- template<typename T> inline RefPtr<T>& RefPtr<T>::operator=(const RefPtr& o)
- {
- RefPtr ptr = o;
- swap(ptr);
- return *this;
- }
-
- template<typename T> template<typename U> inline RefPtr<T>& RefPtr<T>::operator=(const RefPtr<U>& o)
- {
- RefPtr ptr = o;
- swap(ptr);
- return *this;
- }
-
- template<typename T> inline RefPtr<T>& RefPtr<T>::operator=(T* optr)
- {
- RefPtr ptr = optr;
- swap(ptr);
- return *this;
- }
</del><ins>+template<typename T>
+inline T* RefPtr<T>::leakRef()
+{
+ return std::exchange(m_ptr, nullptr);
+}
</ins><span class="cx">
</span><del>- template<typename T> inline RefPtr<T>& RefPtr<T>::operator=(const PassRefPtr<T>& o)
- {
- RefPtr ptr = o;
- swap(ptr);
- return *this;
- }
</del><ins>+template<typename T> inline RefPtr<T>& RefPtr<T>::operator=(const RefPtr& o)
+{
+ RefPtr ptr = o;
+ swap(ptr);
+ return *this;
+}
</ins><span class="cx">
</span><del>- template<typename T> template<typename U> inline RefPtr<T>& RefPtr<T>::operator=(const PassRefPtr<U>& o)
- {
- RefPtr ptr = o;
- swap(ptr);
- return *this;
- }
</del><ins>+template<typename T> template<typename U> inline RefPtr<T>& RefPtr<T>::operator=(const RefPtr<U>& o)
+{
+ RefPtr ptr = o;
+ swap(ptr);
+ return *this;
+}
</ins><span class="cx">
</span><del>- template<typename T> inline RefPtr<T>& RefPtr<T>::operator=(RefPtr&& o)
- {
- RefPtr ptr = WTF::move(o);
- swap(ptr);
- return *this;
- }
</del><ins>+template<typename T> inline RefPtr<T>& RefPtr<T>::operator=(T* optr)
+{
+ RefPtr ptr = optr;
+ swap(ptr);
+ return *this;
+}
</ins><span class="cx">
</span><del>- template<typename T> template<typename U> inline RefPtr<T>& RefPtr<T>::operator=(RefPtr<U>&& o)
- {
- RefPtr ptr = WTF::move(o);
- swap(ptr);
- return *this;
- }
</del><ins>+template<typename T> inline RefPtr<T>& RefPtr<T>::operator=(const PassRefPtr<T>& o)
+{
+ RefPtr ptr = o;
+ swap(ptr);
+ return *this;
+}
</ins><span class="cx">
</span><del>- template<typename T> template<typename U> inline RefPtr<T>& RefPtr<T>::operator=(Ref<U>&& reference)
- {
- RefPtr ptr = WTF::move(reference);
- swap(ptr);
- return *this;
- }
</del><ins>+template<typename T> template<typename U> inline RefPtr<T>& RefPtr<T>::operator=(const PassRefPtr<U>& o)
+{
+ RefPtr ptr = o;
+ swap(ptr);
+ return *this;
+}
</ins><span class="cx">
</span><del>- template<class T> inline void RefPtr<T>::swap(RefPtr& o)
- {
- std::swap(m_ptr, o.m_ptr);
- }
</del><ins>+template<typename T> inline RefPtr<T>& RefPtr<T>::operator=(RefPtr&& o)
+{
+ RefPtr ptr = WTF::move(o);
+ swap(ptr);
+ return *this;
+}
</ins><span class="cx">
</span><del>- template<class T> inline void swap(RefPtr<T>& a, RefPtr<T>& b)
- {
- a.swap(b);
- }
</del><ins>+template<typename T> template<typename U> inline RefPtr<T>& RefPtr<T>::operator=(RefPtr<U>&& o)
+{
+ RefPtr ptr = WTF::move(o);
+ swap(ptr);
+ return *this;
+}
</ins><span class="cx">
</span><del>- template<typename T, typename U> inline bool operator==(const RefPtr<T>& a, const RefPtr<U>& b)
- {
- return a.get() == b.get();
- }
</del><ins>+template<typename T> template<typename U> inline RefPtr<T>& RefPtr<T>::operator=(Ref<U>&& reference)
+{
+ RefPtr ptr = WTF::move(reference);
+ swap(ptr);
+ return *this;
+}
</ins><span class="cx">
</span><del>- template<typename T, typename U> inline bool operator==(const RefPtr<T>& a, U* b)
- {
- return a.get() == b;
- }
-
- template<typename T, typename U> inline bool operator==(T* a, const RefPtr<U>& b)
- {
- return a == b.get();
- }
-
- template<typename T, typename U> inline bool operator!=(const RefPtr<T>& a, const RefPtr<U>& b)
- {
- return a.get() != b.get();
- }
</del><ins>+template<class T> inline void RefPtr<T>::swap(RefPtr& o)
+{
+ std::swap(m_ptr, o.m_ptr);
+}
</ins><span class="cx">
</span><del>- template<typename T, typename U> inline bool operator!=(const RefPtr<T>& a, U* b)
- {
- return a.get() != b;
- }
</del><ins>+template<class T> inline void swap(RefPtr<T>& a, RefPtr<T>& b)
+{
+ a.swap(b);
+}
</ins><span class="cx">
</span><del>- template<typename T, typename U> inline bool operator!=(T* a, const RefPtr<U>& b)
- {
- return a != b.get();
- }
-
- template<typename T, typename U> inline RefPtr<T> static_pointer_cast(const RefPtr<U>& p)
- {
- return RefPtr<T>(static_cast<T*>(p.get()));
- }
</del><ins>+template<typename T, typename U> inline bool operator==(const RefPtr<T>& a, const RefPtr<U>& b)
+{
+ return a.get() == b.get();
+}
</ins><span class="cx">
</span><del>- template <typename T> struct IsSmartPtr<RefPtr<T>> {
- static const bool value = true;
- };
</del><ins>+template<typename T, typename U> inline bool operator==(const RefPtr<T>& a, U* b)
+{
+ return a.get() == b;
+}
</ins><span class="cx">
</span><ins>+template<typename T, typename U> inline bool operator==(T* a, const RefPtr<U>& b)
+{
+ return a == b.get();
+}
+
+template<typename T, typename U> inline bool operator!=(const RefPtr<T>& a, const RefPtr<U>& b)
+{
+ return a.get() != b.get();
+}
+
+template<typename T, typename U> inline bool operator!=(const RefPtr<T>& a, U* b)
+{
+ return a.get() != b;
+}
+
+template<typename T, typename U> inline bool operator!=(T* a, const RefPtr<U>& b)
+{
+ return a != b.get();
+}
+
+template<typename T, typename U> inline RefPtr<T> static_pointer_cast(const RefPtr<U>& p)
+{
+ return RefPtr<T>(static_cast<T*>(p.get()));
+}
+
+template <typename T> struct IsSmartPtr<RefPtr<T>> {
+ static const bool value = true;
+};
+
</ins><span class="cx"> } // namespace WTF
</span><span class="cx">
</span><span class="cx"> using WTF::RefPtr;
</span></span></pre></div>
<a id="trunkSourceWTFwtfRetainPtrh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WTF/wtf/RetainPtr.h (177695 => 177696)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WTF/wtf/RetainPtr.h        2014-12-23 22:14:48 UTC (rev 177695)
+++ trunk/Source/WTF/wtf/RetainPtr.h        2014-12-23 22:16:46 UTC (rev 177696)
</span><span class="lines">@@ -45,270 +45,270 @@
</span><span class="cx">
</span><span class="cx"> namespace WTF {
</span><span class="cx">
</span><del>- // Unlike most most of our smart pointers, RetainPtr can take either the pointer type or the pointed-to type,
- // so both RetainPtr<NSDictionary> and RetainPtr<CFDictionaryRef> will work.
</del><ins>+// Unlike most most of our smart pointers, RetainPtr can take either the pointer type or the pointed-to type,
+// so both RetainPtr<NSDictionary> and RetainPtr<CFDictionaryRef> will work.
</ins><span class="cx">
</span><del>- template<typename T> class RetainPtr;
</del><ins>+template<typename T> class RetainPtr;
</ins><span class="cx">
</span><del>- template<typename T> RetainPtr<T> adoptCF(T CF_RELEASES_ARGUMENT) WARN_UNUSED_RETURN;
- template<typename T> RetainPtr<T> adoptNS(T NS_RELEASES_ARGUMENT) WARN_UNUSED_RETURN;
</del><ins>+template<typename T> RetainPtr<T> adoptCF(T CF_RELEASES_ARGUMENT) WARN_UNUSED_RETURN;
+template<typename T> RetainPtr<T> adoptNS(T NS_RELEASES_ARGUMENT) WARN_UNUSED_RETURN;
</ins><span class="cx">
</span><del>- template<typename T> class RetainPtr {
- public:
- typedef typename std::remove_pointer<T>::type ValueType;
- typedef ValueType* PtrType;
- typedef CFTypeRef StorageType;
</del><ins>+template<typename T> class RetainPtr {
+public:
+ typedef typename std::remove_pointer<T>::type ValueType;
+ typedef ValueType* PtrType;
+ typedef CFTypeRef StorageType;
</ins><span class="cx">
</span><del>- RetainPtr() : m_ptr(nullptr) { }
- RetainPtr(PtrType ptr) : m_ptr(toStorageType(ptr)) { if (m_ptr) CFRetain(m_ptr); }
</del><ins>+ RetainPtr() : m_ptr(nullptr) { }
+ RetainPtr(PtrType ptr) : m_ptr(toStorageType(ptr)) { if (m_ptr) CFRetain(m_ptr); }
</ins><span class="cx">
</span><del>- RetainPtr(const RetainPtr& o) : m_ptr(o.m_ptr) { if (StorageType ptr = m_ptr) CFRetain(ptr); }
</del><ins>+ RetainPtr(const RetainPtr& o) : m_ptr(o.m_ptr) { if (StorageType ptr = m_ptr) CFRetain(ptr); }
</ins><span class="cx">
</span><del>- RetainPtr(RetainPtr&& o) : m_ptr(toStorageType(o.leakRef())) { }
- template<typename U> RetainPtr(RetainPtr<U>&& o) : m_ptr(toStorageType(o.leakRef())) { }
</del><ins>+ RetainPtr(RetainPtr&& o) : m_ptr(toStorageType(o.leakRef())) { }
+ template<typename U> RetainPtr(RetainPtr<U>&& o) : m_ptr(toStorageType(o.leakRef())) { }
</ins><span class="cx">
</span><del>- // Hash table deleted values, which are only constructed and never copied or destroyed.
- RetainPtr(HashTableDeletedValueType) : m_ptr(hashTableDeletedValue()) { }
- bool isHashTableDeletedValue() const { return m_ptr == hashTableDeletedValue(); }
-
- ~RetainPtr() { if (StorageType ptr = m_ptr) CFRelease(ptr); }
-
- template<typename U> RetainPtr(const RetainPtr<U>&);
</del><ins>+ // Hash table deleted values, which are only constructed and never copied or destroyed.
+ RetainPtr(HashTableDeletedValueType) : m_ptr(hashTableDeletedValue()) { }
+ bool isHashTableDeletedValue() const { return m_ptr == hashTableDeletedValue(); }
+
+ ~RetainPtr() { if (StorageType ptr = m_ptr) CFRelease(ptr); }
+
+ template<typename U> RetainPtr(const RetainPtr<U>&);
</ins><span class="cx">
</span><del>- void clear();
- PtrType leakRef() WARN_UNUSED_RETURN;
- PtrType autorelease();
</del><ins>+ void clear();
+ PtrType leakRef() WARN_UNUSED_RETURN;
+ PtrType autorelease();
</ins><span class="cx">
</span><del>- PtrType get() const { return fromStorageType(m_ptr); }
- PtrType operator->() const { return fromStorageType(m_ptr); }
- explicit operator PtrType() const { return fromStorageType(m_ptr); }
- explicit operator bool() const { return m_ptr; }
</del><ins>+ PtrType get() const { return fromStorageType(m_ptr); }
+ PtrType operator->() const { return fromStorageType(m_ptr); }
+ explicit operator PtrType() const { return fromStorageType(m_ptr); }
+ explicit operator bool() const { return m_ptr; }
</ins><span class="cx">
</span><del>- bool operator!() const { return !m_ptr; }
</del><ins>+ bool operator!() const { return !m_ptr; }
+
+ // This conversion operator allows implicit conversion to bool but not to other integer types.
+ typedef StorageType RetainPtr::*UnspecifiedBoolType;
+ operator UnspecifiedBoolType() const { return m_ptr ? &RetainPtr::m_ptr : nullptr; }
</ins><span class="cx">
</span><del>- // This conversion operator allows implicit conversion to bool but not to other integer types.
- typedef StorageType RetainPtr::*UnspecifiedBoolType;
- operator UnspecifiedBoolType() const { return m_ptr ? &RetainPtr::m_ptr : nullptr; }
-
- RetainPtr& operator=(const RetainPtr&);
- template<typename U> RetainPtr& operator=(const RetainPtr<U>&);
- RetainPtr& operator=(PtrType);
- template<typename U> RetainPtr& operator=(U*);
</del><ins>+ RetainPtr& operator=(const RetainPtr&);
+ template<typename U> RetainPtr& operator=(const RetainPtr<U>&);
+ RetainPtr& operator=(PtrType);
+ template<typename U> RetainPtr& operator=(U*);
</ins><span class="cx">
</span><del>- RetainPtr& operator=(RetainPtr&&);
- template<typename U> RetainPtr& operator=(RetainPtr<U>&&);
</del><ins>+ RetainPtr& operator=(RetainPtr&&);
+ template<typename U> RetainPtr& operator=(RetainPtr<U>&&);
</ins><span class="cx">
</span><del>- void swap(RetainPtr&);
</del><ins>+ void swap(RetainPtr&);
</ins><span class="cx">
</span><del>- template<typename U> friend RetainPtr<U> adoptCF(U CF_RELEASES_ARGUMENT) WARN_UNUSED_RETURN;
- template<typename U> friend RetainPtr<U> adoptNS(U NS_RELEASES_ARGUMENT) WARN_UNUSED_RETURN;
</del><ins>+ template<typename U> friend RetainPtr<U> adoptCF(U CF_RELEASES_ARGUMENT) WARN_UNUSED_RETURN;
+ template<typename U> friend RetainPtr<U> adoptNS(U NS_RELEASES_ARGUMENT) WARN_UNUSED_RETURN;
</ins><span class="cx">
</span><del>- private:
- enum AdoptTag { Adopt };
- RetainPtr(PtrType ptr, AdoptTag) : m_ptr(toStorageType(ptr)) { }
</del><ins>+private:
+ enum AdoptTag { Adopt };
+ RetainPtr(PtrType ptr, AdoptTag) : m_ptr(toStorageType(ptr)) { }
</ins><span class="cx">
</span><del>- static PtrType hashTableDeletedValue() { return reinterpret_cast<PtrType>(-1); }
</del><ins>+ static PtrType hashTableDeletedValue() { return reinterpret_cast<PtrType>(-1); }
</ins><span class="cx">
</span><span class="cx"> #if defined (__OBJC__) && __has_feature(objc_arc)
</span><del>- template<typename U>
- typename std::enable_if<std::is_convertible<U, id>::value, PtrType>::type
- fromStorageTypeHelper(StorageType ptr) const
- {
- return (__bridge PtrType)ptr;
- }
</del><ins>+ template<typename U>
+ typename std::enable_if<std::is_convertible<U, id>::value, PtrType>::type
+ fromStorageTypeHelper(StorageType ptr) const
+ {
+ return (__bridge PtrType)ptr;
+ }
</ins><span class="cx">
</span><del>- template<typename U>
- typename std::enable_if<!std::is_convertible<U, id>::value, PtrType>::type
- fromStorageTypeHelper(StorageType ptr) const
- {
- return (PtrType)ptr;
- }
</del><ins>+ template<typename U>
+ typename std::enable_if<!std::is_convertible<U, id>::value, PtrType>::type
+ fromStorageTypeHelper(StorageType ptr) const
+ {
+ return (PtrType)ptr;
+ }
</ins><span class="cx">
</span><del>- PtrType fromStorageType(StorageType ptr) const { return fromStorageTypeHelper<PtrType>(ptr); }
- StorageType toStorageType(id ptr) const { return (__bridge StorageType)ptr; }
- StorageType toStorageType(CFTypeRef ptr) const { return (StorageType)ptr; }
</del><ins>+ PtrType fromStorageType(StorageType ptr) const { return fromStorageTypeHelper<PtrType>(ptr); }
+ StorageType toStorageType(id ptr) const { return (__bridge StorageType)ptr; }
+ StorageType toStorageType(CFTypeRef ptr) const { return (StorageType)ptr; }
</ins><span class="cx"> #else
</span><del>- PtrType fromStorageType(StorageType ptr) const { return (PtrType)ptr; }
- StorageType toStorageType(PtrType ptr) const { return (StorageType)ptr; }
</del><ins>+ PtrType fromStorageType(StorageType ptr) const { return (PtrType)ptr; }
+ StorageType toStorageType(PtrType ptr) const { return (StorageType)ptr; }
</ins><span class="cx"> #endif
</span><span class="cx">
</span><del>- StorageType m_ptr;
- };
</del><ins>+ StorageType m_ptr;
+};
</ins><span class="cx">
</span><del>- // Helper function for creating a RetainPtr using template argument deduction.
- template<typename T> inline RetainPtr<T> retainPtr(T) WARN_UNUSED_RETURN;
</del><ins>+// Helper function for creating a RetainPtr using template argument deduction.
+template<typename T> inline RetainPtr<T> retainPtr(T) WARN_UNUSED_RETURN;
</ins><span class="cx">
</span><del>- template<typename T> template<typename U> inline RetainPtr<T>::RetainPtr(const RetainPtr<U>& o)
- : m_ptr(toStorageType(o.get()))
- {
- if (StorageType ptr = m_ptr)
- CFRetain(ptr);
- }
</del><ins>+template<typename T> template<typename U> inline RetainPtr<T>::RetainPtr(const RetainPtr<U>& o)
+ : m_ptr(toStorageType(o.get()))
+{
+ if (StorageType ptr = m_ptr)
+ CFRetain(ptr);
+}
</ins><span class="cx">
</span><del>- template<typename T> inline void RetainPtr<T>::clear()
- {
- if (StorageType ptr = m_ptr) {
- m_ptr = nullptr;
- CFRelease(ptr);
- }
</del><ins>+template<typename T> inline void RetainPtr<T>::clear()
+{
+ if (StorageType ptr = m_ptr) {
+ m_ptr = nullptr;
+ CFRelease(ptr);
</ins><span class="cx"> }
</span><ins>+}
</ins><span class="cx">
</span><del>- template<typename T> inline typename RetainPtr<T>::PtrType RetainPtr<T>::leakRef()
- {
- return fromStorageType(std::exchange(m_ptr, nullptr));
- }
</del><ins>+template<typename T> inline typename RetainPtr<T>::PtrType RetainPtr<T>::leakRef()
+{
+ return fromStorageType(std::exchange(m_ptr, nullptr));
+}
</ins><span class="cx">
</span><span class="cx"> #ifdef __OBJC__
</span><del>- template<typename T> inline auto RetainPtr<T>::autorelease() -> PtrType
- {
- return (__bridge PtrType)CFBridgingRelease(leakRef());
- }
</del><ins>+template<typename T> inline auto RetainPtr<T>::autorelease() -> PtrType
+{
+ return (__bridge PtrType)CFBridgingRelease(leakRef());
+}
</ins><span class="cx"> #endif
</span><span class="cx">
</span><del>- template<typename T> inline RetainPtr<T>& RetainPtr<T>::operator=(const RetainPtr& o)
- {
- RetainPtr ptr = o;
- swap(ptr);
- return *this;
- }
</del><ins>+template<typename T> inline RetainPtr<T>& RetainPtr<T>::operator=(const RetainPtr& o)
+{
+ RetainPtr ptr = o;
+ swap(ptr);
+ return *this;
+}
</ins><span class="cx">
</span><del>- template<typename T> template<typename U> inline RetainPtr<T>& RetainPtr<T>::operator=(const RetainPtr<U>& o)
- {
- RetainPtr ptr = o;
- swap(ptr);
- return *this;
- }
</del><ins>+template<typename T> template<typename U> inline RetainPtr<T>& RetainPtr<T>::operator=(const RetainPtr<U>& o)
+{
+ RetainPtr ptr = o;
+ swap(ptr);
+ return *this;
+}
</ins><span class="cx">
</span><del>- template<typename T> inline RetainPtr<T>& RetainPtr<T>::operator=(PtrType optr)
- {
- RetainPtr ptr = optr;
- swap(ptr);
- return *this;
- }
</del><ins>+template<typename T> inline RetainPtr<T>& RetainPtr<T>::operator=(PtrType optr)
+{
+ RetainPtr ptr = optr;
+ swap(ptr);
+ return *this;
+}
</ins><span class="cx">
</span><del>- template<typename T> template<typename U> inline RetainPtr<T>& RetainPtr<T>::operator=(U* optr)
- {
- RetainPtr ptr = optr;
- swap(ptr);
- return *this;
- }
</del><ins>+template<typename T> template<typename U> inline RetainPtr<T>& RetainPtr<T>::operator=(U* optr)
+{
+ RetainPtr ptr = optr;
+ swap(ptr);
+ return *this;
+}
</ins><span class="cx">
</span><del>- template<typename T> inline RetainPtr<T>& RetainPtr<T>::operator=(RetainPtr&& o)
- {
- RetainPtr ptr = WTF::move(o);
- swap(ptr);
- return *this;
- }
</del><ins>+template<typename T> inline RetainPtr<T>& RetainPtr<T>::operator=(RetainPtr&& o)
+{
+ RetainPtr ptr = WTF::move(o);
+ swap(ptr);
+ return *this;
+}
</ins><span class="cx">
</span><del>- template<typename T> template<typename U> inline RetainPtr<T>& RetainPtr<T>::operator=(RetainPtr<U>&& o)
- {
- RetainPtr ptr = WTF::move(o);
- swap(ptr);
- return *this;
- }
</del><ins>+template<typename T> template<typename U> inline RetainPtr<T>& RetainPtr<T>::operator=(RetainPtr<U>&& o)
+{
+ RetainPtr ptr = WTF::move(o);
+ swap(ptr);
+ return *this;
+}
</ins><span class="cx">
</span><del>- template<typename T> inline void RetainPtr<T>::swap(RetainPtr& o)
- {
- std::swap(m_ptr, o.m_ptr);
- }
</del><ins>+template<typename T> inline void RetainPtr<T>::swap(RetainPtr& o)
+{
+ std::swap(m_ptr, o.m_ptr);
+}
</ins><span class="cx">
</span><del>- template<typename T> inline void swap(RetainPtr<T>& a, RetainPtr<T>& b)
- {
- a.swap(b);
- }
</del><ins>+template<typename T> inline void swap(RetainPtr<T>& a, RetainPtr<T>& b)
+{
+ a.swap(b);
+}
</ins><span class="cx">
</span><del>- template<typename T, typename U> inline bool operator==(const RetainPtr<T>& a, const RetainPtr<U>& b)
- {
- return a.get() == b.get();
- }
</del><ins>+template<typename T, typename U> inline bool operator==(const RetainPtr<T>& a, const RetainPtr<U>& b)
+{
+ return a.get() == b.get();
+}
</ins><span class="cx">
</span><del>- template<typename T, typename U> inline bool operator==(const RetainPtr<T>& a, U* b)
- {
- return a.get() == b;
- }
</del><ins>+template<typename T, typename U> inline bool operator==(const RetainPtr<T>& a, U* b)
+{
+ return a.get() == b;
+}
</ins><span class="cx">
</span><del>- template<typename T, typename U> inline bool operator==(T* a, const RetainPtr<U>& b)
- {
- return a == b.get();
- }
</del><ins>+template<typename T, typename U> inline bool operator==(T* a, const RetainPtr<U>& b)
+{
+ return a == b.get();
+}
</ins><span class="cx">
</span><del>- template<typename T, typename U> inline bool operator!=(const RetainPtr<T>& a, const RetainPtr<U>& b)
- {
- return a.get() != b.get();
- }
</del><ins>+template<typename T, typename U> inline bool operator!=(const RetainPtr<T>& a, const RetainPtr<U>& b)
+{
+ return a.get() != b.get();
+}
</ins><span class="cx">
</span><del>- template<typename T, typename U> inline bool operator!=(const RetainPtr<T>& a, U* b)
- {
- return a.get() != b;
- }
</del><ins>+template<typename T, typename U> inline bool operator!=(const RetainPtr<T>& a, U* b)
+{
+ return a.get() != b;
+}
</ins><span class="cx">
</span><del>- template<typename T, typename U> inline bool operator!=(T* a, const RetainPtr<U>& b)
- {
- return a != b.get();
- }
</del><ins>+template<typename T, typename U> inline bool operator!=(T* a, const RetainPtr<U>& b)
+{
+ return a != b.get();
+}
</ins><span class="cx">
</span><del>- template<typename T> inline RetainPtr<T> adoptCF(T CF_RELEASES_ARGUMENT ptr)
- {
</del><ins>+template<typename T> inline RetainPtr<T> adoptCF(T CF_RELEASES_ARGUMENT ptr)
+{
</ins><span class="cx"> #ifdef __OBJC__
</span><del>- static_assert((!std::is_convertible<T, id>::value), "Don't use adoptCF with Objective-C pointer types, use adoptNS.");
</del><ins>+ static_assert((!std::is_convertible<T, id>::value), "Don't use adoptCF with Objective-C pointer types, use adoptNS.");
</ins><span class="cx"> #endif
</span><del>- return RetainPtr<T>(ptr, RetainPtr<T>::Adopt);
- }
</del><ins>+ return RetainPtr<T>(ptr, RetainPtr<T>::Adopt);
+}
</ins><span class="cx">
</span><span class="cx"> #ifdef __OBJC__
</span><del>- template<typename T> inline RetainPtr<T> adoptNS(T NS_RELEASES_ARGUMENT ptr)
- {
</del><ins>+template<typename T> inline RetainPtr<T> adoptNS(T NS_RELEASES_ARGUMENT ptr)
+{
</ins><span class="cx"> #if __has_feature(objc_arc)
</span><del>- return ptr;
</del><ins>+ return ptr;
</ins><span class="cx"> #elif defined(OBJC_NO_GC)
</span><del>- return RetainPtr<T>(ptr, RetainPtr<T>::Adopt);
</del><ins>+ return RetainPtr<T>(ptr, RetainPtr<T>::Adopt);
</ins><span class="cx"> #else
</span><del>- RetainPtr<T> result = ptr;
- [ptr release];
- return result;
</del><ins>+ RetainPtr<T> result = ptr;
+ [ptr release];
+ return result;
</ins><span class="cx"> #endif
</span><del>- }
</del><ins>+}
</ins><span class="cx"> #endif
</span><span class="cx">
</span><del>- template<typename T> inline RetainPtr<T> retainPtr(T ptr)
- {
- return ptr;
- }
</del><ins>+template<typename T> inline RetainPtr<T> retainPtr(T ptr)
+{
+ return ptr;
+}
</ins><span class="cx">
</span><del>- template <typename T> struct IsSmartPtr<RetainPtr<T>> {
- static const bool value = true;
- };
</del><ins>+template <typename T> struct IsSmartPtr<RetainPtr<T>> {
+ static const bool value = true;
+};
</ins><span class="cx">
</span><del>- template<typename P> struct HashTraits<RetainPtr<P>> : SimpleClassHashTraits<RetainPtr<P>> {
- };
-
- template<typename P> struct DefaultHash<RetainPtr<P>> {
- typedef PtrHash<RetainPtr<P>> Hash;
- };
</del><ins>+template<typename P> struct HashTraits<RetainPtr<P>> : SimpleClassHashTraits<RetainPtr<P>> {
+};
</ins><span class="cx">
</span><del>- template <typename P>
- struct RetainPtrObjectHashTraits : SimpleClassHashTraits<RetainPtr<P>> {
- static const RetainPtr<P>& emptyValue()
- {
- static RetainPtr<P>& null = *(new RetainPtr<P>);
- return null;
- }
- };
</del><ins>+template<typename P> struct DefaultHash<RetainPtr<P>> {
+ typedef PtrHash<RetainPtr<P>> Hash;
+};
</ins><span class="cx">
</span><del>- template <typename P>
- struct RetainPtrObjectHash {
- static unsigned hash(const RetainPtr<P>& o)
- {
- ASSERT_WITH_MESSAGE(o.get(), "attempt to use null RetainPtr in HashTable");
- return static_cast<unsigned>(CFHash(o.get()));
- }
- static bool equal(const RetainPtr<P>& a, const RetainPtr<P>& b)
- {
- return CFEqual(a.get(), b.get());
- }
- static const bool safeToCompareToEmptyOrDeleted = false;
- };
</del><ins>+template <typename P>
+struct RetainPtrObjectHashTraits : SimpleClassHashTraits<RetainPtr<P>> {
+ static const RetainPtr<P>& emptyValue()
+ {
+ static RetainPtr<P>& null = *(new RetainPtr<P>);
+ return null;
+ }
+};
</ins><span class="cx">
</span><ins>+template <typename P>
+struct RetainPtrObjectHash {
+ static unsigned hash(const RetainPtr<P>& o)
+ {
+ ASSERT_WITH_MESSAGE(o.get(), "attempt to use null RetainPtr in HashTable");
+ return static_cast<unsigned>(CFHash(o.get()));
+ }
+ static bool equal(const RetainPtr<P>& a, const RetainPtr<P>& b)
+ {
+ return CFEqual(a.get(), b.get());
+ }
+ static const bool safeToCompareToEmptyOrDeleted = false;
+};
+
</ins><span class="cx"> } // namespace WTF
</span><span class="cx">
</span><span class="cx"> using WTF::RetainPtr;
</span></span></pre>
</div>
</div>
</body>
</html>