Line data Source code
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 :
12 : class nsIThread;
13 :
14 : namespace mozilla {
15 : namespace dom {
16 :
17 : class IPCBlobInputStreamChild;
18 :
19 0 : class IPCBlobInputStreamThread final : public nsIObserver
20 : {
21 : public:
22 : NS_DECL_THREADSAFE_ISUPPORTS
23 : NS_DECL_NSIOBSERVER
24 :
25 : static bool
26 : IsOnFileEventTarget(nsIEventTarget* aEventTarget);
27 :
28 : static IPCBlobInputStreamThread*
29 : GetOrCreate();
30 :
31 : void
32 : MigrateActor(IPCBlobInputStreamChild* aActor);
33 :
34 : void
35 : Initialize();
36 :
37 : private:
38 0 : ~IPCBlobInputStreamThread() = default;
39 :
40 : void
41 : MigrateActorInternal(IPCBlobInputStreamChild* aActor);
42 :
43 : nsCOMPtr<nsIThread> mThread;
44 :
45 : // This is populated if MigrateActor() is called before the initialization of
46 : // the thread.
47 : nsTArray<RefPtr<IPCBlobInputStreamChild>> mPendingActors;
48 : };
49 :
50 : } // dom namespace
51 : } // mozilla namespace
52 :
53 : #endif // mozilla_dom_IPCBlobInputStreamThread_h
|