LCOV - code coverage report
Current view: top level - dom/media/systemservices - MediaSystemResourceManagerParent.cpp (source / functions) Hit Total Coverage
Test: output.info Lines: 0 34 0.0 %
Date: 2017-07-14 16:53:18 Functions: 0 7 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       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 "mozilla/Unused.h"
       7             : #include "mozilla/layers/PImageBridgeParent.h"
       8             : 
       9             : #include "MediaSystemResourceManagerParent.h"
      10             : 
      11             : namespace mozilla {
      12             : namespace media {
      13             : 
      14             : using namespace ipc;
      15             : 
      16           0 : MediaSystemResourceManagerParent::MediaSystemResourceManagerParent()
      17           0 :   : mDestroyed(false)
      18             : {
      19           0 :   mMediaSystemResourceService = MediaSystemResourceService::Get();
      20           0 : }
      21             : 
      22           0 : MediaSystemResourceManagerParent::~MediaSystemResourceManagerParent()
      23             : {
      24           0 :   MOZ_ASSERT(mDestroyed);
      25           0 : }
      26             : 
      27             : mozilla::ipc::IPCResult
      28           0 : MediaSystemResourceManagerParent::RecvAcquire(const uint32_t& aId,
      29             :                                               const MediaSystemResourceType& aResourceType,
      30             :                                               const bool& aWillWait)
      31             : {
      32           0 :   MediaSystemResourceRequest* request = mResourceRequests.Get(aId);
      33           0 :   MOZ_ASSERT(!request);
      34           0 :   if (request) {
      35             :     // Send fail response
      36           0 :     mozilla::Unused << SendResponse(aId, false /* fail */);
      37           0 :     return IPC_OK();
      38             :   }
      39             : 
      40           0 :   request = new MediaSystemResourceRequest(aId, aResourceType);
      41           0 :   mResourceRequests.Put(aId, request);
      42           0 :   mMediaSystemResourceService->Acquire(this, aId, aResourceType, aWillWait);
      43           0 :   return IPC_OK();
      44             : }
      45             : 
      46             : mozilla::ipc::IPCResult
      47           0 : MediaSystemResourceManagerParent::RecvRelease(const uint32_t& aId)
      48             : {
      49           0 :   MediaSystemResourceRequest* request = mResourceRequests.Get(aId);
      50           0 :   if (!request) {
      51           0 :     return IPC_OK();
      52             :   }
      53             : 
      54           0 :   mMediaSystemResourceService->ReleaseResource(this, aId, request->mResourceType);
      55           0 :   mResourceRequests.Remove(aId);
      56           0 :   return IPC_OK();
      57             : }
      58             : 
      59             : mozilla::ipc::IPCResult
      60           0 : MediaSystemResourceManagerParent::RecvRemoveResourceManager()
      61             : {
      62           0 :   IProtocol* mgr = Manager();
      63           0 :   if (!PMediaSystemResourceManagerParent::Send__delete__(this)) {
      64           0 :     return IPC_FAIL_NO_REASON(mgr);
      65             :   }
      66           0 :   return IPC_OK();
      67             : }
      68             : 
      69             : void
      70           0 : MediaSystemResourceManagerParent::ActorDestroy(ActorDestroyReason aReason)
      71             : {
      72           0 :   MOZ_ASSERT(!mDestroyed);
      73             : 
      74             :   // Release all resource requests of the MediaSystemResourceManagerParent.
      75             :   // Clears all remaining pointers to this object.
      76           0 :   mMediaSystemResourceService->ReleaseResource(this);
      77             : 
      78           0 :   mDestroyed = true;
      79           0 : }
      80             : 
      81             : } // namespace media
      82             : } // namespace mozilla

Generated by: LCOV version 1.13