tor-browser

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

MediaSystemResourceManagerChild.cpp (1193B)


      1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
      2 /* This Source Code Form is subject to the terms of the Mozilla Public
      3 * License, v. 2.0. If a copy of the MPL was not distributed with this
      4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
      5 
      6 #include "MediaSystemResourceManagerChild.h"
      7 
      8 #include "MediaSystemResourceManager.h"
      9 
     10 namespace mozilla::media {
     11 
     12 MediaSystemResourceManagerChild::MediaSystemResourceManagerChild()
     13    : mDestroyed(false), mManager(nullptr) {}
     14 
     15 MediaSystemResourceManagerChild::~MediaSystemResourceManagerChild() = default;
     16 
     17 mozilla::ipc::IPCResult MediaSystemResourceManagerChild::RecvResponse(
     18    const uint32_t& aId, const bool& aSuccess) {
     19  if (mManager) {
     20    mManager->RecvResponse(aId, aSuccess);
     21  }
     22  return IPC_OK();
     23 }
     24 
     25 void MediaSystemResourceManagerChild::ActorDestroy(
     26    ActorDestroyReason aActorDestroyReason) {
     27  MOZ_ASSERT(!mDestroyed);
     28  if (mManager) {
     29    mManager->OnIpcClosed();
     30  }
     31  mDestroyed = true;
     32 }
     33 
     34 void MediaSystemResourceManagerChild::Destroy() {
     35  if (mDestroyed) {
     36    return;
     37  }
     38  SendRemoveResourceManager();
     39  // WARNING: |this| is dead, hands off
     40 }
     41 
     42 }  // namespace mozilla::media