Thu, 22 Jan 2015 13:21:57 +0100
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 mozilla_dom_IccListener_h
6 #define mozilla_dom_IccListener_h
8 #include "nsAutoPtr.h"
9 #include "nsIIccProvider.h"
11 namespace mozilla {
12 namespace dom {
14 class IccManager;
15 class Icc;
17 class IccListener : public nsIIccListener
18 {
19 public:
20 NS_DECL_ISUPPORTS
21 NS_DECL_NSIICCLISTENER
23 IccListener(IccManager* aIccManager, uint32_t aClientId);
24 ~IccListener();
26 void
27 Shutdown();
29 already_AddRefed<Icc>
30 GetIcc()
31 {
32 nsRefPtr<Icc> icc = mIcc;
33 return icc.forget();
34 }
36 private:
37 uint32_t mClientId;
38 // We did not setup 'mIcc' and 'mIccManager' being a participant of cycle
39 // collection is because in Navigator->Invalidate() it will call
40 // mIccManager->Shutdown(), then IccManager will call Shutdown() of each
41 // IccListener, this will release the reference and break the cycle.
42 nsRefPtr<Icc> mIcc;
43 nsRefPtr<IccManager> mIccManager;
44 // mProvider is a xpcom service and will be released at shutdown, so it
45 // doesn't need to be cycle collected.
46 nsCOMPtr<nsIIccProvider> mProvider;
47 };
49 } // namespace dom
50 } // namespace mozilla
52 #endif // mozilla_dom_IccListener_h