mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-24 05:11:16 +00:00
Bug 1874080 - Nullify WebTaskSchedulerWorker::mWorkerPrivate while Disconnect(). r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D198569
This commit is contained in:
parent
03343bf403
commit
1f89c187e9
@ -145,7 +145,7 @@ class WebTaskScheduler : public nsWrapperCache, public SupportsWeakPtr {
|
||||
|
||||
WebTask* GetNextTask() const;
|
||||
|
||||
void Disconnect();
|
||||
virtual void Disconnect();
|
||||
|
||||
void RunTaskSignalPriorityChange(TaskSignal* aTaskSignal);
|
||||
|
||||
|
@ -36,6 +36,9 @@ bool WebTaskWorkerRunnable::WorkerRun(JSContext* aCx,
|
||||
|
||||
nsresult WebTaskSchedulerWorker::SetTimeoutForDelayedTask(WebTask* aTask,
|
||||
uint64_t aDelay) {
|
||||
if (!mWorkerPrivate) {
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
}
|
||||
JSContext* cx = nsContentUtils::GetCurrentJSContext();
|
||||
if (!cx) {
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
@ -52,8 +55,18 @@ nsresult WebTaskSchedulerWorker::SetTimeoutForDelayedTask(WebTask* aTask,
|
||||
}
|
||||
|
||||
bool WebTaskSchedulerWorker::DispatchEventLoopRunnable() {
|
||||
if (!mWorkerPrivate) {
|
||||
return false;
|
||||
}
|
||||
RefPtr<WebTaskWorkerRunnable> runnable =
|
||||
new WebTaskWorkerRunnable(mWorkerPrivate, this);
|
||||
return runnable->Dispatch();
|
||||
}
|
||||
|
||||
void WebTaskSchedulerWorker::Disconnect() {
|
||||
if (mWorkerPrivate) {
|
||||
mWorkerPrivate = nullptr;
|
||||
}
|
||||
WebTaskScheduler::Disconnect();
|
||||
}
|
||||
} // namespace mozilla::dom
|
||||
|
@ -34,6 +34,8 @@ class WebTaskSchedulerWorker final : public WebTaskScheduler {
|
||||
public:
|
||||
explicit WebTaskSchedulerWorker(WorkerPrivate* aWorkerPrivate);
|
||||
|
||||
void Disconnect() override;
|
||||
|
||||
private:
|
||||
~WebTaskSchedulerWorker() = default;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user