tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

FileSystemAccessHandleControlParent.cpp (1404B)


      1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
      2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
      3 /* This Source Code Form is subject to the terms of the Mozilla Public
      4 * License, v. 2.0. If a copy of the MPL was not distributed with this
      5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
      6 
      7 #include "FileSystemAccessHandleControlParent.h"
      8 
      9 #include "mozilla/dom/FileSystemAccessHandle.h"
     10 #include "mozilla/ipc/IPCCore.h"
     11 
     12 namespace mozilla::dom {
     13 
     14 FileSystemAccessHandleControlParent::FileSystemAccessHandleControlParent(
     15    RefPtr<FileSystemAccessHandle> aAccessHandle)
     16    : mAccessHandle(std::move(aAccessHandle)) {}
     17 
     18 FileSystemAccessHandleControlParent::~FileSystemAccessHandleControlParent() {
     19  MOZ_ASSERT(mActorDestroyed);
     20 }
     21 
     22 mozilla::ipc::IPCResult FileSystemAccessHandleControlParent::RecvClose(
     23    CloseResolver&& aResolver) {
     24  mAccessHandle->BeginClose()->Then(
     25      GetCurrentSerialEventTarget(), __func__,
     26      [resolver = std::move(aResolver)](
     27          const BoolPromise::ResolveOrRejectValue&) { resolver(void_t()); });
     28 
     29  return IPC_OK();
     30 }
     31 
     32 void FileSystemAccessHandleControlParent::ActorDestroy(
     33    ActorDestroyReason /* aWhy */) {
     34  MOZ_ASSERT(!mActorDestroyed);
     35 
     36 #ifdef DEBUG
     37  mActorDestroyed = true;
     38 #endif
     39 
     40  mAccessHandle->UnregisterControlActor(WrapNotNullUnchecked(this));
     41 
     42  mAccessHandle = nullptr;
     43 }
     44 
     45 }  // namespace mozilla::dom