nsRequestObserverProxy.h 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
  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. #ifndef nsRequestObserverProxy_h__
  6. #define nsRequestObserverProxy_h__
  7. #include "nsIRequestObserver.h"
  8. #include "nsIRequestObserverProxy.h"
  9. #include "nsIRequest.h"
  10. #include "nsThreadUtils.h"
  11. #include "nsCOMPtr.h"
  12. #include "nsProxyRelease.h"
  13. namespace mozilla {
  14. namespace net {
  15. class nsARequestObserverEvent;
  16. class nsRequestObserverProxy final : public nsIRequestObserverProxy
  17. {
  18. ~nsRequestObserverProxy() {}
  19. public:
  20. NS_DECL_THREADSAFE_ISUPPORTS
  21. NS_DECL_NSIREQUESTOBSERVER
  22. NS_DECL_NSIREQUESTOBSERVERPROXY
  23. nsRequestObserverProxy() {}
  24. nsIRequestObserver *Observer() { return mObserver; }
  25. nsresult FireEvent(nsARequestObserverEvent *);
  26. protected:
  27. nsMainThreadPtrHandle<nsIRequestObserver> mObserver;
  28. nsMainThreadPtrHandle<nsISupports> mContext;
  29. friend class nsOnStartRequestEvent;
  30. friend class nsOnStopRequestEvent;
  31. };
  32. class nsARequestObserverEvent : public Runnable
  33. {
  34. public:
  35. explicit nsARequestObserverEvent(nsIRequest *);
  36. protected:
  37. virtual ~nsARequestObserverEvent() {}
  38. nsCOMPtr<nsIRequest> mRequest;
  39. };
  40. } // namespace net
  41. } // namespace mozilla
  42. #endif // nsRequestObserverProxy_h__