nsStreamTransportService.h (1229B)
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 "nsTArray.h" 13 #include "nsThreadUtils.h" 14 #include "mozilla/DataMutex.h" 15 #include "mozilla/Mutex.h" 16 17 class nsIThreadPool; 18 19 namespace mozilla { 20 namespace net { 21 22 class nsStreamTransportService final : public nsIStreamTransportService, 23 public nsIEventTarget, 24 public nsIObserver { 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 nsStreamTransportService(); 34 35 private: 36 ~nsStreamTransportService(); 37 38 nsCOMPtr<nsIThreadPool> mPool MOZ_GUARDED_BY(mShutdownLock); 39 40 mozilla::Mutex mShutdownLock{"nsStreamTransportService.mShutdownLock"}; 41 bool mIsShutdown MOZ_GUARDED_BY(mShutdownLock){false}; 42 }; 43 44 } // namespace net 45 } // namespace mozilla 46 #endif