nsStreamTransportService.h 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  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. #ifndef nsStreamTransportService_h__
  5. #define nsStreamTransportService_h__
  6. #include "nsIStreamTransportService.h"
  7. #include "nsIEventTarget.h"
  8. #include "nsIObserver.h"
  9. #include "nsCOMPtr.h"
  10. #include "nsThreadUtils.h"
  11. #include "mozilla/Attributes.h"
  12. #include "mozilla/Mutex.h"
  13. class nsIThreadPool;
  14. namespace mozilla {
  15. namespace net {
  16. class nsStreamTransportService final : public nsIStreamTransportService
  17. , public nsIEventTarget
  18. , public nsIObserver
  19. {
  20. public:
  21. NS_DECL_THREADSAFE_ISUPPORTS
  22. NS_DECL_NSISTREAMTRANSPORTSERVICE
  23. NS_DECL_NSIEVENTTARGET
  24. NS_DECL_NSIOBSERVER
  25. using nsIEventTarget::Dispatch;
  26. nsresult Init();
  27. nsStreamTransportService() : mShutdownLock("nsStreamTransportService.mShutdownLock"),
  28. mIsShutdown(false) {}
  29. private:
  30. ~nsStreamTransportService();
  31. nsCOMPtr<nsIThreadPool> mPool;
  32. mozilla::Mutex mShutdownLock;
  33. bool mIsShutdown;
  34. };
  35. } // namespace net
  36. } // namespace mozilla
  37. #endif