LCOV - code coverage report
Current view: top level - dom/media/systemservices - MediaSystemResourceClient.cpp (source / functions) Hit Total Coverage
Test: output.info Lines: 0 28 0.0 %
Date: 2017-07-14 16:53:18 Functions: 0 6 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             : /* vim:set ts=2 sw=2 sts=2 et cindent: */
       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 file,
       5             :  * You can obtain one at http://mozilla.org/MPL/2.0/. */
       6             : 
       7             : #include "mozilla/Monitor.h"
       8             : #include "mozilla/ReentrantMonitor.h"
       9             : 
      10             : #include "MediaSystemResourceClient.h"
      11             : 
      12             : namespace mozilla {
      13             : 
      14             : Atomic<uint32_t> MediaSystemResourceClient::sSerialCounter(0);
      15             : 
      16           0 : MediaSystemResourceClient::MediaSystemResourceClient(MediaSystemResourceType aReourceType)
      17             :   : mResourceType(aReourceType)
      18           0 :   , mId(++sSerialCounter)
      19             :   , mListener(nullptr)
      20             :   , mResourceState(RESOURCE_STATE_START)
      21             :   , mIsSync(false)
      22             :   , mAcquireSyncWaitMonitor(nullptr)
      23           0 :   , mAcquireSyncWaitDone(nullptr)
      24             : {
      25           0 :   mManager = MediaSystemResourceManager::Get();
      26           0 :   if (mManager) {
      27           0 :     mManager->Register(this);
      28             :   }
      29           0 : }
      30             : 
      31           0 : MediaSystemResourceClient::~MediaSystemResourceClient()
      32             : {
      33           0 :   ReleaseResource();
      34           0 :   if (mManager) {
      35           0 :     mManager->Unregister(this);
      36             :   }
      37           0 : }
      38             : 
      39             : bool
      40           0 : MediaSystemResourceClient::SetListener(MediaSystemResourceReservationListener* aListener)
      41             : {
      42           0 :   if (!mManager) {
      43           0 :     return false;
      44             :   }
      45           0 :   return mManager->SetListener(this, aListener);
      46             : }
      47             : 
      48             : void
      49           0 : MediaSystemResourceClient::Acquire()
      50             : {
      51           0 :   if (!mManager) {
      52           0 :     return;
      53             :   }
      54           0 :   mManager->Acquire(this);
      55             : }
      56             : 
      57             : bool
      58           0 : MediaSystemResourceClient::AcquireSyncNoWait()
      59             : {
      60           0 :   if (!mManager) {
      61           0 :     return false;
      62             :   }
      63           0 :   return mManager->AcquireSyncNoWait(this);
      64             : }
      65             : 
      66             : void
      67           0 : MediaSystemResourceClient::ReleaseResource()
      68             : {
      69           0 :   if (!mManager) {
      70           0 :     return;
      71             :   }
      72           0 :   mManager->ReleaseResource(this);
      73             : }
      74             : 
      75             : } // namespace mozilla

Generated by: LCOV version 1.13