diff --git a/mozilla/xpcom/doc/xpcom-code-faq.html b/mozilla/xpcom/doc/xpcom-code-faq.html new file mode 100644 index 00000000000..397d1e699eb --- /dev/null +++ b/mozilla/xpcom/doc/xpcom-code-faq.html @@ -0,0 +1,60 @@ + + + + + + + XPCOM Code FAQ + + + +

+XPCOM Code FAQ

+Suresh Duddi <dp@netscape.com> +
Last Modified: March 22 1999 +
+
+
I am documenting things randomly as I am replying to people's questions. +So this might look more like an FAQ. +

+What are the Global Objects that XPCOM maintains

+ + + +

+What are the static classes that XPCOM maintains

+ +
nsComponentManager +
nsServiceManager
+ +

+Is there any restriction on which static class I should call first

+ +
No restrictions. You can call any function from the static +classes nsComponentManager and nsServiceManager. XPCOM will do the right +thing to initialize itself at both places.
+ +

+What is the order of creation of the ServiceManager, ComponentManager and +Registry

+ +
Init_XPCOM() +
    create the global component manager +
    create the global registry and register as service +with global service manager +
    create the global component manager and register +as service with the global service manager +

Now the hard problem is when to trigger Init_XPCOM() There are two static +objects nsComponentManager and nsServiceManager. Any function in either +of them can be called first. Today nsServiceManager::GetService() is the +first one that gets called. All the members of the static nsServiceManager +use the nsGetGlobalServiceManager() to get to the global service manager. +All members of the static nsComponentManager use the nsGetGlobalComponentManager() +to get to the global component manager. Hence if we trigger Init_XPCOM() +from both NS_GetGlobalComponentManager() and NS_GetGlobalServiceManager() +we will be safe.

+ +
+ +