Chromium Code Reviews| Index: Source/wtf/PassRefPtr.h |
| diff --git a/Source/wtf/PassRefPtr.h b/Source/wtf/PassRefPtr.h |
| index 84f228f8b659612557801c399b616053d2d312a0..4e9b79fa60113d57ea62b4861b86e32ac1294612 100644 |
| --- a/Source/wtf/PassRefPtr.h |
| +++ b/Source/wtf/PassRefPtr.h |
| @@ -33,10 +33,21 @@ namespace WTF { |
| inline void adopted(const void*) { } |
| + // adoptionRequired() is not overloaded for WTF::RefCounted, which has a |
| + // built-in assumption that adoption is required. adoptionRequired() is |
| + // for bootstrapping alternate reference count classes that are compatible |
| + // with ReftPtr/PassRefPtr but cannot have adoption checks enabled |
| + // by default, such as skia's SkRefCnt. The purpose of adoptionRequired() |
| + // is to enable adoption checks only once it is known that the object will |
| + // be used with RefPtr/PassRefPtr. |
| + inline void adoptionRequired(const void*) { } |
|
abarth-chromium
2013/10/04 20:37:58
adoptionRequired -> requireAdoption ? setAdoption
|
| + |
| template<typename T> ALWAYS_INLINE void refIfNotNull(T* ptr) |
| { |
| - if (LIKELY(ptr != 0)) |
| + if (LIKELY(ptr != 0)) { |
| + adoptionRequired(ptr); |
| ptr->ref(); |
| + } |
| } |
| template<typename T> ALWAYS_INLINE void derefIfNotNull(T* ptr) |