Bug 1008338 - Add WorkerScriptExecutedSuccessfully(). r=bent

This commit is contained in:
Nikhil Marathe 2014-05-29 09:33:04 -07:00
parent 46913d3906
commit b2949dbebd
2 changed files with 25 additions and 2 deletions

View File

@ -879,7 +879,11 @@ private:
}
JSAutoCompartment ac(aCx, global);
return scriptloader::LoadWorkerScript(aCx);
bool result = scriptloader::LoadWorkerScript(aCx);
if (result) {
aWorkerPrivate->SetWorkerScriptExecutedSuccessfully();
}
return result;
}
};
@ -3558,7 +3562,8 @@ WorkerPrivate::WorkerPrivate(JSContext* aCx,
mRunningExpiredTimeouts(false), mCloseHandlerStarted(false),
mCloseHandlerFinished(false), mMemoryReporterRunning(false),
mBlockedForMemoryReporter(false), mCancelAllPendingRunnables(false),
mPeriodicGCTimerRunning(false), mIdleGCTimerRunning(false)
mPeriodicGCTimerRunning(false), mIdleGCTimerRunning(false),
mWorkerScriptExecutedSuccessfully(false)
#ifdef DEBUG
, mPRThread(nullptr)
#endif

View File

@ -785,6 +785,7 @@ class WorkerPrivate : public WorkerPrivateParent<WorkerPrivate>
bool mCancelAllPendingRunnables;
bool mPeriodicGCTimerRunning;
bool mIdleGCTimerRunning;
bool mWorkerScriptExecutedSuccessfully;
#ifdef DEBUG
PRThread* mPRThread;
@ -1068,6 +1069,23 @@ public:
{ }
#endif
void
SetWorkerScriptExecutedSuccessfully()
{
AssertIsOnWorkerThread();
// Should only be called once!
MOZ_ASSERT(!mWorkerScriptExecutedSuccessfully);
mWorkerScriptExecutedSuccessfully = true;
}
// Only valid after CompileScriptRunnable has finished running!
bool
WorkerScriptExecutedSuccessfully() const
{
AssertIsOnWorkerThread();
return mWorkerScriptExecutedSuccessfully;
}
private:
WorkerPrivate(JSContext* aCx, WorkerPrivate* aParent,
const nsAString& aScriptURL, bool aIsChromeWorker,