LCOV - code coverage report
Current view: top level - dom/media/ipc - VideoDecoderManagerChild.h (source / functions) Hit Total Coverage
Test: output.info Lines: 0 9 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: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /* vim: set ts=8 sts=2 et sw=2 tw=99: */
       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             : #ifndef include_dom_ipc_VideoDecoderManagerChild_h
       7             : #define include_dom_ipc_VideoDecoderManagerChild_h
       8             : 
       9             : #include "mozilla/RefPtr.h"
      10             : #include "mozilla/dom/PVideoDecoderManagerChild.h"
      11             : 
      12             : namespace mozilla {
      13             : namespace gfx {
      14             : class SourceSurface;
      15             : }
      16             : namespace dom {
      17             : 
      18             : class VideoDecoderManagerChild final : public PVideoDecoderManagerChild
      19             :                                      , public mozilla::ipc::IShmemAllocator
      20             : {
      21             : public:
      22           0 :   NS_INLINE_DECL_THREADSAFE_REFCOUNTING(VideoDecoderManagerChild)
      23             : 
      24             :   // Can only be called from the manager thread
      25             :   static VideoDecoderManagerChild* GetSingleton();
      26             : 
      27             :   // Can be called from any thread.
      28             :   static nsIThread* GetManagerThread();
      29             :   static AbstractThread* GetManagerAbstractThread();
      30             : 
      31             :   // Can be called from any thread, dispatches the request to the IPDL thread internally
      32             :   // and will be ignored if the IPDL actor has been destroyed.
      33             :   already_AddRefed<gfx::SourceSurface> Readback(const SurfaceDescriptorGPUVideo& aSD);
      34             :   void DeallocateSurfaceDescriptorGPUVideo(const SurfaceDescriptorGPUVideo& aSD);
      35             : 
      36           0 :   bool AllocShmem(size_t aSize,
      37             :                   mozilla::ipc::SharedMemory::SharedMemoryType aShmType,
      38             :                   mozilla::ipc::Shmem* aShmem) override
      39             :   {
      40           0 :     return PVideoDecoderManagerChild::AllocShmem(aSize, aShmType, aShmem);
      41             :   }
      42           0 :   bool AllocUnsafeShmem(size_t aSize,
      43             :                         mozilla::ipc::SharedMemory::SharedMemoryType aShmType,
      44             :                         mozilla::ipc::Shmem* aShmem) override
      45             :   {
      46           0 :     return PVideoDecoderManagerChild::AllocUnsafeShmem(aSize, aShmType, aShmem);
      47             :   }
      48             : 
      49             :   // Can be called from any thread, dispatches the request to the IPDL thread internally
      50             :   // and will be ignored if the IPDL actor has been destroyed.
      51             :   bool DeallocShmem(mozilla::ipc::Shmem& aShmem) override;
      52             : 
      53             :   // Main thread only
      54             :   static void InitForContent(Endpoint<PVideoDecoderManagerChild>&& aVideoManager);
      55             :   static void Shutdown();
      56             : 
      57             :   // Run aTask (on the manager thread) when we next attempt to create a new manager
      58             :   // (even if creation fails). Intended to be called from ActorDestroy when we get
      59             :   // notified that the old manager is being destroyed.
      60             :   // Can only be called from the manager thread.
      61             :   void RunWhenRecreated(already_AddRefed<Runnable> aTask);
      62             : 
      63             :   bool CanSend();
      64             : 
      65             : protected:
      66             :   void InitIPDL();
      67             : 
      68             :   void ActorDestroy(ActorDestroyReason aWhy) override;
      69             :   void DeallocPVideoDecoderManagerChild() override;
      70             : 
      71             :   void HandleFatalError(const char* aName, const char* aMsg) const override;
      72             : 
      73             :   PVideoDecoderChild* AllocPVideoDecoderChild(const VideoInfo& aVideoInfo,
      74             :                                               const layers::TextureFactoryIdentifier& aIdentifier,
      75             :                                               bool* aSuccess) override;
      76             :   bool DeallocPVideoDecoderChild(PVideoDecoderChild* actor) override;
      77             : 
      78             : private:
      79             :   // Main thread only
      80             :   static void InitializeThread();
      81             : 
      82           0 :   VideoDecoderManagerChild()
      83           0 :     : mCanSend(false)
      84           0 :   {}
      85           0 :   ~VideoDecoderManagerChild() {}
      86             : 
      87             :   static void Open(Endpoint<PVideoDecoderManagerChild>&& aEndpoint);
      88             : 
      89             :   RefPtr<VideoDecoderManagerChild> mIPDLSelfRef;
      90             : 
      91             :   // Should only ever be accessed on the manager thread.
      92             :   bool mCanSend;
      93             : };
      94             : 
      95             : } // namespace dom
      96             : } // namespace mozilla
      97             : 
      98             : #endif // include_dom_ipc_VideoDecoderManagerChild_h

Generated by: LCOV version 1.13