Bug 1064231 - unify instantiation process for RIL services. r=smaug

This commit is contained in:
Vicamo Yang 2014-09-21 15:24:44 +08:00
parent 622a105ded
commit 311da50812
24 changed files with 209 additions and 265 deletions

View File

@ -9,6 +9,13 @@
#include "mozilla/Preferences.h"
#include "nsServiceManagerUtils.h"
// Service instantiation
#include "ipc/MobileConnectionIPCService.h"
#if defined(MOZ_WIDGET_GONK) && defined(MOZ_B2G_RIL)
#include "nsIGonkMobileConnectionService.h"
#endif
#include "nsXULAppAPI.h" // For XRE_GetProcessType()
using namespace mozilla::dom;
NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(MobileConnectionArray,
@ -89,3 +96,19 @@ MobileConnectionArray::IndexedGetter(uint32_t aIndex, bool& aFound)
return mMobileConnections[aIndex];
}
already_AddRefed<nsIMobileConnectionService>
NS_CreateMobileConnectionService()
{
nsCOMPtr<nsIMobileConnectionService> service;
if (XRE_GetProcessType() == GeckoProcessType_Content) {
service = new mozilla::dom::mobileconnection::MobileConnectionIPCService();
} else {
#if defined(MOZ_WIDGET_GONK) && defined(MOZ_B2G_RIL)
service = do_CreateInstance(GONK_MOBILECONNECTION_SERVICE_CONTRACTID);
#endif
}
return service.forget();
}

View File

@ -209,6 +209,13 @@ interface nsIMobileConnectionService : nsISupports
nsIMobileConnection getItemByServiceId(in unsigned long serviceId);
};
%{C++
template<typename T> struct already_AddRefed;
already_AddRefed<nsIMobileConnectionService>
NS_CreateMobileConnectionService();
%}
[scriptable, uuid(04db7331-54fe-4cf7-9347-b9481350f4c2)]
interface nsIMobileConnection : nsISupports
{

View File

@ -14,21 +14,6 @@ using namespace mozilla::dom::mobileconnection;
NS_IMPL_ISUPPORTS(MobileConnectionIPCService, nsIMobileConnectionService)
StaticRefPtr<MobileConnectionIPCService> sService;
/* static */MobileConnectionIPCService*
MobileConnectionIPCService::GetSingleton()
{
MOZ_ASSERT(NS_IsMainThread());
if (sService) {
return sService;
}
sService = new MobileConnectionIPCService();
return sService;
}
MobileConnectionIPCService::MobileConnectionIPCService()
{
int32_t numRil = Preferences::GetInt("ril.numRadioInterfaces", 1);

View File

@ -19,12 +19,9 @@ public:
NS_DECL_ISUPPORTS
NS_DECL_NSIMOBILECONNECTIONSERVICE
static MobileConnectionIPCService*
GetSingleton();
private:
MobileConnectionIPCService();
private:
// MOZ_FINAL suppresses -Werror,-Wdelete-non-virtual-dtor
~MobileConnectionIPCService();

View File

@ -18,7 +18,6 @@ EXPORTS.mozilla.dom += [
EXPORTS.mozilla.dom.mobileconnection += [
'ipc/MobileConnectionChild.h',
'ipc/MobileConnectionIPCSerializer.h',
'ipc/MobileConnectionIPCService.h',
'ipc/MobileConnectionParent.h',
]

View File

@ -23,10 +23,23 @@
#include "nsIMmsService.h"
#include "nsIMobileMessageCallback.h"
#include "nsIMobileMessageDatabaseService.h"
#include "nsIMobileMessageService.h"
#include "nsIObserverService.h"
#include "nsISmsService.h"
#include "nsServiceManagerUtils.h" // For do_GetService()
// Service instantiation
#include "ipc/SmsIPCService.h"
#include "MobileMessageService.h"
#ifdef MOZ_WIDGET_ANDROID
#include "android/MobileMessageDatabaseService.h"
#include "android/SmsService.h"
#elif defined(MOZ_WIDGET_GONK) && defined(MOZ_B2G_RIL)
#include "nsIRilMobileMessageDatabaseService.h"
#include "gonk/SmsService.h"
#endif
#include "nsXULAppAPI.h" // For XRE_GetProcessType()
#define RECEIVED_EVENT_NAME NS_LITERAL_STRING("received")
#define RETRIEVING_EVENT_NAME NS_LITERAL_STRING("retrieving")
#define SENDING_EVENT_NAME NS_LITERAL_STRING("sending")
@ -686,3 +699,62 @@ MobileMessageManager::GetSmscAddress(const Optional<uint32_t>& aServiceId,
} // namespace dom
} // namespace mozilla
already_AddRefed<nsISmsService>
NS_CreateSmsService()
{
nsCOMPtr<nsISmsService> smsService;
if (XRE_GetProcessType() == GeckoProcessType_Content) {
smsService = SmsIPCService::GetSingleton();
} else {
#ifdef MOZ_WIDGET_ANDROID
smsService = new SmsService();
#elif defined(MOZ_WIDGET_GONK) && defined(MOZ_B2G_RIL)
smsService = new SmsService();
#endif
}
return smsService.forget();
}
already_AddRefed<nsIMobileMessageDatabaseService>
NS_CreateMobileMessageDatabaseService()
{
nsCOMPtr<nsIMobileMessageDatabaseService> mobileMessageDBService;
if (XRE_GetProcessType() == GeckoProcessType_Content) {
mobileMessageDBService = SmsIPCService::GetSingleton();
} else {
#ifdef MOZ_WIDGET_ANDROID
mobileMessageDBService = new MobileMessageDatabaseService();
#elif defined(MOZ_WIDGET_GONK) && defined(MOZ_B2G_RIL)
mobileMessageDBService =
do_CreateInstance(RIL_MOBILE_MESSAGE_DATABASE_SERVICE_CONTRACTID);
#endif
}
return mobileMessageDBService.forget();
}
already_AddRefed<nsIMmsService>
NS_CreateMmsService()
{
nsCOMPtr<nsIMmsService> mmsService;
if (XRE_GetProcessType() == GeckoProcessType_Content) {
mmsService = SmsIPCService::GetSingleton();
} else {
#if defined(MOZ_WIDGET_GONK) && defined(MOZ_B2G_RIL)
mmsService = do_CreateInstance("@mozilla.org/mms/rilmmsservice;1");
#endif
}
return mmsService.forget();
}
already_AddRefed<nsIMobileMessageService>
NS_CreateMobileMessageService()
{
nsCOMPtr<nsIMobileMessageService> service = new MobileMessageService();
return service.forget();
}

View File

@ -14,20 +14,6 @@ namespace mobilemessage {
NS_IMPL_ISUPPORTS(MobileMessageService, nsIMobileMessageService)
/* static */ StaticRefPtr<MobileMessageService> MobileMessageService::sSingleton;
/* static */ already_AddRefed<MobileMessageService>
MobileMessageService::GetInstance()
{
if (!sSingleton) {
sSingleton = new MobileMessageService();
ClearOnShutdown(&sSingleton);
}
nsRefPtr<MobileMessageService> service = sSingleton.get();
return service.forget();
}
NS_IMETHODIMP
MobileMessageService::CreateSmsMessage(int32_t aId,
uint64_t aThreadId,

View File

@ -5,9 +5,8 @@
#ifndef mozilla_dom_mobilemessage_MobileMessageService_h
#define mozilla_dom_mobilemessage_MobileMessageService_h
#include "mozilla/Attributes.h" // For MOZ_FINAL
#include "nsIMobileMessageService.h"
#include "mozilla/ClearOnShutdown.h"
#include "mozilla/StaticPtr.h"
namespace mozilla {
namespace dom {
@ -19,13 +18,11 @@ public:
NS_DECL_ISUPPORTS
NS_DECL_NSIMOBILEMESSAGESERVICE
static already_AddRefed<MobileMessageService> GetInstance();
MobileMessageService() { MOZ_COUNT_CTOR(MobileMessageService); }
private:
~MobileMessageService() {}
static StaticRefPtr<MobileMessageService> sSingleton;
// MOZ_FINAL suppresses -Werror,-Wdelete-non-virtual-dtor
~MobileMessageService() { MOZ_COUNT_DTOR(MobileMessageService); }
};
} // namespace mobilemessage

View File

@ -1,77 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "SmsServicesFactory.h"
#include "nsXULAppAPI.h"
#include "ipc/SmsIPCService.h"
#ifdef MOZ_WIDGET_ANDROID
#include "android/MobileMessageDatabaseService.h"
#include "android/SmsService.h"
#elif defined(MOZ_WIDGET_GONK) && defined(MOZ_B2G_RIL)
#include "gonk/SmsService.h"
#endif
#include "nsServiceManagerUtils.h"
#define RIL_MMSSERVICE_CONTRACTID "@mozilla.org/mms/rilmmsservice;1"
#define RIL_MOBILE_MESSAGE_DATABASE_SERVICE_CONTRACTID "@mozilla.org/mobilemessage/rilmobilemessagedatabaseservice;1"
namespace mozilla {
namespace dom {
namespace mobilemessage {
/* static */ already_AddRefed<nsISmsService>
SmsServicesFactory::CreateSmsService()
{
nsCOMPtr<nsISmsService> smsService;
if (XRE_GetProcessType() == GeckoProcessType_Content) {
smsService = new SmsIPCService();
} else {
#ifdef MOZ_WIDGET_ANDROID
smsService = new SmsService();
#elif defined(MOZ_WIDGET_GONK) && defined(MOZ_B2G_RIL)
smsService = new SmsService();
#endif
}
return smsService.forget();
}
/* static */ already_AddRefed<nsIMobileMessageDatabaseService>
SmsServicesFactory::CreateMobileMessageDatabaseService()
{
nsCOMPtr<nsIMobileMessageDatabaseService> mobileMessageDBService;
if (XRE_GetProcessType() == GeckoProcessType_Content) {
mobileMessageDBService = new SmsIPCService();
} else {
#ifdef MOZ_WIDGET_ANDROID
mobileMessageDBService = new MobileMessageDatabaseService();
#elif defined(MOZ_WIDGET_GONK) && defined(MOZ_B2G_RIL)
mobileMessageDBService = do_GetService(RIL_MOBILE_MESSAGE_DATABASE_SERVICE_CONTRACTID);
#endif
}
return mobileMessageDBService.forget();
}
/* static */ already_AddRefed<nsIMmsService>
SmsServicesFactory::CreateMmsService()
{
nsCOMPtr<nsIMmsService> mmsService;
if (XRE_GetProcessType() == GeckoProcessType_Content) {
mmsService = new SmsIPCService();
} else {
#if defined(MOZ_WIDGET_GONK) && defined(MOZ_B2G_RIL)
mmsService = do_CreateInstance(RIL_MMSSERVICE_CONTRACTID);
#endif
}
return mmsService.forget();
}
} // namespace mobilemessage
} // namespace dom
} // namespace mozilla

View File

@ -1,31 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef mozilla_dom_mobilemessage_SmsServicesFactory_h
#define mozilla_dom_mobilemessage_SmsServicesFactory_h
#include "nsCOMPtr.h"
class nsISmsService;
class nsIMmsService;
class nsIMobileMessageDatabaseService;
namespace mozilla {
namespace dom {
namespace mobilemessage {
class SmsServicesFactory
{
public:
static already_AddRefed<nsISmsService> CreateSmsService();
static already_AddRefed<nsIMobileMessageDatabaseService> CreateMobileMessageDatabaseService();
static already_AddRefed<nsIMmsService> CreateMmsService();
};
} // namespace mobilemessage
} // namespace dom
} // namespace mozilla
#endif // mozilla_dom_mobilemessage_SmsServicesFactory_h

View File

@ -3,6 +3,7 @@
* You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "nsISupports.idl"
interface nsIMobileMessageCallback;
interface nsIDOMBlob;
@ -28,3 +29,10 @@ interface nsIMmsService : nsISupports
in DOMString toAddress,
in DOMString iccId);
};
%{C++
template<typename T> struct already_AddRefed;
already_AddRefed<nsIMmsService>
NS_CreateMmsService();
%}

View File

@ -46,3 +46,10 @@ interface nsIMobileMessageDatabaseService : nsISupports
nsICursorContinueCallback createThreadCursor(in nsIMobileMessageCursorCallback callback);
};
%{C++
template<typename T> struct already_AddRefed;
already_AddRefed<nsIMobileMessageDatabaseService>
NS_CreateMobileMessageDatabaseService();
%}

View File

@ -64,3 +64,10 @@ interface nsIMobileMessageService : nsISupports
[array, size_is(threadCount)] in unsigned long long threadIds,
in uint32_t threadCount);
};
%{C++
template<typename T> struct already_AddRefed;
already_AddRefed<nsIMobileMessageService>
NS_CreateMobileMessageService();
%}

View File

@ -34,6 +34,13 @@ interface nsIRilMobileMessageDatabaseConcatenationCallback : nsISupports
void notify(in nsresult aRv, in jsval aCompleteMessage);
};
%{C++
#define RIL_MOBILE_MESSAGE_DATABASE_SERVICE_CID \
{ 0x29785f90, 0x6b5b, 0x11e2, { 0x92, 0x01, 0x3b, 0x28, 0x01, 0x70, 0xb2, 0xec } }
#define RIL_MOBILE_MESSAGE_DATABASE_SERVICE_CONTRACTID \
"@mozilla.org/mobilemessage/rilmobilemessagedatabaseservice;1"
%}
[scriptable, uuid(0b437a5c-a2bc-11e3-bd1b-dbb173eb35f8)]
interface nsIRilMobileMessageDatabaseService : nsIMobileMessageDatabaseService
{

View File

@ -33,3 +33,10 @@ interface nsISmsService : nsISupports
void getSmscAddress(in unsigned long serviceId,
in nsIMobileMessageCallback request);
};
%{C++
template<typename T> struct already_AddRefed;
already_AddRefed<nsISmsService>
NS_CreateSmsService();
%}

View File

@ -31,6 +31,9 @@ const char* kObservedPrefs[] = {
// TODO: Bug 767082 - WebSMS: sSmsChild leaks at shutdown
PSmsChild* gSmsChild;
// SmsIPCService is owned by nsLayoutModule.
SmsIPCService* sSingleton = nullptr;
PSmsChild*
GetSmsChild()
{
@ -101,6 +104,19 @@ NS_IMPL_ISUPPORTS(SmsIPCService,
nsIMobileMessageDatabaseService,
nsIObserver)
/* static */ already_AddRefed<SmsIPCService>
SmsIPCService::GetSingleton()
{
MOZ_ASSERT(NS_IsMainThread());
if (!sSingleton) {
sSingleton = new SmsIPCService();
}
nsRefPtr<SmsIPCService> service = sSingleton;
return service.forget();
}
SmsIPCService::SmsIPCService()
{
Preferences::AddStrongObservers(this, kObservedPrefs);
@ -108,6 +124,11 @@ SmsIPCService::SmsIPCService()
mSmsDefaultServiceId = getDefaultServiceId(kPrefSmsDefaultServiceId);
}
SmsIPCService::~SmsIPCService()
{
sSingleton = nullptr;
}
/*
* Implementation of nsIObserver.
*/

View File

@ -30,10 +30,14 @@ public:
NS_DECL_NSIMOBILEMESSAGEDATABASESERVICE
NS_DECL_NSIOBSERVER
SmsIPCService();
static already_AddRefed<SmsIPCService>
GetSingleton();
private:
~SmsIPCService() {}
SmsIPCService();
// MOZ_FINAL suppresses -Werror,-Wdelete-non-virtual-dtor
~SmsIPCService();
uint32_t mMmsDefaultServiceId;
uint32_t mSmsDefaultServiceId;

View File

@ -13,8 +13,6 @@ EXPORTS.mozilla.dom.mobilemessage += [
'Constants.h', # Required by almost all cpp files
'ipc/SmsChild.h',
'ipc/SmsParent.h',
'MobileMessageService.h', # Required by nsLayoutModule.cpp
'SmsServicesFactory.h', # Required by nsLayoutModule.cpp
'Types.h', # Required by IPDL SmsTypes.h
]
@ -62,7 +60,6 @@ UNIFIED_SOURCES += [
'MobileMessageService.cpp',
'MobileMessageThread.cpp',
'SmsMessage.cpp',
'SmsServicesFactory.cpp',
]
IPDL_SOURCES += [

View File

@ -26,6 +26,13 @@
#include "TelephonyCallGroup.h"
#include "TelephonyCallId.h"
// Service instantiation
#include "ipc/TelephonyIPCService.h"
#if defined(MOZ_WIDGET_GONK) && defined(MOZ_B2G_RIL)
#include "nsIGonkTelephonyService.h"
#endif
#include "nsXULAppAPI.h" // For XRE_GetProcessType()
using namespace mozilla::dom;
using mozilla::ErrorResult;
@ -738,3 +745,19 @@ Telephony::EnqueueEnumerationAck(const nsAString& aType)
NS_WARNING("Failed to dispatch to current thread!");
}
}
already_AddRefed<nsITelephonyService>
NS_CreateTelephonyService()
{
nsCOMPtr<nsITelephonyService> service;
if (XRE_GetProcessType() == GeckoProcessType_Content) {
service = new mozilla::dom::telephony::TelephonyIPCService();
} else {
#if defined(MOZ_WIDGET_GONK) && defined(MOZ_B2G_RIL)
service = do_CreateInstance(GONK_TELEPHONY_SERVICE_CONTRACTID);
#endif
}
return service.forget();
}

View File

@ -1,30 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "mozilla/dom/telephony/TelephonyFactory.h"
#if defined(MOZ_WIDGET_GONK) && defined(MOZ_B2G_RIL)
#include "nsIGonkTelephonyService.h"
#endif
#include "nsServiceManagerUtils.h"
#include "nsXULAppAPI.h"
#include "ipc/TelephonyIPCService.h"
USING_TELEPHONY_NAMESPACE
/* static */ already_AddRefed<nsITelephonyService>
TelephonyFactory::CreateTelephonyService()
{
nsCOMPtr<nsITelephonyService> service;
if (XRE_GetProcessType() == GeckoProcessType_Content) {
service = new TelephonyIPCService();
#if defined(MOZ_WIDGET_GONK) && defined(MOZ_B2G_RIL)
} else {
service = do_CreateInstance(GONK_TELEPHONY_SERVICE_CONTRACTID);
#endif
}
return service.forget();
}

View File

@ -1,24 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef mozilla_dom_telephony_TelephonyFactory_h
#define mozilla_dom_telephony_TelephonyFactory_h
#include "nsCOMPtr.h"
#include "mozilla/dom/telephony/TelephonyCommon.h"
class nsITelephonyService;
BEGIN_TELEPHONY_NAMESPACE
class TelephonyFactory
{
public:
static already_AddRefed<nsITelephonyService> CreateTelephonyService();
};
END_TELEPHONY_NAMESPACE
#endif // mozilla_dom_telephony_TelephonyFactory_h

View File

@ -22,7 +22,6 @@ EXPORTS.mozilla.dom.telephony += [
'ipc/TelephonyChild.h',
'ipc/TelephonyParent.h',
'TelephonyCommon.h',
'TelephonyFactory.h',
]
UNIFIED_SOURCES += [
@ -34,7 +33,6 @@ UNIFIED_SOURCES += [
'TelephonyCall.cpp',
'TelephonyCallGroup.cpp',
'TelephonyCallId.cpp',
'TelephonyFactory.cpp',
]
IPDL_SOURCES += [

View File

@ -265,3 +265,10 @@ interface nsITelephonyService : nsISupports
attribute bool microphoneMuted;
attribute bool speakerEnabled;
};
%{C++
template<typename T> struct already_AddRefed;
already_AddRefed<nsITelephonyService>
NS_CreateTelephonyService();
%}

View File

@ -125,15 +125,6 @@ using mozilla::dom::gonk::AudioManager;
using mozilla::system::nsVolumeService;
#endif
#ifdef MOZ_B2G_RIL
#include "nsIMobileConnectionService.h"
#include "mozilla/dom/mobileconnection/MobileConnectionIPCService.h"
using mozilla::dom::mobileconnection::MobileConnectionIPCService;
#ifdef MOZ_WIDGET_GONK
#include "nsIGonkMobileConnectionService.h"
#endif
#endif
#include "AudioChannelAgent.h"
using mozilla::dom::AudioChannelAgent;
@ -225,10 +216,9 @@ static void Shutdown();
#include "nsCSPContext.h"
#include "nsISmsService.h"
#include "nsIMmsService.h"
#include "nsIMobileConnectionService.h"
#include "nsIMobileMessageService.h"
#include "nsIMobileMessageDatabaseService.h"
#include "mozilla/dom/mobilemessage/MobileMessageService.h"
#include "mozilla/dom/mobilemessage/SmsServicesFactory.h"
#include "nsIPowerManagerService.h"
#include "nsIAlarmHalService.h"
#include "nsIMediaManager.h"
@ -243,7 +233,6 @@ static void Shutdown();
#include "mozilla/dom/time/TimeService.h"
#include "StreamingProtocolService.h"
#include "mozilla/dom/telephony/TelephonyFactory.h"
#include "nsITelephonyService.h"
#ifdef MOZ_WIDGET_GONK
@ -255,8 +244,6 @@ static void Shutdown();
using namespace mozilla;
using namespace mozilla::dom;
using namespace mozilla::dom::mobilemessage;
using namespace mozilla::dom::telephony;
using mozilla::dom::alarm::AlarmHalService;
using mozilla::dom::power::PowerManagerService;
using mozilla::dom::quota::QuotaManager;
@ -330,14 +317,12 @@ NS_GENERIC_FACTORY_CONSTRUCTOR(nsHapticFeedback)
#endif
#endif
NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(ThirdPartyUtil, Init)
NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(nsISmsService,
SmsServicesFactory::CreateSmsService)
NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(nsIMmsService,
SmsServicesFactory::CreateMmsService)
NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(nsISmsService, NS_CreateSmsService)
NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(nsIMmsService, NS_CreateMmsService)
NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(nsIMobileMessageService,
MobileMessageService::GetInstance)
NS_CreateMobileMessageService)
NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(nsIMobileMessageDatabaseService,
SmsServicesFactory::CreateMobileMessageDatabaseService)
NS_CreateMobileMessageDatabaseService)
NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(nsIPowerManagerService,
PowerManagerService::GetInstance)
NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(nsIAlarmHalService,
@ -363,8 +348,10 @@ NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(nsVolumeService,
#endif
NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(nsIMediaManagerService,
MediaManager::GetInstance)
NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(nsIMobileConnectionService,
NS_CreateMobileConnectionService)
NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(nsITelephonyService,
TelephonyFactory::CreateTelephonyService)
NS_CreateTelephonyService)
//-----------------------------------------------------------------------------
@ -806,9 +793,7 @@ NS_DEFINE_NAMED_CID(TELEPHONY_SERVICE_CID);
NS_DEFINE_NAMED_CID(GECKO_MEDIA_PLUGIN_SERVICE_CID);
#ifdef MOZ_B2G_RIL
NS_DEFINE_NAMED_CID(NS_MOBILE_CONNECTION_SERVICE_CID);
#endif
static nsresult
CreateWindowCommandTableConstructor(nsISupports *aOuter,
@ -938,31 +923,6 @@ nsEditingCommandTableConstructor(nsISupports *aOuter, REFNSIID aIID,
return commandTable->QueryInterface(aIID, aResult);
}
#ifdef MOZ_B2G_RIL
static nsresult
nsIMobileConnectionServiceConstructor(nsISupports *aOuter, REFNSIID aIID,
void **aResult)
{
nsCOMPtr<nsIMobileConnectionService> service;
if (XRE_GetProcessType() == GeckoProcessType_Content) {
service = MobileConnectionIPCService::GetSingleton();
} else {
#ifdef MOZ_WIDGET_GONK
service = do_CreateInstance(GONK_MOBILECONNECTION_SERVICE_CONTRACTID);
#endif
}
if (!service) {
return NS_ERROR_NOT_AVAILABLE;
}
return service->QueryInterface(aIID, aResult);
}
#endif
static const mozilla::Module::CIDEntry kLayoutCIDs[] = {
XPCONNECT_CIDENTRIES
#ifdef DEBUG
@ -1118,9 +1078,7 @@ static const mozilla::Module::CIDEntry kLayoutCIDs[] = {
{ &kNS_ACCESSIBILITY_SERVICE_CID, false, nullptr, CreateA11yService },
#endif
{ &kTELEPHONY_SERVICE_CID, false, nullptr, nsITelephonyServiceConstructor },
#ifdef MOZ_B2G_RIL
{ &kNS_MOBILE_CONNECTION_SERVICE_CID, true, NULL, nsIMobileConnectionServiceConstructor },
#endif
{ &kNS_MOBILE_CONNECTION_SERVICE_CID, false, NULL, nsIMobileConnectionServiceConstructor },
{ nullptr }
};
@ -1278,9 +1236,7 @@ static const mozilla::Module::ContractIDEntry kLayoutContracts[] = {
#endif
{ TELEPHONY_SERVICE_CONTRACTID, &kTELEPHONY_SERVICE_CID },
{ "@mozilla.org/gecko-media-plugin-service;1", &kGECKO_MEDIA_PLUGIN_SERVICE_CID },
#ifdef MOZ_B2G_RIL
{ NS_MOBILE_CONNECTION_SERVICE_CONTRACTID, &kNS_MOBILE_CONNECTION_SERVICE_CID },
#endif
{ nullptr }
};
@ -1303,9 +1259,7 @@ static const mozilla::Module::CategoryEntry kLayoutCategories[] = {
#ifdef MOZ_B2G_BT
{ "profile-after-change", "Bluetooth Service", BLUETOOTHSERVICE_CONTRACTID },
#endif
#ifdef MOZ_B2G_RIL
{ "profile-after-change", "MobileConnection Service", NS_MOBILE_CONNECTION_SERVICE_CONTRACTID },
#endif
{ nullptr }
};