LCOV - code coverage report
Current view: top level - gfx/layers - GPUVideoImage.h (source / functions) Hit Total Coverage
Test: output.info Lines: 0 16 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: 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             : #ifndef GFX_GPU_VIDEO_IMAGE_H
       7             : #define GFX_GPU_VIDEO_IMAGE_H
       8             : 
       9             : #include "mozilla/RefPtr.h"
      10             : #include "ImageContainer.h"
      11             : #include "mozilla/layers/GPUVideoTextureClient.h"
      12             : #include "mozilla/layers/CompositableClient.h"
      13             : #include "mozilla/layers/ImageBridgeChild.h"
      14             : 
      15             : namespace mozilla {
      16             : namespace dom {
      17             : class VideoDecoderManagerChild;
      18             : }
      19             : namespace layers {
      20             : 
      21             : // Image class that refers to a decoded video frame within
      22             : // the GPU process.
      23             : class GPUVideoImage final : public Image {
      24             : public:
      25           0 :   GPUVideoImage(dom::VideoDecoderManagerChild* aManager,
      26             :                 const SurfaceDescriptorGPUVideo& aSD,
      27             :                 const gfx::IntSize& aSize)
      28           0 :     : Image(nullptr, ImageFormat::GPU_VIDEO)
      29           0 :     , mSize(aSize)
      30             :   {
      31             :     // Create the TextureClient immediately since the GPUVideoTextureData
      32             :     // is responsible for deallocating the SurfaceDescriptor.
      33             :     //
      34             :     // Use the RECYCLE texture flag, since it's likely that our 'real'
      35             :     // TextureData (in the decoder thread of the GPU process) is using
      36             :     // it too, and we want to make sure we don't send the delete message
      37             :     // until we've stopped being used on the compositor.
      38             :     mTextureClient =
      39           0 :       TextureClient::CreateWithData(new GPUVideoTextureData(aManager, aSD, aSize),
      40             :                                     TextureFlags::RECYCLE,
      41           0 :                                     ImageBridgeChild::GetSingleton().get());
      42           0 :   }
      43             : 
      44           0 :   ~GPUVideoImage() override {}
      45             : 
      46           0 :   gfx::IntSize GetSize() override { return mSize; }
      47             : 
      48           0 :   virtual already_AddRefed<gfx::SourceSurface> GetAsSourceSurface() override
      49             :   {
      50           0 :     if (!mTextureClient) {
      51           0 :       return nullptr;
      52             :     }
      53           0 :     GPUVideoTextureData* data = mTextureClient->GetInternalData()->AsGPUVideoTextureData();
      54           0 :     return data->GetAsSourceSurface();
      55             :   }
      56             : 
      57           0 :   virtual TextureClient* GetTextureClient(KnowsCompositor* aForwarder) override
      58             :   {
      59           0 :     MOZ_ASSERT(aForwarder == ImageBridgeChild::GetSingleton(), "Must only use GPUVideo on ImageBridge");
      60           0 :     return mTextureClient;
      61             :   }
      62             : 
      63             : private:
      64             :   gfx::IntSize mSize;
      65             :   RefPtr<TextureClient> mTextureClient;
      66             : };
      67             : 
      68             : } // namepace layers
      69             : } // namespace mozilla
      70             : 
      71             : #endif // GFX_GPU_VIDEO_IMAGE_H

Generated by: LCOV version 1.13