Coverage Report

Created: 2018-09-25 14:53

/work/obj-fuzz/dist/include/GMPCrashHelper.h
Line
Count
Source (jump to first uncovered line)
1
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2
/* vim:set ts=2 sw=2 sts=2 et cindent: */
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
#if !defined(GMPCrashHelper_h_)
8
#define GMPCrashHelper_h_
9
10
#include "MainThreadUtils.h"
11
#include "nsISupportsImpl.h"
12
#include "nsPIDOMWindow.h"
13
14
namespace mozilla {
15
16
// For every GMP actor requested, the caller can specify a crash helper,
17
// which is an object which supplies the nsPIDOMWindowInner to which we'll
18
// dispatch the PluginCrashed event if the GMP crashes.
19
// GMPCrashHelper has threadsafe refcounting. Its release method ensures
20
// that instances are destroyed on the main thread.
21
class GMPCrashHelper
22
{
23
public:
24
  NS_METHOD_(MozExternalRefCountType) AddRef(void);
25
  NS_METHOD_(MozExternalRefCountType) Release(void);
26
27
  // Called on the main thread.
28
  virtual already_AddRefed<nsPIDOMWindowInner> GetPluginCrashedEventTarget() = 0;
29
30
protected:
31
  virtual ~GMPCrashHelper()
32
0
  {
33
0
    MOZ_ASSERT(NS_IsMainThread());
34
0
  }
35
  void Destroy();
36
  mozilla::ThreadSafeAutoRefCnt mRefCnt;
37
  NS_DECL_OWNINGTHREAD
38
};
39
40
} // namespace mozilla
41
42
#endif // GMPCrashHelper_h_