tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

nsSyncStreamListener.h (1209B)


      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 nsSyncStreamListener_h__
      6 #define nsSyncStreamListener_h__
      7 
      8 #include "nsISyncStreamListener.h"
      9 #include "nsIInputStream.h"
     10 #include "nsIOutputStream.h"
     11 #include "nsCOMPtr.h"
     12 
     13 //-----------------------------------------------------------------------------
     14 
     15 class nsSyncStreamListener final : public nsISyncStreamListener,
     16                                   public nsIInputStream {
     17 public:
     18  NS_DECL_ISUPPORTS
     19  NS_DECL_NSIREQUESTOBSERVER
     20  NS_DECL_NSISTREAMLISTENER
     21  NS_DECL_NSISYNCSTREAMLISTENER
     22  NS_DECL_NSIINPUTSTREAM
     23 
     24 private:
     25  // Factory method:
     26  friend nsresult NS_NewSyncStreamListener(nsIStreamListener** result,
     27                                           nsIInputStream** stream);
     28  nsSyncStreamListener();
     29  ~nsSyncStreamListener() = default;
     30 
     31  nsresult Init();
     32 
     33  nsresult WaitForData();
     34 
     35  nsCOMPtr<nsIInputStream> mPipeIn;
     36  nsCOMPtr<nsIOutputStream> mPipeOut;
     37  nsresult mStatus{NS_OK};
     38  bool mKeepWaiting{false};
     39  bool mDone{false};
     40 };
     41 
     42 #endif  // nsSyncStreamListener_h__