53 #include <nsServiceManagerUtils.h>
71 static PRLogModuleInfo* gServiceManagerLog = nsnull;
72 #define TRACE(args) PR_LOG(gServiceManagerLog, PR_LOG_DEBUG, args)
73 #define LOG(args) PR_LOG(gServiceManagerLog, PR_LOG_WARN, args)
75 #define __FUNCTION__ __PRETTY_FUNCTION__
109 NS_ENSURE_ARG_POINTER(retval);
112 *retval = mReadyServiceTable.Get(NS_ConvertUTF8toUTF16(aServiceContractID),
114 TRACE((
"%s[%.8x] %s %d", __FUNCTION__,
this, aServiceContractID, *retval));
126 sbServiceManager::SetServiceReady(
const char* aServiceContractID,
127 PRBool aServiceReady)
129 TRACE((
"%s[%.8x] %s %d",
130 __FUNCTION__,
this, aServiceContractID, aServiceReady));
133 NS_ENSURE_STATE(mInitialized);
136 PRBool serviceReady = !!aServiceReady;
141 PRBool currentServiceReady;
142 rv = IsServiceReady(aServiceContractID, ¤tServiceReady);
143 NS_ENSURE_SUCCESS(rv, rv);
146 if (currentServiceReady == serviceReady)
150 nsAutoString serviceContractID = NS_ConvertUTF8toUTF16(aServiceContractID);
153 success = mReadyServiceTable.Put(serviceContractID, PR_TRUE);
154 NS_ENSURE_TRUE(success, NS_ERROR_OUT_OF_MEMORY);
157 rv = mObserverService->NotifyObservers(
this,
159 serviceContractID.get());
160 NS_ENSURE_SUCCESS(rv, rv);
164 rv = mObserverService->NotifyObservers(
this,
165 "before-service-shutdown",
166 serviceContractID.get());
167 NS_ENSURE_SUCCESS(rv, rv);
170 mReadyServiceTable.Remove(serviceContractID);
193 if (!gServiceManagerLog) {
194 gServiceManagerLog = PR_NewLogModule(
"sbServiceManager");
198 TRACE((
"%s[%.8x]", __FUNCTION__,
this));
209 TRACE((
"%s[%.8x]", __FUNCTION__,
this));
216 mReadyServiceTable.Clear();
228 TRACE((
"%s[%.8x]", __FUNCTION__,
this));
237 PRBool success = mReadyServiceTable.Init();
238 NS_ENSURE_TRUE(success, NS_ERROR_OUT_OF_MEMORY);
243 NS_ENSURE_SUCCESS(rv, rv);
246 mInitialized = PR_TRUE;
Songbird Service Manager Definitions.
NS_DECL_ISUPPORTS NS_DECL_SBISERVICEMANAGER sbServiceManager()
const sbCreateProxiedComponent do_ProxiedGetService(const nsCID &aCID, nsresult *error=0)
NS_IMPL_THREADSAFE_ISUPPORTS1(sbDeviceCapsCompatibility, sbIDeviceCapsCompatibility) sbDeviceCapsCompatibility
virtual ~sbServiceManager()