Bug 1047123 - ThreadStackHelper should use UniquePtr<uint8_t[]>, not ScopedDeleteArray. r=jchen

This commit is contained in:
Jeff Walden
2014-08-01 10:49:37 -07:00
parent fe6e43cbe7
commit 4e7053ed2b

View File

@@ -21,6 +21,7 @@
#include "mozilla/IntegerPrintfMacros.h"
#include "mozilla/Move.h"
#include "mozilla/Scoped.h"
#include "mozilla/UniquePtr.h"
#ifdef MOZ_THREADSTACKHELPER_NATIVE
#include "google_breakpad/processor/call_stack.h"
@@ -333,7 +334,7 @@ public:
// Processor context
Context mContext;
// Stack area
ScopedDeleteArray<uint8_t> mStack;
UniquePtr<uint8_t[]> mStack;
// Start of stack area
uintptr_t mStackBase;
// Size of stack area
@@ -384,7 +385,7 @@ ThreadStackHelper::GetNativeStack(Stack& aStack)
{
#ifdef MOZ_THREADSTACKHELPER_NATIVE
ThreadContext context;
context.mStack = new uint8_t[ThreadContext::kMaxStackSize];
context.mStack = MakeUnique<uint8_t[]>(ThreadContext::kMaxStackSize);
ScopedSetPtr<ThreadContext> contextPtr(mContextToFill, &context);
@@ -764,7 +765,7 @@ ThreadStackHelper::FillThreadContext(void* aContext)
#endif
#ifndef MOZ_ASAN
memcpy(mContextToFill->mStack, reinterpret_cast<void*>(sp), stackSize);
memcpy(mContextToFill->mStack.get(), reinterpret_cast<void*>(sp), stackSize);
#else
// ASan will flag memcpy for access outside of stack frames,
// so roll our own memcpy here.