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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 RefPtr(HashTableDeletedValueType) : ptr_(HashTableDeletedValue()) {} | 63 RefPtr(HashTableDeletedValueType) : ptr_(HashTableDeletedValue()) {} |
64 bool IsHashTableDeletedValue() const { | 64 bool IsHashTableDeletedValue() const { |
65 return ptr_ == HashTableDeletedValue(); | 65 return ptr_ == HashTableDeletedValue(); |
66 } | 66 } |
67 | 67 |
68 ALWAYS_INLINE ~RefPtr() { DerefIfNotNull(ptr_); } | 68 ALWAYS_INLINE ~RefPtr() { DerefIfNotNull(ptr_); } |
69 | 69 |
70 ALWAYS_INLINE T* Get() const { return ptr_; } | 70 ALWAYS_INLINE T* Get() const { return ptr_; } |
71 T* LeakRef() WARN_UNUSED_RESULT; | 71 T* LeakRef() WARN_UNUSED_RESULT; |
72 void Clear(); | 72 void Clear(); |
73 PassRefPtr<T> Release() { | 73 PassRefPtr<T> Release() WARN_UNUSED_RESULT { |
74 PassRefPtr<T> tmp = AdoptRef(ptr_); | 74 PassRefPtr<T> tmp = AdoptRef(ptr_); |
75 ptr_ = nullptr; | 75 ptr_ = nullptr; |
76 return tmp; | 76 return tmp; |
77 } | 77 } |
78 | 78 |
79 T& operator*() const { return *ptr_; } | 79 T& operator*() const { return *ptr_; } |
80 ALWAYS_INLINE T* operator->() const { return ptr_; } | 80 ALWAYS_INLINE T* operator->() const { return ptr_; } |
81 | 81 |
82 bool operator!() const { return !ptr_; } | 82 bool operator!() const { return !ptr_; } |
83 explicit operator bool() const { return ptr_ != nullptr; } | 83 explicit operator bool() const { return ptr_ != nullptr; } |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
210 | 210 |
211 private: | 211 private: |
212 T* ptr_; | 212 T* ptr_; |
213 }; | 213 }; |
214 | 214 |
215 } // namespace WTF | 215 } // namespace WTF |
216 | 216 |
217 using WTF::RefPtr; | 217 using WTF::RefPtr; |
218 | 218 |
219 #endif // WTF_RefPtr_h | 219 #endif // WTF_RefPtr_h |
OLD | NEW |