Coverage Report

Created: 2018-09-25 14:53

/src/mozilla-central/gfx/layers/client/TextureClientSharedSurface.h
Line
Count
Source (jump to first uncovered line)
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
#ifndef MOZILLA_GFX_TEXTURECLIENT_SHAREDSURFACE_H
8
#define MOZILLA_GFX_TEXTURECLIENT_SHAREDSURFACE_H
9
10
#include <cstddef>                      // for size_t
11
#include <stdint.h>                     // for uint32_t, uint8_t, uint64_t
12
#include "GLContextTypes.h"             // for GLContext (ptr only), etc
13
#include "TextureClient.h"
14
#include "mozilla/Assertions.h"         // for MOZ_ASSERT, etc
15
#include "mozilla/RefPtr.h"             // for RefPtr, RefCounted
16
#include "mozilla/gfx/Point.h"          // for IntSize
17
#include "mozilla/gfx/Types.h"          // for SurfaceFormat
18
#include "mozilla/layers/CompositorTypes.h"  // for TextureFlags, etc
19
#include "mozilla/layers/LayersSurfaces.h"  // for SurfaceDescriptor
20
21
namespace mozilla {
22
namespace gl {
23
class GLContext;
24
class SharedSurface;
25
class SurfaceFactory;
26
} // namespace gl
27
28
namespace layers {
29
30
class SharedSurfaceTextureClient;
31
32
class SharedSurfaceTextureData : public TextureData
33
{
34
protected:
35
  const UniquePtr<gl::SharedSurface> mSurf;
36
37
  friend class SharedSurfaceTextureClient;
38
39
  explicit SharedSurfaceTextureData(UniquePtr<gl::SharedSurface> surf);
40
public:
41
42
  ~SharedSurfaceTextureData();
43
44
0
  virtual bool Lock(OpenMode) override { return false; }
45
46
0
  virtual void Unlock() override {}
47
48
  virtual void FillInfo(TextureData::Info& aInfo) const override;
49
50
  virtual bool Serialize(SurfaceDescriptor& aOutDescriptor) override;
51
52
  virtual void Deallocate(LayersIPCChannel*) override;
53
54
  gl::SharedSurface* Surf() const { return mSurf.get(); }
55
};
56
57
class SharedSurfaceTextureClient : public TextureClient
58
{
59
public:
60
  SharedSurfaceTextureClient(SharedSurfaceTextureData* aData,
61
                             TextureFlags aFlags,
62
                             LayersIPCChannel* aAllocator);
63
64
  ~SharedSurfaceTextureClient();
65
66
  static already_AddRefed<SharedSurfaceTextureClient>
67
  Create(UniquePtr<gl::SharedSurface> surf, gl::SurfaceFactory* factory,
68
         LayersIPCChannel* aAllocator, TextureFlags aFlags);
69
70
  gl::SharedSurface* Surf() const {
71
    return static_cast<const SharedSurfaceTextureData*>(GetInternalData())->Surf();
72
  }
73
};
74
75
} // namespace layers
76
} // namespace mozilla
77
78
#endif // MOZILLA_GFX_TEXTURECLIENT_SHAREDSURFACE_H