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

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 20; 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 "GPUVideoTextureClient.h"
       7             : #include "mozilla/dom/VideoDecoderManagerChild.h"
       8             : #include "mozilla/gfx/2D.h"
       9             : 
      10             : namespace mozilla {
      11             : namespace layers {
      12             : 
      13             : using namespace gfx;
      14             : 
      15           0 : GPUVideoTextureData::GPUVideoTextureData(dom::VideoDecoderManagerChild* aManager,
      16             :                                          const SurfaceDescriptorGPUVideo& aSD,
      17           0 :                                          const gfx::IntSize& aSize)
      18             :   : mManager(aManager)
      19             :   , mSD(aSD)
      20           0 :   , mSize(aSize)
      21           0 : {}
      22             : 
      23           0 : GPUVideoTextureData::~GPUVideoTextureData()
      24             : {
      25           0 : }
      26             : 
      27             : bool
      28           0 : GPUVideoTextureData::Serialize(SurfaceDescriptor& aOutDescriptor)
      29             : {
      30           0 :   aOutDescriptor = mSD;
      31           0 :   return true;
      32             : }
      33             : 
      34             : void
      35           0 : GPUVideoTextureData::FillInfo(TextureData::Info& aInfo) const
      36             : {
      37           0 :   aInfo.size = mSize;
      38             :   // TODO: We should probably try do better for this.
      39             :   // layers::Image doesn't expose a format, so it's hard
      40             :   // to figure out in VideoDecoderParent.
      41           0 :   aInfo.format = SurfaceFormat::B8G8R8X8;
      42           0 :   aInfo.hasIntermediateBuffer = false;
      43           0 :   aInfo.hasSynchronization = false;
      44           0 :   aInfo.supportsMoz2D = false;
      45           0 :   aInfo.canExposeMappedData = false;
      46           0 : }
      47             : 
      48             : already_AddRefed<SourceSurface>
      49           0 : GPUVideoTextureData::GetAsSourceSurface()
      50             : {
      51           0 :   return mManager->Readback(mSD);
      52             : }
      53             : 
      54             : void
      55           0 : GPUVideoTextureData::Deallocate(LayersIPCChannel* aAllocator)
      56             : {
      57           0 :   mManager->DeallocateSurfaceDescriptorGPUVideo(mSD);
      58           0 :   mSD = SurfaceDescriptorGPUVideo();
      59           0 : }
      60             : 
      61             : void
      62           0 : GPUVideoTextureData::Forget(LayersIPCChannel* aAllocator)
      63             : {
      64             :   // We always need to manually deallocate on the client side.
      65             :   // Ideally we'd set up our TextureClient with the DEALLOCATE_CLIENT
      66             :   // flag, but that forces texture destruction to be synchronous.
      67             :   // Instead let's just deallocate from here as well.
      68           0 :   Deallocate(aAllocator);
      69           0 : }
      70             : 
      71             : } // namespace layers
      72             : } // namespace mozilla

Generated by: LCOV version 1.13