LCOV - code coverage report
Current view: top level - gfx/layers/ipc - VideoBridgeParent.cpp (source / functions) Hit Total Coverage
Test: output.info Lines: 0 45 0.0 %
Date: 2017-07-14 16:53:18 Functions: 0 15 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* vim: set ts=2 sw=2 et tw=80: */
       2             : /* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*-
       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 "VideoBridgeParent.h"
       8             : #include "CompositorThread.h"
       9             : #include "mozilla/layers/TextureHost.h"
      10             : 
      11             : namespace mozilla {
      12             : namespace layers {
      13             : 
      14             : using namespace mozilla::ipc;
      15             : using namespace mozilla::gfx;
      16             : 
      17             : static VideoBridgeParent* sVideoBridgeSingleton;
      18             : 
      19           0 : VideoBridgeParent::VideoBridgeParent()
      20           0 :   : mClosed(false)
      21             : {
      22           0 :   mSelfRef = this;
      23           0 :   sVideoBridgeSingleton = this;
      24           0 :   mCompositorThreadRef = CompositorThreadHolder::GetSingleton();
      25           0 : }
      26             : 
      27           0 : VideoBridgeParent::~VideoBridgeParent()
      28             : {
      29           0 :   sVideoBridgeSingleton = nullptr;
      30           0 : }
      31             : 
      32             : /* static */ VideoBridgeParent*
      33           0 : VideoBridgeParent::GetSingleton()
      34             : {
      35           0 :   return sVideoBridgeSingleton;
      36             : }
      37             : 
      38             : TextureHost*
      39           0 : VideoBridgeParent::LookupTexture(uint64_t aSerial)
      40             : {
      41           0 :   return TextureHost::AsTextureHost(mTextureMap[aSerial]);
      42             : }
      43             : 
      44             : void
      45           0 : VideoBridgeParent::ActorDestroy(ActorDestroyReason aWhy)
      46             : {
      47             :   // Can't alloc/dealloc shmems from now on.
      48           0 :   mClosed = true;
      49           0 : }
      50             : 
      51             : void
      52           0 : VideoBridgeParent::DeallocPVideoBridgeParent()
      53             : {
      54           0 :   mCompositorThreadRef = nullptr;
      55           0 :   mSelfRef = nullptr;
      56           0 : }
      57             : 
      58             : PTextureParent*
      59           0 : VideoBridgeParent::AllocPTextureParent(const SurfaceDescriptor& aSharedData,
      60             :                                        const LayersBackend& aLayersBackend,
      61             :                                        const TextureFlags& aFlags,
      62             :                                        const uint64_t& aSerial)
      63             : {
      64             :   PTextureParent* parent =
      65           0 :     TextureHost::CreateIPDLActor(this, aSharedData, aLayersBackend, aFlags, aSerial, Nothing());
      66           0 :   mTextureMap[aSerial] = parent;
      67           0 :   return parent;
      68             : }
      69             : 
      70             : bool
      71           0 : VideoBridgeParent::DeallocPTextureParent(PTextureParent* actor)
      72             : {
      73           0 :   mTextureMap.erase(TextureHost::GetTextureSerial(actor));
      74           0 :   return TextureHost::DestroyIPDLActor(actor);
      75             : }
      76             : 
      77             : void
      78           0 : VideoBridgeParent::SendAsyncMessage(const InfallibleTArray<AsyncParentMessageData>& aMessage)
      79             : {
      80           0 :   MOZ_ASSERT(false, "AsyncMessages not supported");
      81             : }
      82             : 
      83             : bool
      84           0 : VideoBridgeParent::AllocShmem(size_t aSize,
      85             :                               ipc::SharedMemory::SharedMemoryType aType,
      86             :                               ipc::Shmem* aShmem)
      87             : {
      88           0 :   if (mClosed) {
      89           0 :     return false;
      90             :   }
      91           0 :   return PVideoBridgeParent::AllocShmem(aSize, aType, aShmem);
      92             : }
      93             : 
      94             : bool
      95           0 : VideoBridgeParent::AllocUnsafeShmem(size_t aSize,
      96             :                                     ipc::SharedMemory::SharedMemoryType aType,
      97             :                                     ipc::Shmem* aShmem)
      98             : {
      99           0 :   if (mClosed) {
     100           0 :     return false;
     101             :   }
     102           0 :   return PVideoBridgeParent::AllocUnsafeShmem(aSize, aType, aShmem);
     103             : }
     104             : 
     105             : void
     106           0 : VideoBridgeParent::DeallocShmem(ipc::Shmem& aShmem)
     107             : {
     108           0 :   if (mClosed) {
     109           0 :     return;
     110             :   }
     111           0 :   PVideoBridgeParent::DeallocShmem(aShmem);
     112             : }
     113             : 
     114             : bool
     115           0 : VideoBridgeParent::IsSameProcess() const
     116             : {
     117           0 :   return OtherPid() == base::GetCurrentProcId();
     118             : }
     119             : 
     120             : void
     121           0 : VideoBridgeParent::NotifyNotUsed(PTextureParent* aTexture, uint64_t aTransactionId)
     122             : {
     123           0 : }
     124             : 
     125             : } // namespace layers
     126             : } // namespace mozilla

Generated by: LCOV version 1.13