netwerk/base/public/nsStreamListenerWrapper.h

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

     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 file,
     3  * You can obtain one at http://mozilla.org/MPL/2.0/. */
     5 #ifndef nsStreamListenerWrapper_h__
     6 #define nsStreamListenerWrapper_h__
     8 #include "nsCOMPtr.h"
     9 #include "nsIStreamListener.h"
    10 #include "nsIRequestObserver.h"
    11 #include "nsIThreadRetargetableStreamListener.h"
    12 #include "mozilla/Attributes.h"
    14 // Wrapper class to make replacement of nsHttpChannel's listener
    15 // from JavaScript possible. It is workaround for bug 433711 and 682305.
    16 class nsStreamListenerWrapper MOZ_FINAL : public nsIStreamListener
    17                                         , public nsIThreadRetargetableStreamListener
    18 {
    19 public:
    20   nsStreamListenerWrapper(nsIStreamListener *listener)
    21     : mListener(listener)
    22   {
    23     NS_ASSERTION(mListener, "no stream listener specified");
    24   }
    26   NS_DECL_ISUPPORTS
    27   NS_FORWARD_NSIREQUESTOBSERVER(mListener->)
    28   NS_FORWARD_NSISTREAMLISTENER(mListener->)
    29   NS_DECL_NSITHREADRETARGETABLESTREAMLISTENER
    31 private:
    32   ~nsStreamListenerWrapper() {}
    33   nsCOMPtr<nsIStreamListener> mListener;
    34 };
    36 #endif // nsStreamListenerWrapper_h__

mercurial