diff --git a/mozilla/xpcom/doc/xpcom-code-faq.html b/mozilla/xpcom/doc/xpcom-code-faq.html index ed74a0a9f3b..73ab921a1b5 100644 --- a/mozilla/xpcom/doc/xpcom-code-faq.html +++ b/mozilla/xpcom/doc/xpcom-code-faq.html @@ -2,7 +2,7 @@ - + XPCOM Code FAQ @@ -75,7 +75,139 @@ component manager to create the their own registry access object. This is required because the open() call is supported by the nsIRegistry() and if we maintain a global registry arbitrating which registry file is opened is going to be a major headach. -

The ProgID for the registry will be component://netscape/registry +

The ProgID for the registry will be component://netscape/registry +
  + +

+ComponentManager Vs ServiceManager

+ +
ComponentManager is the only way for +component creation. ComponentManager always uses the component's factory +to create the component instance. Clients (code that calls CreateInstance() +to create and use a component) call the ComponentManager to create instances. +Components (the code that implemented NSRegisterSelf()) calls the ComponentManager +to register itself and gets called when a Client wants to instantiate a +component. +

ServiceManager is a convinience for getting singleton +components, components for which only one instance stays alive for the +entire application e.g Netlib. It enforces only one of a kind of a component +to exist. Hence the notion of getting a service not creating one. (as opposed +to the notion of Creating instances with the componentManager). ServiceManager +is a convenience because components can technically force singletonism +by making their factory return the same instance if one was created already. +The other big use of ServiceManager is the (still unimplemented) notion +of Shutting down a service. +

Client +

+Component + +
+ +

+ProgID Vs CLSID

+ +
ClassID or CLSID is the unique indentification of a component. +It is a structure of huge numbers generated by using uuidgen on a windows +box. It is represented as a string in documentation as {108d75a0-bab5-11d2-96c4-0060b0fb9956} +

ProgID is the string identification of an implementation of a component +the client is looking for. The representation takes a URI syntax. Eg. component://netscape/network/protocol&name=http +Some simplify this to, ProgID is a more readable string form of a CLSID. +That is acceptable on the periphery. The ProgID is a Client thing. Components +register with component manager to claim that they are the implementation +for a ProgID. A component can register to be the implementation for multiple +ProgIDs (not implemented yet). +

Client +

+Component + + +
  +