Bug 867530 - Make the current poison consumers use the new API. r=roc

This commit is contained in:
Mats Palmgren 2013-05-07 20:48:59 +02:00
parent 40741f4bf9
commit 10834724ee
3 changed files with 5 additions and 15 deletions

View File

@ -108,11 +108,7 @@ nsPresArena::Free(uint32_t aCode, void* aPtr)
NS_ABORT_IF_FALSE(list, "no free list for pres arena object");
NS_ABORT_IF_FALSE(list->mEntrySize > 0, "PresArena cannot free zero bytes");
char* p = reinterpret_cast<char*>(aPtr);
char* limit = p + list->mEntrySize;
for (; p < limit; p += sizeof(uintptr_t)) {
*reinterpret_cast<uintptr_t*>(p) = mozPoisonValue();
}
mozWritePoison(aPtr, list->mEntrySize);
MOZ_MAKE_MEM_NOACCESS(aPtr, list->mEntrySize);
list->mEntries.AppendElement(aPtr);

View File

@ -4,8 +4,8 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "nsRuleData.h"
#include "nsPresArena.h"
#include "mozilla/Poison.h"
#include "mozilla/StandardInteger.h"
inline size_t
@ -20,7 +20,7 @@ nsRuleData::GetPoisonOffset()
"expect uintptr_t to be unsigned");
MOZ_STATIC_ASSERT(size_t(-1) > size_t(0),
"expect size_t to be unsigned");
uintptr_t framePoisonValue = nsPresArena::GetPoisonValue();
uintptr_t framePoisonValue = mozPoisonValue();
return size_t(framePoisonValue - uintptr_t(mValueStorage)) /
sizeof(nsCSSValue);
}

View File

@ -8,6 +8,7 @@
#include "mozilla/Attributes.h"
#include "mozilla/DebugOnly.h"
#include "mozilla/Likely.h"
#include "mozilla/Poison.h"
#include "nsIWidget.h"
#include "nsViewManager.h"
#include "nsIFrame.h"
@ -132,14 +133,7 @@ nsView* nsView::GetViewFor(nsIWidget* aWidget)
void nsView::Destroy()
{
this->~nsView();
const uintptr_t POISON = nsPresArena::GetPoisonValue();
char* p = reinterpret_cast<char*>(this);
char* limit = p + sizeof(*this);
for (; p < limit; p += sizeof(uintptr_t)) {
*reinterpret_cast<uintptr_t*>(p) = POISON;
}
mozWritePoison(this, sizeof(*this));
nsView::operator delete(this);
}