Coverage Report

Created: 2018-09-25 14:53

/src/mozilla-central/gfx/layers/ipc/VideoBridgeChild.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_VIDEOBRIDGECHILD_H
8
#define MOZILLA_GFX_VIDEOBRIDGECHILD_H
9
10
#include "mozilla/layers/PVideoBridgeChild.h"
11
#include "ISurfaceAllocator.h"
12
#include "TextureForwarder.h"
13
14
namespace mozilla {
15
namespace layers {
16
17
class VideoBridgeChild final : public PVideoBridgeChild
18
                             , public TextureForwarder
19
{
20
public:
21
  NS_INLINE_DECL_THREADSAFE_REFCOUNTING(VideoBridgeChild, override);
22
23
  static void Startup();
24
  static void Shutdown();
25
26
  static VideoBridgeChild* GetSingleton();
27
28
  // PVideoBridgeChild
29
  PTextureChild* AllocPTextureChild(const SurfaceDescriptor& aSharedData,
30
                                    const ReadLockDescriptor& aReadLock,
31
                                    const LayersBackend& aLayersBackend,
32
                                    const TextureFlags& aFlags,
33
                                    const uint64_t& aSerial) override;
34
  bool DeallocPTextureChild(PTextureChild* actor) override;
35
36
  void ActorDestroy(ActorDestroyReason aWhy) override;
37
  void DeallocPVideoBridgeChild() override;
38
39
40
  // ISurfaceAllocator
41
  bool AllocUnsafeShmem(size_t aSize,
42
                        mozilla::ipc::SharedMemory::SharedMemoryType aShmType,
43
                        mozilla::ipc::Shmem* aShmem) override;
44
  bool AllocShmem(size_t aSize,
45
                  mozilla::ipc::SharedMemory::SharedMemoryType aShmType,
46
                  mozilla::ipc::Shmem* aShmem) override;
47
  bool DeallocShmem(mozilla::ipc::Shmem& aShmem) override;
48
49
  // TextureForwarder
50
  PTextureChild* CreateTexture(const SurfaceDescriptor& aSharedData,
51
                               const ReadLockDescriptor& aReadLock,
52
                               LayersBackend aLayersBackend,
53
                               TextureFlags aFlags,
54
                               uint64_t aSerial,
55
                               wr::MaybeExternalImageId& aExternalImageId,
56
                               nsIEventTarget* aTarget = nullptr) override;
57
58
  // ClientIPCAllocator
59
0
  base::ProcessId GetParentPid() const override { return OtherPid(); }
60
0
  MessageLoop * GetMessageLoop() const override { return mMessageLoop; }
61
0
  void CancelWaitForRecycle(uint64_t aTextureId) override { MOZ_ASSERT(false, "NO RECYCLING HERE"); }
62
63
  // ISurfaceAllocator
64
  bool IsSameProcess() const override;
65
66
0
  bool CanSend() { return mCanSend; }
67
68
private:
69
  VideoBridgeChild();
70
  ~VideoBridgeChild();
71
72
  RefPtr<VideoBridgeChild> mIPDLSelfRef;
73
  MessageLoop* mMessageLoop;
74
  bool mCanSend;
75
};
76
77
} // namespace layers
78
} // namespace mozilla
79
80
#endif