Bug 946817 - Don't assert mPseudoStack on B2G. r=BenWa

This commit is contained in:
Jim Chen 2013-12-06 09:50:21 -05:00
parent 6f414242d7
commit 18ca3223c4

View File

@ -84,7 +84,7 @@ ThreadStackHelper::GetStack(Stack& aStack)
{
// Always run PrepareStackBuffer first to clear aStack
if (!PrepareStackBuffer(aStack)) {
MOZ_ASSERT(false);
// Skip and return empty aStack
return;
}
@ -149,13 +149,23 @@ ThreadStackHelper::SigAction(int aSignal, siginfo_t* aInfo, void* aContext)
bool
ThreadStackHelper::PrepareStackBuffer(Stack& aStack) {
// Return false to skip getting the stack and return an empty stack
aStack.clear();
#ifdef MOZ_ENABLE_PROFILER_SPS
/* Normally, provided the profiler is enabled, it would be an error if we
don't have a pseudostack here (the thread probably forgot to call
profiler_register_thread). However, on B2G, profiling secondary threads
may be disabled despite profiler being enabled. This is by-design and
is not an error. */
#ifdef MOZ_WIDGET_GONK
if (!mPseudoStack) {
return false;
}
#endif
MOZ_ASSERT(mPseudoStack);
mStackBuffer.clear();
return mStackBuffer.reserve(mMaxStackSize);
MOZ_ALWAYS_TRUE(mStackBuffer.reserve(mMaxStackSize));
return true;
#else
return false;
#endif