Coverage Report

Created: 2018-09-25 14:53

/work/obj-fuzz/dist/include/mozilla/layers/SyncObject.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_LAYERS_SYNCOBJECT_H
8
#define MOZILLA_GFX_LAYERS_SYNCOBJECT_H
9
10
#include "mozilla/RefCounted.h"
11
12
struct ID3D11Device;
13
14
namespace mozilla {
15
namespace layers {
16
17
#ifdef XP_WIN
18
typedef void* SyncHandle;
19
#else
20
typedef uintptr_t SyncHandle;
21
#endif // XP_WIN
22
23
class SyncObjectHost : public RefCounted<SyncObjectHost>
24
{
25
public:
26
  MOZ_DECLARE_REFCOUNTED_VIRTUAL_TYPENAME(SyncObjectHost)
27
0
  virtual ~SyncObjectHost() { }
28
29
  static already_AddRefed<SyncObjectHost> CreateSyncObjectHost(
30
#ifdef XP_WIN
31
                                                               ID3D11Device* aDevice = nullptr
32
#endif
33
                                                              );
34
35
  virtual bool Init() = 0;
36
37
  virtual SyncHandle GetSyncHandle() = 0;
38
39
  // Return false for failed synchronization.
40
  virtual bool Synchronize() = 0;
41
42
protected:
43
0
  SyncObjectHost() { }
44
};
45
46
class SyncObjectClient : public external::AtomicRefCounted<SyncObjectClient>
47
{
48
public:
49
  MOZ_DECLARE_REFCOUNTED_VIRTUAL_TYPENAME(SyncObjectClient)
50
0
  virtual ~SyncObjectClient() { }
51
52
  static already_AddRefed<SyncObjectClient> CreateSyncObjectClient(SyncHandle aHandle
53
#ifdef XP_WIN
54
                                                                   , ID3D11Device* aDevice = nullptr
55
#endif
56
                                                                  );
57
58
  enum class SyncType {
59
    D3D11,
60
  };
61
62
  virtual SyncType GetSyncType() = 0;
63
64
  // Return false for failed synchronization.
65
  virtual bool Synchronize(bool aFallible = false) = 0;
66
67
  virtual bool IsSyncObjectValid() = 0;
68
69
protected:
70
0
  SyncObjectClient() { }
71
};
72
73
} // namespace layers
74
} // namespace mozilla
75
76
#endif //MOZILLA_GFX_LAYERS_SYNCOBJECT_H