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-10-08 08:27:13 +04:00
|
|
|
|
|
|
|
#ifndef nsSyncStreamListener_h__
|
|
|
|
#define nsSyncStreamListener_h__
|
|
|
|
|
|
|
|
#include "nsISyncStreamListener.h"
|
|
|
|
#include "nsIInputStream.h"
|
|
|
|
#include "nsIOutputStream.h"
|
|
|
|
#include "nsCOMPtr.h"
|
2012-06-06 07:18:25 +04:00
|
|
|
#include "mozilla/Attributes.h"
|
2003-10-08 08:27:13 +04:00
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
class nsSyncStreamListener final : public nsISyncStreamListener,
|
2015-03-27 21:52:19 +03:00
|
|
|
public nsIInputStream {
|
2003-10-08 08:27:13 +04:00
|
|
|
public:
|
|
|
|
NS_DECL_ISUPPORTS
|
|
|
|
NS_DECL_NSIREQUESTOBSERVER
|
|
|
|
NS_DECL_NSISTREAMLISTENER
|
|
|
|
NS_DECL_NSISYNCSTREAMLISTENER
|
|
|
|
NS_DECL_NSIINPUTSTREAM
|
2018-11-30 13:46:48 +03:00
|
|
|
|
2018-10-23 23:07:29 +03:00
|
|
|
static already_AddRefed<nsISyncStreamListener> Create();
|
2018-11-30 13:46:48 +03:00
|
|
|
|
2018-10-23 23:07:29 +03:00
|
|
|
private:
|
2003-10-08 08:27:13 +04:00
|
|
|
nsSyncStreamListener() : mStatus(NS_OK), mKeepWaiting(false), mDone(false) {}
|
2018-10-23 23:07:29 +03:00
|
|
|
~nsSyncStreamListener() = default;
|
2018-11-30 13:46:48 +03:00
|
|
|
|
2003-10-08 08:27:13 +04:00
|
|
|
nsresult Init();
|
2018-11-30 13:46:48 +03:00
|
|
|
|
2003-10-08 08:27:13 +04:00
|
|
|
nsresult WaitForData();
|
2018-11-30 13:46:48 +03:00
|
|
|
|
2003-10-08 08:27:13 +04:00
|
|
|
nsCOMPtr<nsIInputStream> mPipeIn;
|
|
|
|
nsCOMPtr<nsIOutputStream> mPipeOut;
|
|
|
|
nsresult mStatus;
|
2011-09-29 10:19:26 +04:00
|
|
|
bool mKeepWaiting;
|
|
|
|
bool mDone;
|
2003-10-08 08:27:13 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // nsSyncStreamListener_h__
|