diff options
Diffstat (limited to 'src/3rdparty/webkit/JavaScriptCore/wtf/PtrAndFlags.h')
-rw-r--r-- | src/3rdparty/webkit/JavaScriptCore/wtf/PtrAndFlags.h | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/PtrAndFlags.h b/src/3rdparty/webkit/JavaScriptCore/wtf/PtrAndFlags.h index 477e893..f4527df 100644 --- a/src/3rdparty/webkit/JavaScriptCore/wtf/PtrAndFlags.h +++ b/src/3rdparty/webkit/JavaScriptCore/wtf/PtrAndFlags.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, Google Inc. All rights reserved. + * Copyright (C) 2009 Google Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -42,9 +42,20 @@ namespace WTF { void setFlag(FlagEnum flagNumber) { ASSERT(flagNumber < 2); m_ptrAndFlags |= (1 << flagNumber);} void clearFlag(FlagEnum flagNumber) { ASSERT(flagNumber < 2); m_ptrAndFlags &= ~(1 << flagNumber);} T* get() const { return reinterpret_cast<T*>(m_ptrAndFlags & ~3); } - void set(T* ptr) { ASSERT(!(reinterpret_cast<intptr_t>(ptr) & 3)); m_ptrAndFlags = reinterpret_cast<intptr_t>(ptr) | (m_ptrAndFlags & 3);} + void set(T* ptr) + { + ASSERT(!(reinterpret_cast<intptr_t>(ptr) & 3)); + m_ptrAndFlags = reinterpret_cast<intptr_t>(ptr) | (m_ptrAndFlags & 3); +#ifndef NDEBUG + m_leaksPtr = ptr; +#endif + } + private: intptr_t m_ptrAndFlags; +#ifndef NDEBUG + void* m_leaksPtr; // Only used to allow tools like leaks on OSX to detect that the memory is referenced. +#endif }; } // namespace WTF |