Sync access handle methods need to run sync loops to block the thread until a result is available. The main protocol PFileSystemManager and its subprotocol PFileSystemAccessHandle is bound to the main worker event queue, so incoming IPC messages from the parent can't be processed until a sync loop is finished. This becomes a problem when we want to wait for a response from the parent during the asynchronous closing. Fortunatelly, we can add a new top level protocol which will be bound to WorkerPrivate::ControlEventTargret, so incoming IPC messages will be processed even when a sync loop is active. Differential Revision: https://phabricator.services.mozilla.com/D166343
38 lines
983 B
C++
38 lines
983 B
C++
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
#include "FileSystemAccessHandleControlChild.h"
|
|
|
|
#include "mozilla/dom/FileSystemSyncAccessHandle.h"
|
|
|
|
namespace mozilla::dom {
|
|
|
|
void FileSystemAccessHandleControlChild::SetAccessHandle(
|
|
FileSystemSyncAccessHandle* aAccessHandle) {
|
|
MOZ_ASSERT(aAccessHandle);
|
|
MOZ_ASSERT(!mAccessHandle);
|
|
|
|
mAccessHandle = aAccessHandle;
|
|
}
|
|
|
|
void FileSystemAccessHandleControlChild::Shutdown() {
|
|
if (!CanSend()) {
|
|
return;
|
|
}
|
|
|
|
Close();
|
|
}
|
|
|
|
void FileSystemAccessHandleControlChild::ActorDestroy(
|
|
ActorDestroyReason /* aWhy */) {
|
|
if (mAccessHandle) {
|
|
mAccessHandle->ClearControlActor();
|
|
mAccessHandle = nullptr;
|
|
}
|
|
}
|
|
|
|
} // namespace mozilla::dom
|