1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/dom/icc/src/IccListener.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,52 @@ 1.4 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.5 + * License, v. 2.0. If a copy of the MPL was not distributed with this file, 1.6 + * You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.7 + 1.8 +#ifndef mozilla_dom_IccListener_h 1.9 +#define mozilla_dom_IccListener_h 1.10 + 1.11 +#include "nsAutoPtr.h" 1.12 +#include "nsIIccProvider.h" 1.13 + 1.14 +namespace mozilla { 1.15 +namespace dom { 1.16 + 1.17 +class IccManager; 1.18 +class Icc; 1.19 + 1.20 +class IccListener : public nsIIccListener 1.21 +{ 1.22 +public: 1.23 + NS_DECL_ISUPPORTS 1.24 + NS_DECL_NSIICCLISTENER 1.25 + 1.26 + IccListener(IccManager* aIccManager, uint32_t aClientId); 1.27 + ~IccListener(); 1.28 + 1.29 + void 1.30 + Shutdown(); 1.31 + 1.32 + already_AddRefed<Icc> 1.33 + GetIcc() 1.34 + { 1.35 + nsRefPtr<Icc> icc = mIcc; 1.36 + return icc.forget(); 1.37 + } 1.38 + 1.39 +private: 1.40 + uint32_t mClientId; 1.41 + // We did not setup 'mIcc' and 'mIccManager' being a participant of cycle 1.42 + // collection is because in Navigator->Invalidate() it will call 1.43 + // mIccManager->Shutdown(), then IccManager will call Shutdown() of each 1.44 + // IccListener, this will release the reference and break the cycle. 1.45 + nsRefPtr<Icc> mIcc; 1.46 + nsRefPtr<IccManager> mIccManager; 1.47 + // mProvider is a xpcom service and will be released at shutdown, so it 1.48 + // doesn't need to be cycle collected. 1.49 + nsCOMPtr<nsIIccProvider> mProvider; 1.50 +}; 1.51 + 1.52 +} // namespace dom 1.53 +} // namespace mozilla 1.54 + 1.55 +#endif // mozilla_dom_IccListener_h 1.56 \ No newline at end of file