tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

SharedPlanarYCbCrImage.h (2156B)


      1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
      2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
      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 <stdint.h>             // for uint8_t, uint32_t
      8 #include "ImageContainer.h"     // for PlanarYCbCrImage, etc
      9 #include "mozilla/RefPtr.h"     // for RefPtr
     10 #include "mozilla/ipc/Shmem.h"  // for Shmem
     11 #include "nsCOMPtr.h"           // for already_AddRefed
     12 #include "nsDebug.h"            // for NS_WARNING
     13 #include "nsISupportsImpl.h"    // for MOZ_COUNT_CTOR
     14 
     15 #ifndef MOZILLA_LAYERS_SHAREDPLANARYCBCRIMAGE_H
     16 #  define MOZILLA_LAYERS_SHAREDPLANARYCBCRIMAGE_H
     17 
     18 namespace mozilla {
     19 namespace layers {
     20 
     21 class ImageClient;
     22 class TextureClient;
     23 class TextureClientRecycleAllocator;
     24 
     25 class SharedPlanarYCbCrImage : public PlanarYCbCrImage {
     26 public:
     27  explicit SharedPlanarYCbCrImage(ImageClient* aCompositable);
     28  explicit SharedPlanarYCbCrImage(
     29      TextureClientRecycleAllocator* aRecycleAllocator);
     30 
     31 protected:
     32  virtual ~SharedPlanarYCbCrImage();
     33 
     34 public:
     35  TextureClient* GetTextureClient(KnowsCompositor* aKnowsCompositor) override;
     36 
     37  already_AddRefed<gfx::SourceSurface> GetAsSourceSurface() override;
     38  nsresult CopyData(const PlanarYCbCrData& aData) override;
     39  nsresult AdoptData(const Data& aData) override;
     40  nsresult CreateEmptyBuffer(const Data& aData, const gfx::IntSize& aYSize,
     41                             const gfx::IntSize& aCbCrSize) override;
     42 
     43  void SetIsDRM(bool aIsDRM) override;
     44  bool IsValid() const override;
     45 
     46  size_t SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const override {
     47    return aMallocSizeOf(this) + SizeOfExcludingThis(aMallocSizeOf);
     48  }
     49 
     50  size_t SizeOfExcludingThis(MallocSizeOf aMallocSizeOf) const override;
     51 
     52  TextureClientRecycleAllocator* RecycleAllocator();
     53 
     54 private:
     55  RefPtr<TextureClient> mTextureClient;
     56  RefPtr<ImageClient> mCompositable;
     57  RefPtr<TextureClientRecycleAllocator> mRecycleAllocator;
     58 };
     59 
     60 }  // namespace layers
     61 }  // namespace mozilla
     62 
     63 #endif