| 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 explicit operator bool() const { return m_ptr; } | 73 |
| 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; } |
| 74 | 77 |
| 75 RefPtr& operator=(RefPtr o) { swap(o); return *this; } | 78 RefPtr& operator=(RefPtr o) { swap(o); return *this; } |
| 76 RefPtr& operator=(std::nullptr_t) { clear(); return *this; } | 79 RefPtr& operator=(std::nullptr_t) { clear(); return *this; } |
| 77 // This is required by HashMap<RefPtr>>. | 80 // This is required by HashMap<RefPtr>>. |
| 78 template <typename U> RefPtr& operator=(RefPtrValuePeeker<U>); | 81 template <typename U> RefPtr& operator=(RefPtrValuePeeker<U>); |
| 79 | 82 |
| 80 void swap(RefPtr&); | 83 void swap(RefPtr&); |
| 81 | 84 |
| 82 static T* hashTableDeletedValue() { return reinterpret_cast<T*>(-1); } | 85 static T* hashTableDeletedValue() { return reinterpret_cast<T*>(-1); } |
| 83 | 86 |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 188 private: | 191 private: |
| 189 T* m_ptr; | 192 T* m_ptr; |
| 190 }; | 193 }; |
| 191 | 194 |
| 192 } // namespace WTF | 195 } // namespace WTF |
| 193 | 196 |
| 194 using WTF::RefPtr; | 197 using WTF::RefPtr; |
| 195 using WTF::static_pointer_cast; | 198 using WTF::static_pointer_cast; |
| 196 | 199 |
| 197 #endif // WTF_RefPtr_h | 200 #endif // WTF_RefPtr_h |
| OLD | NEW |