Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2544)

Unified Diff: Source/wtf/RawPtr.h

Issue 209433004: Do not zero-initialize RawPtr. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
};
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698