nsISupports
Last changed in Gecko 1.0 void getService(in nsCIDRef aClass, in nsIIDRef aIID, [iid_is(aIID),retval] out nsQIResult result); |
void getServiceByContractID(in string aContractID, in nsIIDRef aIID, [iid_is(aIID),retval] out nsQIResult result); |
boolean isServiceInstantiated(in nsCIDRef aClass, in nsIIDRef aIID); |
boolean isServiceInstantiatedByContractID(in string aContractID, in nsIIDRef aIID); |
This method returns a reference to a particular XPCOM service given the ClassID of the service. Unlike createInstance, this will always return the same object each time it is called with the same arguments.
void getService( in nsCIDRef aClass, in nsIIDRef aIID, [iid_is(aIID),retval] out nsQIResult result );
aClass
aIID
result
NS_ERROR_FACTORY_NOT_REGISTERED
This method returns a reference to a particular XPCOM service given the ContractID of the service.
void getServiceByContractID( in string aContractID, in nsIIDRef aIID, [iid_is(aIID),retval] out nsQIResult result );
aContractID
aIID
result
NS_ERROR_FACTORY_NOT_REGISTERED
This method tests whether or not a XPCOM service, identified by ClassID, has been instantiated.
boolean isServiceInstantiated( in nsCIDRef aClass, in nsIIDRef aIID );
aClass
aIID
true
if the service has already been created.
NS_ERROR_SERVICE_NOT_AVAILABLE
NS_NOINTERFACE
This method tests whether or not a XPCOM service, identified by ContractID, has been instantiated.
boolean isServiceInstantiatedByContractID( in string aContractID, in nsIIDRef aIID );
aContractID
aIID
true
if the service has already been created.
NS_ERROR_SERVICE_NOT_AVAILABLE
NS_NOINTERFACE
The service manager depends on the repository to find and instantiate factories to obtain services.
Because services are instantiated lazily, methods are provided to test whether or not a service has already been instantiated.
Users of the service manager must first obtain a pointer to the global service manager by calling NS_GetServiceManager
. After that, they can request specific services by calling getService()
. When they are finished they should call nsISupports.release()
on the service as they would with any interface pointer. In some language bindings, such as JavaScript, this step is unnecessary. And, moreover such languages typically offer more convenient mechanisms to acquire references to XPCOM services and components.
A user of a service may keep references to services until application shutdown.
This interface was frozen for Gecko 1.0. See bug 99147 for details. From Gecko 2.0 interfaces are no longer frozen.