netwerk/base/src/nsSyncStreamListener.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/netwerk/base/src/nsSyncStreamListener.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,45 @@
     1.4 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.5 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.6 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.7 +
     1.8 +#ifndef nsSyncStreamListener_h__
     1.9 +#define nsSyncStreamListener_h__
    1.10 +
    1.11 +#include "nsISyncStreamListener.h"
    1.12 +#include "nsIInputStream.h"
    1.13 +#include "nsIOutputStream.h"
    1.14 +#include "nsCOMPtr.h"
    1.15 +#include "mozilla/Attributes.h"
    1.16 +
    1.17 +//-----------------------------------------------------------------------------
    1.18 +
    1.19 +class nsSyncStreamListener MOZ_FINAL : public nsISyncStreamListener
    1.20 +                                     , public nsIInputStream
    1.21 +{
    1.22 +public:
    1.23 +    NS_DECL_ISUPPORTS
    1.24 +    NS_DECL_NSIREQUESTOBSERVER
    1.25 +    NS_DECL_NSISTREAMLISTENER
    1.26 +    NS_DECL_NSISYNCSTREAMLISTENER
    1.27 +    NS_DECL_NSIINPUTSTREAM
    1.28 +
    1.29 +    nsSyncStreamListener()
    1.30 +        : mStatus(NS_OK)
    1.31 +        , mKeepWaiting(false)
    1.32 +        , mDone(false) {}
    1.33 +
    1.34 +    nsresult Init();
    1.35 +
    1.36 +private:
    1.37 +    ~nsSyncStreamListener() {}
    1.38 +
    1.39 +    nsresult WaitForData();
    1.40 +
    1.41 +    nsCOMPtr<nsIInputStream>    mPipeIn;
    1.42 +    nsCOMPtr<nsIOutputStream>   mPipeOut;
    1.43 +    nsresult                    mStatus;
    1.44 +    bool                        mKeepWaiting;
    1.45 +    bool                        mDone;
    1.46 +};
    1.47 +
    1.48 +#endif // nsSyncStreamListener_h__

mercurial