OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2013 Apple Inc. | 2 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2013 Apple Inc. |
3 * All rights reserved. | 3 * All rights reserved. |
4 * | 4 * |
5 * This library is free software; you can redistribute it and/or | 5 * This library is free software; you can redistribute it and/or |
6 * modify it under the terms of the GNU Library General Public | 6 * modify it under the terms of the GNU Library General Public |
7 * License as published by the Free Software Foundation; either | 7 * License as published by the Free Software Foundation; either |
8 * version 2 of the License, or (at your option) any later version. | 8 * version 2 of the License, or (at your option) any later version. |
9 * | 9 * |
10 * This library is distributed in the hope that it will be useful, | 10 * This library is distributed in the hope that it will be useful, |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 RefPtr(HashTableDeletedValueType) : ptr_(HashTableDeletedValue()) {} | 73 RefPtr(HashTableDeletedValueType) : ptr_(HashTableDeletedValue()) {} |
74 bool IsHashTableDeletedValue() const { | 74 bool IsHashTableDeletedValue() const { |
75 return ptr_ == HashTableDeletedValue(); | 75 return ptr_ == HashTableDeletedValue(); |
76 } | 76 } |
77 | 77 |
78 ALWAYS_INLINE ~RefPtr() { DerefIfNotNull(ptr_); } | 78 ALWAYS_INLINE ~RefPtr() { DerefIfNotNull(ptr_); } |
79 | 79 |
80 ALWAYS_INLINE T* Get() const { return ptr_; } | 80 ALWAYS_INLINE T* Get() const { return ptr_; } |
81 T* LeakRef() WARN_UNUSED_RESULT; | 81 T* LeakRef() WARN_UNUSED_RESULT; |
82 void Clear(); | 82 void Clear(); |
83 PassRefPtr<T> Release() WARN_UNUSED_RESULT { return std::move(*this); } | |
84 | 83 |
85 T& operator*() const { return *ptr_; } | 84 T& operator*() const { return *ptr_; } |
86 ALWAYS_INLINE T* operator->() const { return ptr_; } | 85 ALWAYS_INLINE T* operator->() const { return ptr_; } |
87 | 86 |
88 bool operator!() const { return !ptr_; } | 87 bool operator!() const { return !ptr_; } |
89 explicit operator bool() const { return ptr_ != nullptr; } | 88 explicit operator bool() const { return ptr_ != nullptr; } |
90 | 89 |
91 RefPtr& operator=(RefPtr o) { | 90 RefPtr& operator=(RefPtr o) { |
92 Swap(o); | 91 Swap(o); |
93 return *this; | 92 return *this; |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
228 Adopted(p); | 227 Adopted(p); |
229 return RefPtr<T>(p, RefPtr<T>::kAdoptRef); | 228 return RefPtr<T>(p, RefPtr<T>::kAdoptRef); |
230 } | 229 } |
231 | 230 |
232 } // namespace WTF | 231 } // namespace WTF |
233 | 232 |
234 using WTF::RefPtr; | 233 using WTF::RefPtr; |
235 using WTF::AdoptRef; | 234 using WTF::AdoptRef; |
236 | 235 |
237 #endif // WTF_RefPtr_h | 236 #endif // WTF_RefPtr_h |
OLD | NEW |