2012-05-21 15:12:37 +04:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
2003-01-18 04:27:53 +03:00
|
|
|
|
|
|
|
#include "nsIStreamTransportService.h"
|
2006-05-10 21:30:15 +04:00
|
|
|
#include "nsIEventTarget.h"
|
|
|
|
#include "nsIObserver.h"
|
|
|
|
#include "nsCOMPtr.h"
|
2014-06-21 14:26:43 +04:00
|
|
|
#include "nsThreadUtils.h"
|
2012-06-06 07:18:25 +04:00
|
|
|
#include "mozilla/Attributes.h"
|
2014-06-21 14:26:43 +04:00
|
|
|
#include "mozilla/Mutex.h"
|
2003-01-18 04:27:53 +03:00
|
|
|
|
2013-09-22 07:04:57 +04:00
|
|
|
class nsIThreadPool;
|
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
class nsStreamTransportService final : public nsIStreamTransportService
|
2015-03-27 21:52:19 +03:00
|
|
|
, public nsIEventTarget
|
|
|
|
, public nsIObserver
|
2003-01-18 04:27:53 +03:00
|
|
|
{
|
|
|
|
public:
|
2013-07-19 06:24:13 +04:00
|
|
|
NS_DECL_THREADSAFE_ISUPPORTS
|
2003-01-18 04:27:53 +03:00
|
|
|
NS_DECL_NSISTREAMTRANSPORTSERVICE
|
2006-05-10 21:30:15 +04:00
|
|
|
NS_DECL_NSIEVENTTARGET
|
|
|
|
NS_DECL_NSIOBSERVER
|
2015-07-10 06:21:46 +03:00
|
|
|
// missing from NS_DECL_NSIEVENTTARGET because MSVC
|
|
|
|
nsresult Dispatch(nsIRunnable* aEvent, uint32_t aFlags) {
|
|
|
|
return Dispatch(nsCOMPtr<nsIRunnable>(aEvent).forget(), aFlags);
|
|
|
|
}
|
2006-05-10 21:30:15 +04:00
|
|
|
|
|
|
|
nsresult Init();
|
2003-01-18 04:27:53 +03:00
|
|
|
|
2014-06-21 14:26:43 +04:00
|
|
|
nsStreamTransportService() : mShutdownLock("nsStreamTransportService.mShutdownLock"),
|
|
|
|
mIsShutdown(false) {}
|
2006-05-10 21:30:15 +04:00
|
|
|
|
|
|
|
private:
|
|
|
|
~nsStreamTransportService();
|
|
|
|
|
|
|
|
nsCOMPtr<nsIThreadPool> mPool;
|
2014-06-21 14:26:43 +04:00
|
|
|
|
|
|
|
mozilla::Mutex mShutdownLock;
|
|
|
|
bool mIsShutdown;
|
2003-01-18 04:27:53 +03:00
|
|
|
};
|