nsRequestObserverProxy.h (1439B)
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 2 /* This Source Code Form is subject to the terms of the Mozilla Public 3 * License, v. 2.0. If a copy of the MPL was not distributed with this 4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 5 6 #ifndef nsRequestObserverProxy_h__ 7 #define nsRequestObserverProxy_h__ 8 9 #include "nsIRequestObserver.h" 10 #include "nsIRequestObserverProxy.h" 11 #include "nsIRequest.h" 12 #include "nsThreadUtils.h" 13 #include "nsCOMPtr.h" 14 #include "nsProxyRelease.h" 15 16 namespace mozilla { 17 namespace net { 18 19 class nsARequestObserverEvent; 20 21 class nsRequestObserverProxy final : public nsIRequestObserverProxy { 22 ~nsRequestObserverProxy() = default; 23 24 public: 25 NS_DECL_THREADSAFE_ISUPPORTS 26 NS_DECL_NSIREQUESTOBSERVER 27 NS_DECL_NSIREQUESTOBSERVERPROXY 28 29 nsRequestObserverProxy() = default; 30 31 nsIRequestObserver* Observer() { return mObserver; } 32 33 nsresult FireEvent(nsARequestObserverEvent*); 34 35 protected: 36 nsMainThreadPtrHandle<nsIRequestObserver> mObserver; 37 nsMainThreadPtrHandle<nsISupports> mContext; 38 39 friend class nsOnStartRequestEvent; 40 friend class nsOnStopRequestEvent; 41 }; 42 43 class nsARequestObserverEvent : public Runnable { 44 public: 45 explicit nsARequestObserverEvent(nsIRequest*); 46 47 protected: 48 virtual ~nsARequestObserverEvent() = default; 49 50 nsCOMPtr<nsIRequest> mRequest; 51 }; 52 53 } // namespace net 54 } // namespace mozilla 55 56 #endif // nsRequestObserverProxy_h__