Line data Source code
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 :
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 : {
23 0 : ~nsRequestObserverProxy() {}
24 :
25 : public:
26 : NS_DECL_THREADSAFE_ISUPPORTS
27 : NS_DECL_NSIREQUESTOBSERVER
28 : NS_DECL_NSIREQUESTOBSERVERPROXY
29 :
30 0 : nsRequestObserverProxy() {}
31 :
32 : nsIRequestObserver *Observer() { return mObserver; }
33 :
34 : nsresult FireEvent(nsARequestObserverEvent *);
35 :
36 : protected:
37 : nsMainThreadPtrHandle<nsIRequestObserver> mObserver;
38 : nsMainThreadPtrHandle<nsISupports> mContext;
39 :
40 : friend class nsOnStartRequestEvent;
41 : friend class nsOnStopRequestEvent;
42 : };
43 :
44 : class nsARequestObserverEvent : public Runnable
45 : {
46 : public:
47 : explicit nsARequestObserverEvent(nsIRequest *);
48 :
49 : protected:
50 0 : virtual ~nsARequestObserverEvent() {}
51 :
52 : nsCOMPtr<nsIRequest> mRequest;
53 : };
54 :
55 : } // namespace net
56 : } // namespace mozilla
57 :
58 : #endif // nsRequestObserverProxy_h__
|