Coverage Report

Created: 2018-09-25 14:53

/src/mozilla-central/dom/file/ipc/IPCBlobInputStreamThread.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_dom_IPCBlobInputStreamThread_h
8
#define mozilla_dom_IPCBlobInputStreamThread_h
9
10
#include "nsIObserverService.h"
11
#include "nsIEventTarget.h"
12
#include "nsIObserver.h"
13
14
class nsIThread;
15
16
namespace mozilla {
17
namespace dom {
18
19
class IPCBlobInputStreamChild;
20
21
class IPCBlobInputStreamThread final : public nsIObserver
22
                                     , public nsIEventTarget
23
{
24
public:
25
  NS_DECL_THREADSAFE_ISUPPORTS
26
  NS_DECL_NSIOBSERVER
27
  NS_DECL_NSIEVENTTARGET
28
29
  static bool
30
  IsOnFileEventTarget(nsIEventTarget* aEventTarget);
31
32
  static IPCBlobInputStreamThread*
33
  GetOrCreate();
34
35
  void
36
  MigrateActor(IPCBlobInputStreamChild* aActor);
37
38
  bool
39
  Initialize();
40
41
  void
42
  InitializeOnMainThread();
43
44
private:
45
0
  ~IPCBlobInputStreamThread() = default;
46
47
  void
48
  MigrateActorInternal(IPCBlobInputStreamChild* aActor);
49
50
  nsCOMPtr<nsIThread> mThread;
51
52
  // This is populated if MigrateActor() is called before the initialization of
53
  // the thread.
54
  nsTArray<RefPtr<IPCBlobInputStreamChild>> mPendingActors;
55
};
56
57
} // dom namespace
58
} // mozilla namespace
59
60
#endif // mozilla_dom_IPCBlobInputStreamThread_h