зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1450644 - WorkerRef should make APIs able to work until the worker is completely terminated - part 1 - MessagePort, r=asuth
This commit is contained in:
Родитель
fbfb18c610
Коммит
8cb037ae07
|
@ -297,8 +297,8 @@ MessagePort::Initialize(const nsID& aUUID,
|
|||
StrongWorkerRef::Create(workerPrivate, "MessagePort",
|
||||
[self]() { self->CloseForced(); });
|
||||
if (NS_WARN_IF(!strongWorkerRef)) {
|
||||
// The worker is shutting down. Let's return an already closed port.
|
||||
mState = eStateDisentangledForClose;
|
||||
// The worker is shutting down.
|
||||
aRv.Throw(NS_ERROR_FAILURE);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -70,6 +70,10 @@ public:
|
|||
{
|
||||
MOZ_ASSERT(mWorkerRef);
|
||||
|
||||
if (aStatus < Canceling) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// Let's keep this object alive for the whole Notify() execution.
|
||||
RefPtr<WorkerRef> workerRef;
|
||||
workerRef = mWorkerRef;
|
||||
|
@ -128,7 +132,7 @@ WeakWorkerRef::Create(WorkerPrivate* aWorkerPrivate,
|
|||
// This holder doesn't keep the worker alive.
|
||||
UniquePtr<Holder> holder(new Holder("WeakWorkerRef::Holder", ref,
|
||||
WorkerHolder::AllowIdleShutdownStart));
|
||||
if (NS_WARN_IF(!holder->HoldWorker(aWorkerPrivate, Closing))) {
|
||||
if (NS_WARN_IF(!holder->HoldWorker(aWorkerPrivate, Canceling))) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
@ -182,7 +186,7 @@ StrongWorkerRef::Create(WorkerPrivate* aWorkerPrivate,
|
|||
// The worker is kept alive by this holder.
|
||||
UniquePtr<Holder> holder(new Holder(aName, ref,
|
||||
WorkerHolder::PreventIdleShutdownStart));
|
||||
if (NS_WARN_IF(!holder->HoldWorker(aWorkerPrivate, Closing))) {
|
||||
if (NS_WARN_IF(!holder->HoldWorker(aWorkerPrivate, Canceling))) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче