Chromium Code Reviews| Index: Source/wtf/RawPtr.h |
| diff --git a/Source/wtf/RawPtr.h b/Source/wtf/RawPtr.h |
| index d0c0d8019a83e3cce36f73ddce76dd1df058bdf4..5c07fa079dd42cde43cd39b5f8569af05e410bd7 100644 |
| --- a/Source/wtf/RawPtr.h |
| +++ b/Source/wtf/RawPtr.h |
| @@ -48,7 +48,12 @@ class RawPtr { |
| WTF_DISALLOW_CONSTRUCTION_FROM_ZERO(RawPtr); |
| WTF_DISALLOW_ZERO_ASSIGNMENT(RawPtr); |
| public: |
| - RawPtr() : m_ptr(0) { } |
| + RawPtr() |
| + { |
| +#ifndef NDEBUG |
| + m_ptr = reinterpret_cast<T*>(rawPtrZapValue); |
| +#endif |
| + } |
| RawPtr(std::nullptr_t) : m_ptr(0) { } |
| RawPtr(T* ptr) : m_ptr(ptr) { } |
| explicit RawPtr(T& reference) : m_ptr(&reference) { } |
| @@ -116,6 +121,7 @@ public: |
| static T* hashTableDeletedValue() { return reinterpret_cast<T*>(-1); } |
| private: |
| + static const uintptr_t rawPtrZapValue = 0x3a3a3a3a; |
|
tkent
2014/03/24 09:27:06
nit: I prefer an odd number.
|
| T* m_ptr; |
| }; |