bool WorkerRunnable::DispatchInternal() { nsRefPtr<WorkerRunnable> runnable(this); if (mBehavior == WorkerThreadModifyBusyCount || mBehavior == WorkerThreadUnchangedBusyCount) { if (IsDebuggerRunnable()) { return NS_SUCCEEDED(mWorkerPrivate->DispatchDebuggerRunnable(runnable.forget())); } else { return NS_SUCCEEDED(mWorkerPrivate->Dispatch(runnable.forget())); } } MOZ_ASSERT(mBehavior == ParentThreadUnchangedBusyCount); if (WorkerPrivate* parent = mWorkerPrivate->GetParent()) { return NS_SUCCEEDED(parent->Dispatch(runnable.forget())); } nsCOMPtr<nsIThread> mainThread = do_GetMainThread(); MOZ_ASSERT(mainThread); return NS_SUCCEEDED(mainThread->Dispatch(runnable.forget(), NS_DISPATCH_NORMAL)); }
nsIGlobalObject* WorkerRunnable::DefaultGlobalObject() const { if (IsDebuggerRunnable()) { return mWorkerPrivate->DebuggerGlobalScope(); } else { return mWorkerPrivate->GlobalScope(); } }
bool WorkerRunnable::DispatchInternal() { RefPtr<WorkerRunnable> runnable(this); if (mBehavior == WorkerThreadModifyBusyCount || mBehavior == WorkerThreadUnchangedBusyCount) { if (IsDebuggerRunnable()) { return NS_SUCCEEDED(mWorkerPrivate->DispatchDebuggerRunnable(runnable.forget())); } else { return NS_SUCCEEDED(mWorkerPrivate->Dispatch(runnable.forget())); } } MOZ_ASSERT(mBehavior == ParentThreadUnchangedBusyCount); if (WorkerPrivate* parent = mWorkerPrivate->GetParent()) { return NS_SUCCEEDED(parent->Dispatch(runnable.forget())); } return NS_SUCCEEDED(mWorkerPrivate->DispatchToMainThread(runnable.forget())); }