Line data Source code
1 : /* This Source Code Form is subject to the terms of the Mozilla Public
2 : * License, v. 2.0. If a copy of the MPL was not distributed with this
3 : * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
4 :
5 : #ifndef nsStreamTransportService_h__
6 : #define nsStreamTransportService_h__
7 :
8 : #include "nsIStreamTransportService.h"
9 : #include "nsIEventTarget.h"
10 : #include "nsIObserver.h"
11 : #include "nsCOMPtr.h"
12 : #include "nsThreadUtils.h"
13 : #include "mozilla/Attributes.h"
14 : #include "mozilla/Mutex.h"
15 :
16 : class nsIThreadPool;
17 :
18 : namespace mozilla {
19 : namespace net {
20 :
21 : class nsStreamTransportService final : public nsIStreamTransportService
22 : , public nsIEventTarget
23 : , public nsIObserver
24 : {
25 : public:
26 : NS_DECL_THREADSAFE_ISUPPORTS
27 : NS_DECL_NSISTREAMTRANSPORTSERVICE
28 : NS_DECL_NSIEVENTTARGET_FULL
29 : NS_DECL_NSIOBSERVER
30 :
31 : nsresult Init();
32 :
33 3 : nsStreamTransportService() : mShutdownLock("nsStreamTransportService.mShutdownLock"),
34 3 : mIsShutdown(false) {}
35 :
36 : private:
37 : ~nsStreamTransportService();
38 :
39 : nsCOMPtr<nsIThreadPool> mPool;
40 :
41 : mozilla::Mutex mShutdownLock;
42 : bool mIsShutdown;
43 : };
44 :
45 : } // namespace net
46 : } // namespace mozilla
47 : #endif
|