| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. | 2 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 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 26 matching lines...) Expand all Loading... |
| 37 class RefPtr; | 37 class RefPtr; |
| 38 template <typename T> | 38 template <typename T> |
| 39 class PassRefPtr; | 39 class PassRefPtr; |
| 40 template <typename T> | 40 template <typename T> |
| 41 PassRefPtr<T> adoptRef(T*); | 41 PassRefPtr<T> adoptRef(T*); |
| 42 | 42 |
| 43 inline void adopted(const void*) {} | 43 inline void adopted(const void*) {} |
| 44 | 44 |
| 45 // requireAdoption() is not overloaded for WTF::RefCounted, which has a built-in | 45 // requireAdoption() is not overloaded for WTF::RefCounted, which has a built-in |
| 46 // assumption that adoption is required. requireAdoption() is for bootstrapping | 46 // assumption that adoption is required. requireAdoption() is for bootstrapping |
| 47 // alternate reference count classes that are compatible with ReftPtr/PassRefPtr | 47 // alternate reference count classes that are compatible with RefPtr/PassRefPtr |
| 48 // but cannot have adoption checks enabled by default, such as skia's | 48 // but cannot have adoption checks enabled by default, such as skia's |
| 49 // SkRefCnt. The purpose of requireAdoption() is to enable adoption checks only | 49 // SkRefCnt. The purpose of requireAdoption() is to enable adoption checks only |
| 50 // once it is known that the object will be used with RefPtr/PassRefPtr. | 50 // once it is known that the object will be used with RefPtr/PassRefPtr. |
| 51 inline void requireAdoption(const void*) {} | 51 inline void requireAdoption(const void*) {} |
| 52 | 52 |
| 53 template <typename T> | 53 template <typename T> |
| 54 ALWAYS_INLINE void refIfNotNull(T* ptr) { | 54 ALWAYS_INLINE void refIfNotNull(T* ptr) { |
| 55 if (LIKELY(ptr != 0)) { | 55 if (LIKELY(ptr != 0)) { |
| 56 requireAdoption(ptr); | 56 requireAdoption(ptr); |
| 57 ptr->ref(); | 57 ptr->ref(); |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 215 inline T* getPtr(const PassRefPtr<T>& p) { | 215 inline T* getPtr(const PassRefPtr<T>& p) { |
| 216 return p.get(); | 216 return p.get(); |
| 217 } | 217 } |
| 218 | 218 |
| 219 } // namespace WTF | 219 } // namespace WTF |
| 220 | 220 |
| 221 using WTF::PassRefPtr; | 221 using WTF::PassRefPtr; |
| 222 using WTF::adoptRef; | 222 using WTF::adoptRef; |
| 223 | 223 |
| 224 #endif // WTF_PassRefPtr_h | 224 #endif // WTF_PassRefPtr_h |
| OLD | NEW |