| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2013 Apple Inc. All rights
reserved. | 2 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2013 Apple Inc. All rights
reserved. |
| 3 * | 3 * |
| 4 * This library is free software; you can redistribute it and/or | 4 * This library is free software; you can redistribute it and/or |
| 5 * modify it under the terms of the GNU Library General Public | 5 * modify it under the terms of the GNU Library General Public |
| 6 * License as published by the Free Software Foundation; either | 6 * License as published by the Free Software Foundation; either |
| 7 * version 2 of the License, or (at your option) any later version. | 7 * version 2 of the License, or (at your option) any later version. |
| 8 * | 8 * |
| 9 * This library is distributed in the hope that it will be useful, | 9 * This library is distributed in the hope that it will be useful, |
| 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 { | 63 { |
| 64 PassRefPtr<T> tmp = adoptRef(m_ptr); | 64 PassRefPtr<T> tmp = adoptRef(m_ptr); |
| 65 m_ptr = nullptr; | 65 m_ptr = nullptr; |
| 66 return tmp; | 66 return tmp; |
| 67 } | 67 } |
| 68 | 68 |
| 69 T& operator*() const { return *m_ptr; } | 69 T& operator*() const { return *m_ptr; } |
| 70 ALWAYS_INLINE T* operator->() const { return m_ptr; } | 70 ALWAYS_INLINE T* operator->() const { return m_ptr; } |
| 71 | 71 |
| 72 bool operator!() const { return !m_ptr; } | 72 bool operator!() const { return !m_ptr; } |
| 73 | 73 explicit operator bool() const { return m_ptr != nullptr; } |
| 74 // TODO(jbroman): Simplifying this in the obvious way causes a massive | |
| 75 // regression in a perf test on ARM. http://crbug.com/607208 | |
| 76 explicit operator bool() const { return m_ptr ? &RefPtr::m_ptr : 0; } | |
| 77 | 74 |
| 78 RefPtr& operator=(RefPtr o) { swap(o); return *this; } | 75 RefPtr& operator=(RefPtr o) { swap(o); return *this; } |
| 79 RefPtr& operator=(std::nullptr_t) { clear(); return *this; } | 76 RefPtr& operator=(std::nullptr_t) { clear(); return *this; } |
| 80 // This is required by HashMap<RefPtr>>. | 77 // This is required by HashMap<RefPtr>>. |
| 81 template <typename U> RefPtr& operator=(RefPtrValuePeeker<U>); | 78 template <typename U> RefPtr& operator=(RefPtrValuePeeker<U>); |
| 82 | 79 |
| 83 void swap(RefPtr&); | 80 void swap(RefPtr&); |
| 84 | 81 |
| 85 static T* hashTableDeletedValue() { return reinterpret_cast<T*>(-1); } | 82 static T* hashTableDeletedValue() { return reinterpret_cast<T*>(-1); } |
| 86 | 83 |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 191 private: | 188 private: |
| 192 T* m_ptr; | 189 T* m_ptr; |
| 193 }; | 190 }; |
| 194 | 191 |
| 195 } // namespace WTF | 192 } // namespace WTF |
| 196 | 193 |
| 197 using WTF::RefPtr; | 194 using WTF::RefPtr; |
| 198 using WTF::static_pointer_cast; | 195 using WTF::static_pointer_cast; |
| 199 | 196 |
| 200 #endif // WTF_RefPtr_h | 197 #endif // WTF_RefPtr_h |
| OLD | NEW |