From fa2d0b7e9848ac7c97c96e2ac10abb3c6d94b5f0 Mon Sep 17 00:00:00 2001 From: "dougt%netscape.com" Date: Mon, 22 Oct 2001 22:01:27 +0000 Subject: [PATCH] 99163 - removing nsObserverService.h includes. Also fixing 106090, extra methods on nsObserverService. r=shaver@mozilla.org, sr=jband@netscape.com git-svn-id: svn://10.0.0.236/trunk@105973 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/chrome/src/nsChromeRegistry.cpp | 3 +- mozilla/content/build/nsContentModule.cpp | 3 +- .../events/src/nsEventStateManager.cpp | 5 +-- .../html/content/src/nsFormSubmitter.cpp | 3 +- mozilla/content/xbl/src/nsXBLService.cpp | 3 +- mozilla/dom/src/base/nsJSEnvironment.cpp | 3 +- mozilla/dom/src/build/nsDOMFactory.cpp | 3 +- .../windowwatcher/src/nsWindowWatcher.cpp | 9 ++-- mozilla/embedding/qa/testembed/TestEmbed.cpp | 5 +-- mozilla/embedding/tests/mfcembed/MfcEmbed.cpp | 3 +- mozilla/embedding/tests/winEmbed/winEmbed.cpp | 5 +-- .../accessproxy/nsAccessProxy.cpp | 3 +- mozilla/extensions/cookie/nsCookieService.cpp | 3 +- .../extensions/cookie/nsPermissionManager.cpp | 3 +- .../p3p/src/nsP3PObserverFormSubmit.cpp | 3 +- .../extensions/p3p/src/nsP3PObserverHTML.cpp | 3 +- .../p3p/src/nsP3PObserverLayout.cpp | 3 +- .../extensions/p3p/src/nsP3PObserverXML.cpp | 3 +- mozilla/extensions/pics/src/nsPICS.cpp | 5 +-- mozilla/extensions/pics/tests/TestPICS.cpp | 3 +- .../source/xslt/XSLTProcessor.cpp | 3 +- .../extensions/wallet/src/nsWalletService.cpp | 5 +-- mozilla/gfx/src/windows/nsFontMetricsWin.cpp | 3 +- .../chardet/src/nsXMLEncodingObserver.cpp | 6 +-- mozilla/intl/strres/src/nsStringBundle.cpp | 5 +-- .../intl/unicharutil/util/nsUnicharUtils.cpp | 3 +- .../xpconnect/loader/mozJSComponentLoader.cpp | 3 +- mozilla/layout/base/nsPresShell.cpp | 3 +- mozilla/layout/html/base/src/nsPresShell.cpp | 3 +- mozilla/layout/html/forms/src/nsFormFrame.cpp | 3 +- .../layout/mathml/base/src/nsMathMLChar.cpp | 5 +-- .../mailnews/base/src/nsMessengerMigrator.cpp | 5 +-- .../mailnews/base/src/nsMsgAccountManager.cpp | 5 +-- .../mailnews/base/src/nsMsgBiffManager.cpp | 5 +-- .../mailnews/base/src/nsMsgRDFDataSource.cpp | 5 +-- .../mailnews/db/msgdb/src/nsDBFolderInfo.cpp | 3 +- mozilla/modules/libjar/nsJAR.cpp | 3 +- mozilla/modules/libpref/src/nsAutoConfig.cpp | 5 +-- mozilla/modules/libpref/src/nsPrefService.cpp | 3 +- .../plugin/base/src/nsPluginHostImpl.cpp | 5 +-- mozilla/netwerk/base/src/nsIOService.cpp | 3 +- mozilla/netwerk/cache/src/nsCacheService.cpp | 5 +-- .../protocol/http/src/nsHttpHandler.cpp | 3 +- mozilla/profile/src/nsProfile.cpp | 5 +-- mozilla/rdf/chrome/src/nsChromeRegistry.cpp | 3 +- mozilla/rdf/datasource/src/nsLocalStore.cpp | 3 +- .../exthandler/nsExternalHelperAppService.cpp | 5 +-- mozilla/xpcom/base/nsExceptionService.cpp | 3 +- mozilla/xpcom/base/nsMemoryImpl.cpp | 3 +- mozilla/xpcom/build/nsXPComInit.cpp | 4 +- .../xpcom/components/nsComponentManager.cpp | 3 +- .../components/nsNativeComponentLoader.cpp | 5 +-- mozilla/xpcom/ds/nsIObserver.idl | 3 ++ mozilla/xpcom/ds/nsObserverService.cpp | 43 +++++++++---------- mozilla/xpcom/ds/nsObserverService.h | 5 +-- mozilla/xpcom/tests/TestObserverService.cpp | 3 +- mozilla/xpcom/threads/nsEventQueue.cpp | 3 +- .../xpfe/appshell/src/nsAppShellService.cpp | 3 +- .../xpfe/appshell/src/nsWebShellWindow.cpp | 5 +-- mozilla/xpfe/appshell/src/nsXULWindow.cpp | 3 +- mozilla/xpfe/bootstrap/nsAppRunner.cpp | 3 +- mozilla/xpfe/bootstrap/nsDocLoadObserver.cpp | 5 +-- .../xpfe/bootstrap/nsNativeAppSupportWin.cpp | 3 +- .../xpfe/browser/src/nsBrowserInstance.cpp | 3 +- .../bookmarks/src/nsBookmarksService.cpp | 3 +- .../history/src/nsGlobalHistory.cpp | 3 +- .../search/src/nsInternetSearchService.cpp | 3 +- mozilla/xpinstall/src/nsSoftwareUpdate.cpp | 3 +- mozilla/xpinstall/src/nsXPIProxy.cpp | 3 +- 69 files changed, 115 insertions(+), 182 deletions(-) diff --git a/mozilla/chrome/src/nsChromeRegistry.cpp b/mozilla/chrome/src/nsChromeRegistry.cpp index 4fd267e1568..11342c48b2b 100644 --- a/mozilla/chrome/src/nsChromeRegistry.cpp +++ b/mozilla/chrome/src/nsChromeRegistry.cpp @@ -102,7 +102,6 @@ #include "nsAppDirectoryServiceDefs.h" #include "nsIPref.h" #include "nsIObserverService.h" -#include "nsObserverService.h" #include "nsIDOMElement.h" #include "nsIChromeEventHandler.h" #include "nsIContent.h" @@ -354,7 +353,7 @@ nsChromeRegistry::Init() NS_ASSERTION(NS_SUCCEEDED(rv), "unable to get RDF resource"); nsCOMPtr observerService = - do_GetService(NS_OBSERVERSERVICE_CONTRACTID, &rv); + do_GetService("@mozilla.org/observer-service;1", &rv); if (observerService) { observerService->AddObserver(this, "profile-before-change", PR_TRUE); observerService->AddObserver(this, "profile-do-change", PR_TRUE); diff --git a/mozilla/content/build/nsContentModule.cpp b/mozilla/content/build/nsContentModule.cpp index 84d1964bc53..c31235285b6 100644 --- a/mozilla/content/build/nsContentModule.cpp +++ b/mozilla/content/build/nsContentModule.cpp @@ -85,7 +85,6 @@ #include "nsINodeInfo.h" #include "nsIObserver.h" #include "nsIObserverService.h" -#include "nsObserverService.h" #include "nsIPresContext.h" #include "nsIPresShell.h" #include "nsIPrivateDOMImplementation.h" @@ -182,7 +181,7 @@ Initialize(nsIModule* aSelf) // Add our shutdown observer. nsCOMPtr observerService = - do_GetService(NS_OBSERVERSERVICE_CONTRACTID); + do_GetService("@mozilla.org/observer-service;1"); if (observerService) { ContentShutdownObserver* observer = diff --git a/mozilla/content/events/src/nsEventStateManager.cpp b/mozilla/content/events/src/nsEventStateManager.cpp index 1d9fddd5cb4..2c5a924649c 100644 --- a/mozilla/content/events/src/nsEventStateManager.cpp +++ b/mozilla/content/events/src/nsEventStateManager.cpp @@ -86,7 +86,6 @@ #include "nsXULAtoms.h" #include "nsIDOMXULDocument.h" #include "nsIObserverService.h" -#include "nsObserverService.h" #include "nsIDocShell.h" #include "nsIMarkupDocumentViewer.h" #include "nsITreeFrame.h" @@ -192,7 +191,7 @@ nsEventStateManager::Init() { nsresult rv; nsCOMPtr observerService = - do_GetService(NS_OBSERVERSERVICE_CONTRACTID, &rv); + do_GetService("@mozilla.org/observer-service;1", &rv); if (NS_SUCCEEDED(rv)) { observerService->AddObserver(this, NS_XPCOM_SHUTDOWN_OBSERVER_ID, PR_TRUE); @@ -254,7 +253,7 @@ nsEventStateManager::~nsEventStateManager() nsresult rv; nsCOMPtr observerService = - do_GetService(NS_OBSERVERSERVICE_CONTRACTID, &rv); + do_GetService("@mozilla.org/observer-service;1", &rv); if (NS_SUCCEEDED(rv)) { observerService->RemoveObserver(this, NS_XPCOM_SHUTDOWN_OBSERVER_ID); diff --git a/mozilla/content/html/content/src/nsFormSubmitter.cpp b/mozilla/content/html/content/src/nsFormSubmitter.cpp index 3da70cb4b65..aaaef8a3bb5 100644 --- a/mozilla/content/html/content/src/nsFormSubmitter.cpp +++ b/mozilla/content/html/content/src/nsFormSubmitter.cpp @@ -45,7 +45,6 @@ static NS_DEFINE_CID(kFormProcessorCID, NS_FORMPROCESSOR_CID); #include "nsNetUtil.h" static NS_DEFINE_CID(kIOServiceCID, NS_IOSERVICE_CID); #include "nsIObserverService.h" -#include "nsObserverService.h" #include "nsIFormSubmitObserver.h" #include "nsIDOMWindowInternal.h" #include "nsIUnicodeEncoder.h" @@ -349,7 +348,7 @@ nsFormSubmitter::OnSubmit(nsIForm* form, // Notify observers that the form is being submitted. rv = NS_OK; nsCOMPtr service = - do_GetService(NS_OBSERVERSERVICE_CONTRACTID, &rv); + do_GetService("@mozilla.org/observer-service;1", &rv); if (NS_FAILED(rv)) return rv; nsAutoString theTopic = NS_ConvertASCIItoUCS2(NS_FORMSUBMIT_SUBJECT); diff --git a/mozilla/content/xbl/src/nsXBLService.cpp b/mozilla/content/xbl/src/nsXBLService.cpp index f990eab237f..88ddf48342e 100644 --- a/mozilla/content/xbl/src/nsXBLService.cpp +++ b/mozilla/content/xbl/src/nsXBLService.cpp @@ -70,7 +70,6 @@ #include "nsITextContent.h" #include "nsIMemory.h" #include "nsIObserverService.h" -#include "nsObserverService.h" #include "nsIDOMNodeList.h" #include "nsIXBLBinding.h" @@ -1501,7 +1500,7 @@ NS_NewXBLService(nsIXBLService** aResult) // Register the first (and only) nsXBLService as a memory pressure observer // so it can flush the LRU list in low-memory situations. - nsCOMPtr os = do_GetService(NS_OBSERVERSERVICE_CONTRACTID); + nsCOMPtr os = do_GetService("@mozilla.org/observer-service;1"); if (os) os->AddObserver(result, NS_MEMORY_PRESSURE_TOPIC, PR_TRUE); diff --git a/mozilla/dom/src/base/nsJSEnvironment.cpp b/mozilla/dom/src/base/nsJSEnvironment.cpp index 68073f74d8b..4518e3026bc 100644 --- a/mozilla/dom/src/base/nsJSEnvironment.cpp +++ b/mozilla/dom/src/base/nsJSEnvironment.cpp @@ -70,7 +70,6 @@ #include "nsIInterfaceRequestorUtils.h" #include "nsIPrompt.h" #include "nsIObserverService.h" -#include "nsObserverService.h" #include "nsGUIEvent.h" #include "nsScriptNameSpaceManager.h" #include "nsIThread.h" @@ -1545,7 +1544,7 @@ nsJSEnvironment::nsJSEnvironment() // observer. nsresult rv; nsCOMPtr observerService = - do_GetService(NS_OBSERVERSERVICE_CONTRACTID, &rv); + do_GetService("@mozilla.org/observer-service;1", &rv); NS_ASSERTION(NS_SUCCEEDED(rv), "going to leak a nsJSEnvironment"); if (NS_SUCCEEDED(rv)) { diff --git a/mozilla/dom/src/build/nsDOMFactory.cpp b/mozilla/dom/src/build/nsDOMFactory.cpp index 9847d265a87..0e935765c47 100644 --- a/mozilla/dom/src/build/nsDOMFactory.cpp +++ b/mozilla/dom/src/build/nsDOMFactory.cpp @@ -45,7 +45,6 @@ #include "nsDOMClassInfo.h" #include "nsGlobalWindow.h" #include "nsIObserverService.h" -#include "nsObserverService.h" #include "nsIJSContextStack.h" @@ -90,7 +89,7 @@ nsDOMSOFactory::nsDOMSOFactory() NS_INIT_REFCNT(); nsCOMPtr observerService = - do_GetService(NS_OBSERVERSERVICE_CONTRACTID); + do_GetService("@mozilla.org/observer-service;1"); if (observerService) { observerService->AddObserver(this, NS_XPCOM_SHUTDOWN_OBSERVER_ID, PR_FALSE); diff --git a/mozilla/embedding/components/windowwatcher/src/nsWindowWatcher.cpp b/mozilla/embedding/components/windowwatcher/src/nsWindowWatcher.cpp index abe8bb1c24f..af452e3c5ac 100644 --- a/mozilla/embedding/components/windowwatcher/src/nsWindowWatcher.cpp +++ b/mozilla/embedding/components/windowwatcher/src/nsWindowWatcher.cpp @@ -64,7 +64,6 @@ #include "nsIGenericFactory.h" #include "nsIJSContextStack.h" #include "nsIObserverService.h" -#include "nsObserverService.h" #include "nsIScriptGlobalObject.h" #include "nsIScriptSecurityManager.h" #include "nsISupportsArray.h" @@ -730,7 +729,7 @@ nsWindowWatcher::RegisterNotification(nsIObserver *aObserver) if (!aObserver) return NS_ERROR_INVALID_ARG; - nsCOMPtr os(do_GetService(NS_OBSERVERSERVICE_CONTRACTID, &rv)); + nsCOMPtr os(do_GetService("@mozilla.org/observer-service;1", &rv)); if (os) { rv = os->AddObserver(aObserver, "domwindowopened", PR_FALSE); if (NS_SUCCEEDED(rv)) @@ -748,7 +747,7 @@ nsWindowWatcher::UnregisterNotification(nsIObserver *aObserver) if (!aObserver) return NS_ERROR_INVALID_ARG; - nsCOMPtr os(do_GetService(NS_OBSERVERSERVICE_CONTRACTID, &rv)); + nsCOMPtr os(do_GetService("@mozilla.org/observer-service;1", &rv)); if (os) { os->RemoveObserver(aObserver, "domwindowopened"); os->RemoveObserver(aObserver, "domwindowclosed"); @@ -838,7 +837,7 @@ nsWindowWatcher::AddWindow(nsIDOMWindow *aWindow, nsIWebBrowserChrome *aChrome) // a window being added to us signifies a newly opened window. // send notifications. - nsCOMPtr os(do_GetService(NS_OBSERVERSERVICE_CONTRACTID, &rv)); + nsCOMPtr os(do_GetService("@mozilla.org/observer-service;1", &rv)); if (os) { nsCOMPtr domwin(do_QueryInterface(aWindow)); rv = os->NotifyObservers(domwin, "domwindowopened", 0); @@ -927,7 +926,7 @@ nsresult nsWindowWatcher::RemoveWindow(nsWatcherWindowEntry *inInfo) // a window being removed from us signifies a newly closed window. // send notifications. - nsCOMPtr os(do_GetService(NS_OBSERVERSERVICE_CONTRACTID, &rv)); + nsCOMPtr os(do_GetService("@mozilla.org/observer-service;1", &rv)); if (os) { #ifdef USEWEAKREFS nsCOMPtr domwin(do_QueryReferent(inInfo->mWindow)); diff --git a/mozilla/embedding/qa/testembed/TestEmbed.cpp b/mozilla/embedding/qa/testembed/TestEmbed.cpp index 4d5f30d0144..75111bc949c 100644 --- a/mozilla/embedding/qa/testembed/TestEmbed.cpp +++ b/mozilla/embedding/qa/testembed/TestEmbed.cpp @@ -64,7 +64,6 @@ #include "BrowserImpl.h" #include "BrowserView.h" #include "nsIWindowWatcher.h" -#include "nsObserverService.h" #include "plstr.h" #include "Preferences.h" #include @@ -489,9 +488,9 @@ BOOL CTestEmbedApp::InitializeProfiles() nsresult rv; - //NS_WITH_SERVICE(nsIObserverService, observerService, NS_OBSERVERSERVICE_CONTRACTID, &rv); + //NS_WITH_SERVICE(nsIObserverService, observerService, "@mozilla.org/observer-service;1", &rv); - nsCOMPtrobserverService(do_GetService(NS_OBSERVERSERVICE_CONTRACTID,&rv)); + nsCOMPtrobserverService(do_GetService("@mozilla.org/observer-service;1",&rv)); if (NS_SUCCEEDED(rv)) { observerService->AddObserver(this, "profile-approve-change", PR_FALSE); diff --git a/mozilla/embedding/tests/mfcembed/MfcEmbed.cpp b/mozilla/embedding/tests/mfcembed/MfcEmbed.cpp index 0bf4529667f..c419a6d181f 100644 --- a/mozilla/embedding/tests/mfcembed/MfcEmbed.cpp +++ b/mozilla/embedding/tests/mfcembed/MfcEmbed.cpp @@ -63,7 +63,6 @@ #include "ProfileMgr.h" #include "BrowserImpl.h" #include "nsIWindowWatcher.h" -#include "nsObserverService.h" #include "plstr.h" #include "Preferences.h" #include @@ -482,7 +481,7 @@ BOOL CMfcEmbedApp::InitializeProfiles() nsresult rv; nsCOMPtr observerService = - do_GetService(NS_OBSERVERSERVICE_CONTRACTID, &rv); + do_GetService("@mozilla.org/observer-service;1", &rv); observerService->AddObserver(this, "profile-approve-change", PR_FALSE); observerService->AddObserver(this, "profile-change-teardown", PR_FALSE); observerService->AddObserver(this, "profile-after-change", PR_FALSE); diff --git a/mozilla/embedding/tests/winEmbed/winEmbed.cpp b/mozilla/embedding/tests/winEmbed/winEmbed.cpp index 6f9238891bd..d4d327b68f8 100644 --- a/mozilla/embedding/tests/winEmbed/winEmbed.cpp +++ b/mozilla/embedding/tests/winEmbed/winEmbed.cpp @@ -57,7 +57,6 @@ #include "nsIWindowWatcher.h" #include "nsIProfile.h" #include "nsIObserverService.h" -#include "nsObserverService.h" #include "nsIObserver.h" #include "nsIProfileChangeStatus.h" #include "nsIURI.h" @@ -169,7 +168,7 @@ int main(int argc, char *argv[]) } // Now register an observer to watch for profile changes - nsCOMPtr observerService(do_GetService(NS_OBSERVERSERVICE_CONTRACTID)); + nsCOMPtr observerService(do_GetService("@mozilla.org/observer-service;1")); ProfileChangeObserver *observer = new ProfileChangeObserver; observer->AddRef(); @@ -1342,7 +1341,7 @@ nsresult AppCallbacks::CreateBrowserWindow(PRUint32 aChromeFlags, ResizeEmbedding(NS_STATIC_CAST(nsIWebBrowserChrome*, chrome)); // Subscribe new window to profile changes so it can kill itself when one happens - nsCOMPtr observerService(do_GetService(NS_OBSERVERSERVICE_CONTRACTID)); + nsCOMPtr observerService(do_GetService("@mozilla.org/observer-service;1")); if (observerService) observerService->AddObserver(NS_STATIC_CAST(nsIObserver *, chrome), "profile-change-teardown", PR_FALSE); diff --git a/mozilla/extensions/access-builtin/accessproxy/nsAccessProxy.cpp b/mozilla/extensions/access-builtin/accessproxy/nsAccessProxy.cpp index 647f3d456ed..e743019353f 100644 --- a/mozilla/extensions/access-builtin/accessproxy/nsAccessProxy.cpp +++ b/mozilla/extensions/access-builtin/accessproxy/nsAccessProxy.cpp @@ -31,7 +31,6 @@ #include "nsMemory.h" #include "nsIServiceManager.h" #include "nsIObserverService.h" -#include "nsObserverService.h" #include "nsIGenericFactory.h" #include "nsIWebProgress.h" #include "nsIDocumentLoader.h" @@ -185,7 +184,7 @@ NS_IMETHODIMP nsAccessProxy::Observe(nsISupports *aSubject, const char *aTopic, } // install xpcom shutdown observer if (NS_SUCCEEDED(rv)) { - nsCOMPtr observerService(do_GetService(NS_OBSERVERSERVICE_CONTRACTID, &rv)); + nsCOMPtr observerService(do_GetService("@mozilla.org/observer-service;1", &rv)); if (NS_SUCCEEDED(rv)) rv = observerService->AddObserver(this, NS_XPCOM_SHUTDOWN_OBSERVER_ID, PR_TRUE); } diff --git a/mozilla/extensions/cookie/nsCookieService.cpp b/mozilla/extensions/cookie/nsCookieService.cpp index 8cbfce4dc99..1177ed2f148 100644 --- a/mozilla/extensions/cookie/nsCookieService.cpp +++ b/mozilla/extensions/cookie/nsCookieService.cpp @@ -47,7 +47,6 @@ #include "nsIDOMWindowInternal.h" #include "nsIPrompt.h" #include "nsIObserverService.h" -#include "nsObserverService.h" #include "nsIDocumentLoader.h" #include "nsIWebProgress.h" #include "nsCURILoader.h" @@ -84,7 +83,7 @@ nsresult nsCookieService::Init() COOKIE_Read(); nsCOMPtr observerService = - do_GetService(NS_OBSERVERSERVICE_CONTRACTID, &rv); + do_GetService("@mozilla.org/observer-service;1", &rv); if (observerService) { observerService->AddObserver(this, "profile-before-change", PR_TRUE); observerService->AddObserver(this, "profile-do-change", PR_TRUE); diff --git a/mozilla/extensions/cookie/nsPermissionManager.cpp b/mozilla/extensions/cookie/nsPermissionManager.cpp index c0e08009df0..f18a85c4e96 100644 --- a/mozilla/extensions/cookie/nsPermissionManager.cpp +++ b/mozilla/extensions/cookie/nsPermissionManager.cpp @@ -46,7 +46,6 @@ #include "nsIDOMWindowInternal.h" #include "nsIPrompt.h" #include "nsIObserverService.h" -#include "nsObserverService.h" #include "nsPermission.h" #include "nsNetCID.h" @@ -125,7 +124,7 @@ nsresult nsPermissionManager::Init() nsresult rv; nsCOMPtr observerService = - do_GetService(NS_OBSERVERSERVICE_CONTRACTID, &rv); + do_GetService("@mozilla.org/observer-service;1", &rv); if (observerService) { observerService->AddObserver(this, "profile-before-change", PR_FALSE); observerService->AddObserver(this, "profile-do-change", PR_FALSE); diff --git a/mozilla/extensions/p3p/src/nsP3PObserverFormSubmit.cpp b/mozilla/extensions/p3p/src/nsP3PObserverFormSubmit.cpp index 0363a2e8051..fd8823a0687 100644 --- a/mozilla/extensions/p3p/src/nsP3PObserverFormSubmit.cpp +++ b/mozilla/extensions/p3p/src/nsP3PObserverFormSubmit.cpp @@ -27,7 +27,6 @@ #include "nsP3PObserverFormSubmit.h" #include "nsIServiceManager.h" -#include "nsObserverService.h" #include "nsIPresShell.h" #include "nsString.h" @@ -114,7 +113,7 @@ nsP3PObserverFormSubmit::Init( ) { ("P3PObserverFormSubmit: Init, initializing.\n") ); // Get the Observer service - mObserverService = do_GetService( NS_OBSERVERSERVICE_CONTRACTID, + mObserverService = do_GetService( "@mozilla.org/observer-service;1", &rv ); if (NS_SUCCEEDED( rv )) { diff --git a/mozilla/extensions/p3p/src/nsP3PObserverHTML.cpp b/mozilla/extensions/p3p/src/nsP3PObserverHTML.cpp index 6692c1c4e19..e8603aa5714 100644 --- a/mozilla/extensions/p3p/src/nsP3PObserverHTML.cpp +++ b/mozilla/extensions/p3p/src/nsP3PObserverHTML.cpp @@ -28,7 +28,6 @@ #include "nsP3PLogging.h" #include "nsIServiceManager.h" -#include "nsObserverService.h" #include "nsIParser.h" #include "nsIDocShell.h" @@ -122,7 +121,7 @@ nsP3PObserverHTML::Init( ) { ("P3PObserverHTML: Init, initializing.\n") ); // Get the Observer service - mObserverService = do_GetService( NS_OBSERVERSERVICE_CONTRACTID, + mObserverService = do_GetService( "@mozilla.org/observer-service;1", &rv ); if (NS_SUCCEEDED( rv )) { diff --git a/mozilla/extensions/p3p/src/nsP3PObserverLayout.cpp b/mozilla/extensions/p3p/src/nsP3PObserverLayout.cpp index 405a39a1113..b58a148d826 100644 --- a/mozilla/extensions/p3p/src/nsP3PObserverLayout.cpp +++ b/mozilla/extensions/p3p/src/nsP3PObserverLayout.cpp @@ -28,7 +28,6 @@ #include "nsCOMPtr.h" #include "nsIServiceManager.h" -#include "nsObserverService.h" #include "nsIPresShell.h" #include "nsIDocShellTreeItem.h" @@ -125,7 +124,7 @@ nsP3PObserverLayout::Init( ) { ("P3PObserverLayout: Init, initializing.\n") ); // Get the Observer service - mObserverService = do_GetService( NS_OBSERVERSERVICE_CONTRACTID, + mObserverService = do_GetService( "@mozilla.org/observer-service;1", &rv ); if (NS_SUCCEEDED( rv )) { diff --git a/mozilla/extensions/p3p/src/nsP3PObserverXML.cpp b/mozilla/extensions/p3p/src/nsP3PObserverXML.cpp index 12ce6df7694..bdd005a42ee 100644 --- a/mozilla/extensions/p3p/src/nsP3PObserverXML.cpp +++ b/mozilla/extensions/p3p/src/nsP3PObserverXML.cpp @@ -28,7 +28,6 @@ #include "nsP3PLogging.h" #include "nsIServiceManager.h" -#include "nsObserverService.h" #include "nsIParser.h" #include "nsIDocShell.h" @@ -127,7 +126,7 @@ nsP3PObserverXML::Init( ) { ("P3PObserverXML: Init, initializing.\n") ); // Get the observer service - mObserverService = do_GetService( NS_OBSERVERSERVICE_CONTRACTID, + mObserverService = do_GetService( "@mozilla.org/observer-service;1", &rv ); if (NS_SUCCEEDED( rv )) { diff --git a/mozilla/extensions/pics/src/nsPICS.cpp b/mozilla/extensions/pics/src/nsPICS.cpp index ddee4a36403..e5c3e49e558 100644 --- a/mozilla/extensions/pics/src/nsPICS.cpp +++ b/mozilla/extensions/pics/src/nsPICS.cpp @@ -53,7 +53,6 @@ #include "nsParserCIID.h" #include "nsIHTMLContentSink.h" #include "nsIObserverService.h" -#include "nsObserverService.h" #include "nsPICSElementObserver.h" #include "nsFileSpec.h" #include "nsIDocumentViewer.h" @@ -477,13 +476,13 @@ nsPICS::Init() if (NS_FAILED(rv = NS_NewPICSElementObserver(&mPICSElementObserver))) return rv; - rv = nsServiceManager::GetService(NS_OBSERVERSERVICE_CONTRACTID, + rv = nsServiceManager::GetService("@mozilla.org/observer-service;1", NS_GET_IID(nsIObserverService), (nsISupports **)&anObserverService); if(rv == NS_OK) { rv = anObserverService->AddObserver(mPICSElementObserver, "htmlparser", PR_FALSE); - nsServiceManager::ReleaseService( NS_OBSERVERSERVICE_CONTRACTID, anObserverService ); + nsServiceManager::ReleaseService( "@mozilla.org/observer-service;1", anObserverService ); if (NS_FAILED(rv)) return rv; diff --git a/mozilla/extensions/pics/tests/TestPICS.cpp b/mozilla/extensions/pics/tests/TestPICS.cpp index 6b3120406a0..53f3fef631b 100644 --- a/mozilla/extensions/pics/tests/TestPICS.cpp +++ b/mozilla/extensions/pics/tests/TestPICS.cpp @@ -10,7 +10,6 @@ #include "nsIIOService.h" #include "nsIObserverService.h" -#include "nsObserverService.h" #include "nsString.h" #include "prmem.h" #include "plstr.h" @@ -90,7 +89,7 @@ PRInt32 main(PRInt32 argc, char *argv[]) nsComponentManager::RegisterComponent(kCParserCID, NULL, NULL, RAPTORHTMLPARS_DLL, PR_FALSE, PR_FALSE); - res = nsServiceManager::GetService(NS_OBSERVERSERVICE_CONTRACTID, + res = nsServiceManager::GetService("@mozilla.org/observer-service;1", NS_GET_IID(nsIObserverService), (nsISupports **)&anObserverService); diff --git a/mozilla/extensions/transformiix/source/xslt/XSLTProcessor.cpp b/mozilla/extensions/transformiix/source/xslt/XSLTProcessor.cpp index 20fa078a875..d07178e0dc6 100644 --- a/mozilla/extensions/transformiix/source/xslt/XSLTProcessor.cpp +++ b/mozilla/extensions/transformiix/source/xslt/XSLTProcessor.cpp @@ -54,7 +54,6 @@ #include "txAtom.h" #ifndef TX_EXE #include "nsIObserverService.h" -#include "nsObserverService.h" #include "nsIURL.h" #include "nsIServiceManager.h" #include "nsIIOService.h" @@ -2154,7 +2153,7 @@ XSLTProcessor::TransformDocument(nsIDOMNode* aSourceDOM, if (aObserver) { nsresult res = NS_OK; - nsCOMPtr anObserverService = do_GetService(NS_OBSERVERSERVICE_CONTRACTID, &res); + nsCOMPtr anObserverService = do_GetService("@mozilla.org/observer-service;1", &res); if (NS_SUCCEEDED(res)) { Node* docElement = resultDocument->getDocumentElement(); nsISupports* nsDocElement; diff --git a/mozilla/extensions/wallet/src/nsWalletService.cpp b/mozilla/extensions/wallet/src/nsWalletService.cpp index a690506c3fe..1efe8e9669c 100644 --- a/mozilla/extensions/wallet/src/nsWalletService.cpp +++ b/mozilla/extensions/wallet/src/nsWalletService.cpp @@ -44,7 +44,6 @@ #include "singsign.h" #include "nsPassword.h" #include "nsIObserverService.h" -#include "nsObserverService.h" #include "nsIDOMHTMLDocument.h" #include "nsIDOMHTMLCollection.h" #include "nsIDOMHTMLFormElement.h" @@ -296,7 +295,7 @@ nsresult nsWalletlibService::Init() nsresult rv; nsCOMPtr svc = - do_GetService(NS_OBSERVERSERVICE_CONTRACTID, &rv); + do_GetService("@mozilla.org/observer-service;1", &rv); if (NS_SUCCEEDED(rv) && svc) { // Register as an observer of form submission svc->AddObserver(this, NS_FORMSUBMIT_SUBJECT, PR_TRUE); @@ -587,7 +586,7 @@ nsSingleSignOnPrompt::Init() nsSingleSignOnProfileObserver *observer = new nsSingleSignOnProfileObserver; if (!observer) return NS_ERROR_OUT_OF_MEMORY; - nsCOMPtr svc(do_GetService(NS_OBSERVERSERVICE_CONTRACTID)); + nsCOMPtr svc(do_GetService("@mozilla.org/observer-service;1")); if (!svc) return NS_ERROR_FAILURE; // The observer service holds the only ref to the observer // It thus has the lifespan of the observer service diff --git a/mozilla/gfx/src/windows/nsFontMetricsWin.cpp b/mozilla/gfx/src/windows/nsFontMetricsWin.cpp index df1e97becce..63a0e7db532 100644 --- a/mozilla/gfx/src/windows/nsFontMetricsWin.cpp +++ b/mozilla/gfx/src/windows/nsFontMetricsWin.cpp @@ -47,7 +47,6 @@ #include "nsISaveAsCharset.h" #include "nsIObserver.h" #include "nsIObserverService.h" -#include "nsObserverService.h" #include "nsFontMetricsWin.h" #include "nsQuickSort.h" #include "nsTextFormatter.h" @@ -330,7 +329,7 @@ InitGlobals(void) if (gFontCleanupObserver) { // register for shutdown nsresult rv; - nsCOMPtr observerService(do_GetService(NS_OBSERVERSERVICE_CONTRACTID, &rv)); + nsCOMPtr observerService(do_GetService("@mozilla.org/observer-service;1", &rv)); if (NS_SUCCEEDED(rv)) { rv = observerService->AddObserver(gFontCleanupObserver, NS_XPCOM_SHUTDOWN_OBSERVER_ID, PR_FALSE); } diff --git a/mozilla/intl/chardet/src/nsXMLEncodingObserver.cpp b/mozilla/intl/chardet/src/nsXMLEncodingObserver.cpp index c9b587d5a29..08f62d6121b 100644 --- a/mozilla/intl/chardet/src/nsXMLEncodingObserver.cpp +++ b/mozilla/intl/chardet/src/nsXMLEncodingObserver.cpp @@ -42,8 +42,6 @@ #include "nsIElementObserver.h" #include "nsIObserver.h" #include "nsIObserverService.h" -#include "nsObserverService.h" -#include "nsObserverService.h" #include "nsISupports.h" #include "nsCRT.h" #include "nsIParser.h" @@ -212,7 +210,7 @@ NS_IMETHODIMP nsXMLEncodingObserver::Start() if (bXMLEncodingObserverStarted == PR_TRUE) return res; - nsCOMPtr anObserverService = do_GetService(NS_OBSERVERSERVICE_CONTRACTID, &res); + nsCOMPtr anObserverService = do_GetService("@mozilla.org/observer-service;1", &res); if(NS_FAILED(res)) goto done; @@ -232,7 +230,7 @@ NS_IMETHODIMP nsXMLEncodingObserver::End() return res; nsCAutoString xmlTopic; xmlTopic.Assign("xmlparser"); - nsCOMPtr anObserverService = do_GetService(NS_OBSERVERSERVICE_CONTRACTID, &res); + nsCOMPtr anObserverService = do_GetService("@mozilla.org/observer-service;1", &res); if(NS_FAILED(res)) goto done; diff --git a/mozilla/intl/strres/src/nsStringBundle.cpp b/mozilla/intl/strres/src/nsStringBundle.cpp index a37e78c6cc4..29c8ea89dc7 100644 --- a/mozilla/intl/strres/src/nsStringBundle.cpp +++ b/mozilla/intl/strres/src/nsStringBundle.cpp @@ -54,7 +54,6 @@ #include "nsIMemory.h" #include "nsIObserver.h" #include "nsIObserverService.h" -#include "nsObserverService.h" #include "nsWeakReference.h" #include "nsCOMPtr.h" #include "pratom.h" @@ -281,7 +280,7 @@ nsStringBundle::OnStreamComplete(nsIStreamLoader* aLoader, mLoaded = PR_TRUE; // observer notification - nsCOMPtr os = do_GetService(NS_OBSERVERSERVICE_CONTRACTID); + nsCOMPtr os = do_GetService("@mozilla.org/observer-service;1"); if (os) (void) os->NotifyObservers((nsIStringBundle *) this, NS_STRBUNDLE_LOADED_TOPIC, @@ -796,7 +795,7 @@ nsStringBundleService::~nsStringBundleService() nsresult nsStringBundleService::Init() { - nsCOMPtr os = do_GetService(NS_OBSERVERSERVICE_CONTRACTID); + nsCOMPtr os = do_GetService("@mozilla.org/observer-service;1"); if (os) os->AddObserver(this, NS_MEMORY_PRESSURE_TOPIC, PR_TRUE); diff --git a/mozilla/intl/unicharutil/util/nsUnicharUtils.cpp b/mozilla/intl/unicharutil/util/nsUnicharUtils.cpp index 0baaa488adb..04d82394085 100644 --- a/mozilla/intl/unicharutil/util/nsUnicharUtils.cpp +++ b/mozilla/intl/unicharutil/util/nsUnicharUtils.cpp @@ -28,7 +28,6 @@ #include "nsIObserver.h" #include "nsIObserverService.h" -#include "nsObserverService.h" // global cache of the case conversion service static nsICaseConversion *gCaseConv = nsnull; @@ -66,7 +65,7 @@ static nsresult NS_InitCaseConversion() { if (NS_SUCCEEDED(rv)) { nsCOMPtr obs = - do_GetService(NS_OBSERVERSERVICE_CONTRACTID, &rv); + do_GetService("@mozilla.org/observer-service;1", &rv); if (NS_SUCCEEDED(rv)) { nsShutdownObserver *observer = new nsShutdownObserver(); if (observer) diff --git a/mozilla/js/src/xpconnect/loader/mozJSComponentLoader.cpp b/mozilla/js/src/xpconnect/loader/mozJSComponentLoader.cpp index 0f803a3dd5b..11a26a0ccf7 100644 --- a/mozilla/js/src/xpconnect/loader/mozJSComponentLoader.cpp +++ b/mozilla/js/src/xpconnect/loader/mozJSComponentLoader.cpp @@ -45,7 +45,6 @@ #include "nsIRegistry.h" #include "nsXPIDLString.h" #include "nsIObserverService.h" -#include "nsObserverService.h" #include "nsIXPCScriptable.h" #ifndef XPCONNECT_STANDALONE #include "nsIScriptSecurityManager.h" @@ -77,7 +76,7 @@ const char kXPConnectServiceContractID[] = "@mozilla.org/js/xpc/XPConnect;1"; const char kJSContextStackContractID[] = "@mozilla.org/js/xpc/ContextStack;1"; const char kConsoleServiceContractID[] = "@mozilla.org/consoleservice;1"; const char kScriptErrorContractID[] = "@mozilla.org/scripterror;1"; -const char kObserverServiceContractID[] = NS_OBSERVERSERVICE_CONTRACTID; +const char kObserverServiceContractID[] = "@mozilla.org/observer-service;1"; #ifndef XPCONNECT_STANDALONE const char kScriptSecurityManagerContractID[] = NS_SCRIPTSECURITYMANAGER_CONTRACTID; const char kStandardURLContractID[] = "@mozilla.org/network/standard-url;1"; diff --git a/mozilla/layout/base/nsPresShell.cpp b/mozilla/layout/base/nsPresShell.cpp index c07aef8f8ee..ea5dd762afd 100644 --- a/mozilla/layout/base/nsPresShell.cpp +++ b/mozilla/layout/base/nsPresShell.cpp @@ -103,7 +103,6 @@ #include "plarena.h" #include "nsCSSAtoms.h" #include "nsIObserverService.h" // for reflow observation -#include "nsObserverService.h" #include "nsIDocShell.h" // for reflow observation #include "nsIDOMRange.h" #ifdef MOZ_PERF_METRICS @@ -1603,7 +1602,7 @@ PresShell::Init(nsIDocument* aDocument, } // cache the observation service - mObserverService = do_GetService(NS_OBSERVERSERVICE_CONTRACTID, + mObserverService = do_GetService("@mozilla.org/observer-service;1", &result); if (NS_FAILED(result)) { return result; diff --git a/mozilla/layout/html/base/src/nsPresShell.cpp b/mozilla/layout/html/base/src/nsPresShell.cpp index c07aef8f8ee..ea5dd762afd 100644 --- a/mozilla/layout/html/base/src/nsPresShell.cpp +++ b/mozilla/layout/html/base/src/nsPresShell.cpp @@ -103,7 +103,6 @@ #include "plarena.h" #include "nsCSSAtoms.h" #include "nsIObserverService.h" // for reflow observation -#include "nsObserverService.h" #include "nsIDocShell.h" // for reflow observation #include "nsIDOMRange.h" #ifdef MOZ_PERF_METRICS @@ -1603,7 +1602,7 @@ PresShell::Init(nsIDocument* aDocument, } // cache the observation service - mObserverService = do_GetService(NS_OBSERVERSERVICE_CONTRACTID, + mObserverService = do_GetService("@mozilla.org/observer-service;1", &result); if (NS_FAILED(result)) { return result; diff --git a/mozilla/layout/html/forms/src/nsFormFrame.cpp b/mozilla/layout/html/forms/src/nsFormFrame.cpp index 7deeaec0e0c..c5b02166054 100644 --- a/mozilla/layout/html/forms/src/nsFormFrame.cpp +++ b/mozilla/layout/html/forms/src/nsFormFrame.cpp @@ -99,7 +99,6 @@ static NS_DEFINE_CID(kIOServiceCID, NS_IOSERVICE_CID); // FormSubmit observer notification #include "nsIFormSubmitObserver.h" #include "nsIObserverService.h" -#include "nsObserverService.h" #include "nsIServiceManager.h" #include "nsICategoryManager.h" @@ -888,7 +887,7 @@ nsFormFrame::OnSubmit(nsIPresContext* aPresContext, nsIFrame* aFrame) // Notify observers that the form is being submitted. result = NS_OK; nsCOMPtr service = - do_GetService(NS_OBSERVERSERVICE_CONTRACTID, &result); + do_GetService("@mozilla.org/observer-service;1", &result); if (NS_FAILED(result)) return result; nsCOMPtr theEnum; diff --git a/mozilla/layout/mathml/base/src/nsMathMLChar.cpp b/mozilla/layout/mathml/base/src/nsMathMLChar.cpp index fc9252adc15..875bc892b55 100644 --- a/mozilla/layout/mathml/base/src/nsMathMLChar.cpp +++ b/mozilla/layout/mathml/base/src/nsMathMLChar.cpp @@ -41,7 +41,6 @@ #include "nsIPersistentProperties2.h" #include "nsIServiceManager.h" #include "nsIObserverService.h" -#include "nsObserverService.h" #include "nsIObserver.h" #include "nsNetUtil.h" #include "nsIURI.h" @@ -723,7 +722,7 @@ nsGlyphTableList::Initialize() { nsresult rv = NS_OK; nsCOMPtr obs = - do_GetService(NS_OBSERVERSERVICE_CONTRACTID, &rv); + do_GetService("@mozilla.org/observer-service;1", &rv); if (NS_SUCCEEDED(rv)) { rv = obs->AddObserver(this, NS_XPCOM_SHUTDOWN_OBSERVER_ID, PR_FALSE); } @@ -737,7 +736,7 @@ nsGlyphTableList::Finalize() // Remove our observer from the observer service nsresult rv = NS_OK; nsCOMPtr obs = - do_GetService(NS_OBSERVERSERVICE_CONTRACTID, &rv); + do_GetService("@mozilla.org/observer-service;1", &rv); if (NS_SUCCEEDED(rv)) { rv = obs->RemoveObserver(this, NS_XPCOM_SHUTDOWN_OBSERVER_ID); } diff --git a/mozilla/mailnews/base/src/nsMessengerMigrator.cpp b/mozilla/mailnews/base/src/nsMessengerMigrator.cpp index 243666c7228..c0bae0d073b 100644 --- a/mozilla/mailnews/base/src/nsMessengerMigrator.cpp +++ b/mozilla/mailnews/base/src/nsMessengerMigrator.cpp @@ -67,7 +67,6 @@ #include "nsMsgUtils.h" #include "nsISmtpService.h" #include "nsIObserverService.h" -#include "nsObserverService.h" #include "nsIMsgAccount.h" #include "nsIMsgAccountManager.h" @@ -364,7 +363,7 @@ nsMessengerMigrator::~nsMessengerMigrator() //Don't remove from Observer service in Shutdown because Shutdown also gets called //from xpcom shutdown observer. And we don't want to remove from the service in that case. nsCOMPtr observerService = - do_GetService(NS_OBSERVERSERVICE_CONTRACTID, &rv); + do_GetService("@mozilla.org/observer-service;1", &rv); if (NS_SUCCEEDED(rv)) { observerService->RemoveObserver(this, NS_XPCOM_SHUTDOWN_OBSERVER_ID); @@ -377,7 +376,7 @@ nsresult nsMessengerMigrator::Init() nsresult rv; nsCOMPtr observerService = - do_GetService(NS_OBSERVERSERVICE_CONTRACTID, &rv); + do_GetService("@mozilla.org/observer-service;1", &rv); if (NS_SUCCEEDED(rv)) { observerService->AddObserver(this, NS_XPCOM_SHUTDOWN_OBSERVER_ID, PR_FALSE); diff --git a/mozilla/mailnews/base/src/nsMsgAccountManager.cpp b/mozilla/mailnews/base/src/nsMsgAccountManager.cpp index d6a3adeba75..5e312a873ee 100644 --- a/mozilla/mailnews/base/src/nsMsgAccountManager.cpp +++ b/mozilla/mailnews/base/src/nsMsgAccountManager.cpp @@ -67,7 +67,6 @@ #include "nsISmtpService.h" #include "nsIMsgBiffManager.h" #include "nsIObserverService.h" -#include "nsObserverService.h" #include "nsIMsgMailSession.h" #include "nsIEventQueueService.h" #include "nsIDirectoryService.h" @@ -161,7 +160,7 @@ nsMsgAccountManager::~nsMsgAccountManager() //Don't remove from Observer service in Shutdown because Shutdown also gets called //from xpcom shutdown observer. And we don't want to remove from the service in that case. nsCOMPtr observerService = - do_GetService(NS_OBSERVERSERVICE_CONTRACTID, &rv); + do_GetService("@mozilla.org/observer-service;1", &rv); if (NS_SUCCEEDED(rv)) { observerService->RemoveObserver(this, NS_XPCOM_SHUTDOWN_OBSERVER_ID); @@ -183,7 +182,7 @@ nsresult nsMsgAccountManager::Init() rv = NS_NewISupportsArray(getter_AddRefs(mFolderListeners)); nsCOMPtr observerService = - do_GetService(NS_OBSERVERSERVICE_CONTRACTID, &rv); + do_GetService("@mozilla.org/observer-service;1", &rv); if (NS_SUCCEEDED(rv)) { observerService->AddObserver(this, NS_XPCOM_SHUTDOWN_OBSERVER_ID, PR_TRUE); diff --git a/mozilla/mailnews/base/src/nsMsgBiffManager.cpp b/mozilla/mailnews/base/src/nsMsgBiffManager.cpp index fcdfc92e21c..22717060f25 100644 --- a/mozilla/mailnews/base/src/nsMsgBiffManager.cpp +++ b/mozilla/mailnews/base/src/nsMsgBiffManager.cpp @@ -41,7 +41,6 @@ #include "nsIMsgAccountManager.h" #include "nsMsgBaseCID.h" #include "nsIObserverService.h" -#include "nsObserverService.h" #include "nsStatusBarBiffManager.h" static NS_DEFINE_CID(kStatusBarBiffManagerCID, NS_STATUSBARBIFFMANAGER_CID); @@ -85,7 +84,7 @@ nsMsgBiffManager::~nsMsgBiffManager() //Don't remove from Observer service in Shutdown because Shutdown also gets called //from xpcom shutdown observer. And we don't want to remove from the service in that case. nsCOMPtr observerService = - do_GetService(NS_OBSERVERSERVICE_CONTRACTID, &rv); + do_GetService("@mozilla.org/observer-service;1", &rv); if (NS_SUCCEEDED(rv)) { observerService->RemoveObserver(this, NS_XPCOM_SHUTDOWN_OBSERVER_ID); @@ -109,7 +108,7 @@ nsresult nsMsgBiffManager::Init() } nsCOMPtr observerService = - do_GetService(NS_OBSERVERSERVICE_CONTRACTID, &rv); + do_GetService("@mozilla.org/observer-service;1", &rv); if (NS_SUCCEEDED(rv)) { observerService->AddObserver(this, NS_XPCOM_SHUTDOWN_OBSERVER_ID, PR_TRUE); diff --git a/mozilla/mailnews/base/src/nsMsgRDFDataSource.cpp b/mozilla/mailnews/base/src/nsMsgRDFDataSource.cpp index 7d2b166acdc..2aa29da58e2 100644 --- a/mozilla/mailnews/base/src/nsMsgRDFDataSource.cpp +++ b/mozilla/mailnews/base/src/nsMsgRDFDataSource.cpp @@ -43,7 +43,6 @@ #include "nsMsgRDFUtils.h" #include "nsEnumeratorUtils.h" #include "nsIObserverService.h" -#include "nsObserverService.h" static NS_DEFINE_CID(kRDFServiceCID, NS_RDFSERVICE_CID); @@ -78,7 +77,7 @@ nsMsgRDFDataSource::Init() return NS_ERROR_ALREADY_INITIALIZED; /* Add an observer to XPCOM shutdown */ - nsCOMPtr obs = do_GetService(NS_OBSERVERSERVICE_CONTRACTID, + nsCOMPtr obs = do_GetService("@mozilla.org/observer-service;1", &rv); if (NS_FAILED(rv)) return rv; rv = obs->AddObserver(NS_STATIC_CAST(nsIObserver*, this), NS_XPCOM_SHUTDOWN_OBSERVER_ID, PR_TRUE); @@ -98,7 +97,7 @@ void nsMsgRDFDataSource::Cleanup() mRDFService = nsnull; // release ourselves from the observer service - nsCOMPtr obs = do_GetService(NS_OBSERVERSERVICE_CONTRACTID, + nsCOMPtr obs = do_GetService("@mozilla.org/observer-service;1", &rv); if (NS_SUCCEEDED(rv)) { rv = obs->RemoveObserver(NS_STATIC_CAST(nsIObserver*, this), diff --git a/mozilla/mailnews/db/msgdb/src/nsDBFolderInfo.cpp b/mozilla/mailnews/db/msgdb/src/nsDBFolderInfo.cpp index 5dfe825662f..259dc855524 100644 --- a/mozilla/mailnews/db/msgdb/src/nsDBFolderInfo.cpp +++ b/mozilla/mailnews/db/msgdb/src/nsDBFolderInfo.cpp @@ -46,7 +46,6 @@ #include "nsIPrefLocalizedString.h" #include "nsIObserver.h" #include "nsIObserverService.h" -#include "nsObserverService.h" #include "nsIMsgDBView.h" #include "nsReadableUtils.h" @@ -230,7 +229,7 @@ nsDBFolderInfo::nsDBFolderInfo(nsMsgDatabase *mdb) } // also register for shutdown - nsCOMPtr observerService = do_GetService(NS_OBSERVERSERVICE_CONTRACTID, &rv); + nsCOMPtr observerService = do_GetService("@mozilla.org/observer-service;1", &rv); if (NS_SUCCEEDED(rv)) { rv = observerService->AddObserver(gFolderCharsetObserver, NS_XPCOM_SHUTDOWN_OBSERVER_ID, PR_FALSE); diff --git a/mozilla/modules/libjar/nsJAR.cpp b/mozilla/modules/libjar/nsJAR.cpp index aa180700a53..607afe276c7 100644 --- a/mozilla/modules/libjar/nsJAR.cpp +++ b/mozilla/modules/libjar/nsJAR.cpp @@ -31,7 +31,6 @@ #include "nsXPIDLString.h" #include "nsReadableUtils.h" #include "nsIServiceManager.h" -#include "nsObserverService.h" #include "plbase64.h" #include "nsIConsoleService.h" #include "nscore.h" @@ -1144,7 +1143,7 @@ nsZipReaderCache::Init(PRUint32 cacheSize) // Register as a memory pressure observer nsCOMPtr os = - do_GetService(NS_OBSERVERSERVICE_CONTRACTID, &rv); + do_GetService("@mozilla.org/observer-service;1", &rv); if (NS_SUCCEEDED(rv)) { rv = os->AddObserver(this, NS_MEMORY_PRESSURE_TOPIC, PR_TRUE); diff --git a/mozilla/modules/libpref/src/nsAutoConfig.cpp b/mozilla/modules/libpref/src/nsAutoConfig.cpp index cb2f0bb0597..56e051ae826 100644 --- a/mozilla/modules/libpref/src/nsAutoConfig.cpp +++ b/mozilla/modules/libpref/src/nsAutoConfig.cpp @@ -46,7 +46,6 @@ #include "prefapi.h" #include "nsIProfile.h" #include "nsIObserverService.h" -#include "nsObserverService.h" #include "nsIEventQueueService.h" #include "nsLiteralString.h" #include "nsReadableUtils.h" @@ -69,7 +68,7 @@ nsresult nsAutoConfig::Init() // Registering the object as an observer to the profile-after-change topic nsCOMPtr observerService = - do_GetService(NS_OBSERVERSERVICE_CONTRACTID, &rv); + do_GetService("@mozilla.org/observer-service;1", &rv); if (NS_FAILED(rv)) return rv; @@ -223,7 +222,7 @@ NS_IMETHODIMP nsAutoConfig::Observe(nsISupports *aSubject, // nsIObserverService to skip the next element. bug 94349 /* nsCOMPtr observerService = - do_GetService(NS_OBSERVERSERVICE_CONTRACTID, &rv); + do_GetService("@mozilla.org/observer-service;1", &rv); if (observerService) rv = observerService->RemoveObserver(this,NS_LITERAL_STRING("profile-after-change").get()); */ diff --git a/mozilla/modules/libpref/src/nsPrefService.cpp b/mozilla/modules/libpref/src/nsPrefService.cpp index 63fefdeeb8e..43e6de2308d 100644 --- a/mozilla/modules/libpref/src/nsPrefService.cpp +++ b/mozilla/modules/libpref/src/nsPrefService.cpp @@ -41,7 +41,6 @@ #include "nsAppDirectoryServiceDefs.h" #include "nsDirectoryServiceDefs.h" #include "nsIObserverService.h" -#include "nsObserverService.h" #include "nsPrefBranch.h" #include "nsXPIDLString.h" #include "nsIAutoConfig.h" @@ -136,7 +135,7 @@ nsresult nsPrefService::Init() return rv; nsCOMPtr observerService = - do_GetService(NS_OBSERVERSERVICE_CONTRACTID, &rv); + do_GetService("@mozilla.org/observer-service;1", &rv); if (observerService) { // Our refcnt must be > 0 when we call this, or we'll get deleted! ++mRefCnt; diff --git a/mozilla/modules/plugin/base/src/nsPluginHostImpl.cpp b/mozilla/modules/plugin/base/src/nsPluginHostImpl.cpp index c1e50651d15..ec51a5e5987 100644 --- a/mozilla/modules/plugin/base/src/nsPluginHostImpl.cpp +++ b/mozilla/modules/plugin/base/src/nsPluginHostImpl.cpp @@ -57,7 +57,6 @@ #include "nsIPluginStreamListener.h" #include "nsIHTTPHeaderListener.h" #include "nsIObserverService.h" -#include "nsObserverService.h" #include "nsIHttpProtocolHandler.h" #include "nsIHttpChannel.h" #include "nsIUploadChannel.h" @@ -2396,7 +2395,7 @@ nsPluginHostImpl::nsPluginHostImpl() mIsDestroyed = PR_FALSE; mUnusedLibraries = nsnull; - nsCOMPtr obsService = do_GetService(NS_OBSERVERSERVICE_CONTRACTID); + nsCOMPtr obsService = do_GetService("@mozilla.org/observer-service;1"); if (obsService) { obsService->AddObserver(this, "quit-application", PR_FALSE); @@ -2428,7 +2427,7 @@ nsPluginHostImpl::~nsPluginHostImpl() #ifdef NS_DEBUG printf("nsPluginHostImpl dtor\n"); #endif - nsCOMPtr obsService = do_GetService(NS_OBSERVERSERVICE_CONTRACTID); + nsCOMPtr obsService = do_GetService("@mozilla.org/observer-service;1"); if (obsService) { obsService->RemoveObserver(this, "quit-application"); diff --git a/mozilla/netwerk/base/src/nsIOService.cpp b/mozilla/netwerk/base/src/nsIOService.cpp index 7fbe4c1a17a..2002bb288c2 100644 --- a/mozilla/netwerk/base/src/nsIOService.cpp +++ b/mozilla/netwerk/base/src/nsIOService.cpp @@ -51,7 +51,6 @@ #include "nsIErrorService.h" #include "netCore.h" #include "nsIObserverService.h" -#include "nsObserverService.h" #include "nsIHttpProtocolHandler.h" #include "nsIPrefService.h" #include "nsIPrefBranchInternal.h" @@ -786,7 +785,7 @@ NS_IMETHODIMP nsIOService::SetOffline(PRBool offline) { nsCOMPtr - observerService(do_GetService(NS_OBSERVERSERVICE_CONTRACTID)); + observerService(do_GetService("@mozilla.org/observer-service;1")); nsresult rv1 = NS_OK; nsresult rv2 = NS_OK; diff --git a/mozilla/netwerk/cache/src/nsCacheService.cpp b/mozilla/netwerk/cache/src/nsCacheService.cpp index d3417ea1aa0..660774a864c 100644 --- a/mozilla/netwerk/cache/src/nsCacheService.cpp +++ b/mozilla/netwerk/cache/src/nsCacheService.cpp @@ -35,7 +35,6 @@ #include "nsAutoLock.h" #include "nsIEventQueue.h" #include "nsIObserverService.h" -#include "nsObserverService.h" #include "nsIPrefService.h" #include "nsIPrefBranch.h" #include "nsIPrefBranchInternal.h" @@ -110,7 +109,7 @@ nsCacheProfilePrefObserver::Install() nsresult rv, rv2 = NS_OK; // install profile-change observer - nsCOMPtr observerService = do_GetService(NS_OBSERVERSERVICE_CONTRACTID, &rv); + nsCOMPtr observerService = do_GetService("@mozilla.org/observer-service;1", &rv); if (NS_FAILED(rv)) return rv; NS_ENSURE_ARG(observerService); @@ -160,7 +159,7 @@ nsCacheProfilePrefObserver::Remove() nsresult rv, rv2 = NS_OK; // remove Observer Service observers - nsCOMPtr observerService = do_GetService(NS_OBSERVERSERVICE_CONTRACTID, &rv); + nsCOMPtr observerService = do_GetService("@mozilla.org/observer-service;1", &rv); if (NS_FAILED(rv)) return rv; NS_ENSURE_ARG(observerService); diff --git a/mozilla/netwerk/protocol/http/src/nsHttpHandler.cpp b/mozilla/netwerk/protocol/http/src/nsHttpHandler.cpp index 03e5a94a28f..24eab76aef3 100644 --- a/mozilla/netwerk/protocol/http/src/nsHttpHandler.cpp +++ b/mozilla/netwerk/protocol/http/src/nsHttpHandler.cpp @@ -40,7 +40,6 @@ #include "nsICacheService.h" #include "nsICategoryManager.h" #include "nsIObserverService.h" -#include "nsObserverService.h" #include "nsISupportsPrimitives.h" #include "nsINetModRegEntry.h" #include "nsICacheService.h" @@ -248,7 +247,7 @@ nsHttpHandler::Init() NS_HTTP_STARTUP_TOPIC); nsCOMPtr observerSvc = - do_GetService(NS_OBSERVERSERVICE_CONTRACTID, &rv); + do_GetService("@mozilla.org/observer-service;1", &rv); if (observerSvc) { observerSvc->AddObserver(this, "profile-before-change", PR_TRUE); observerSvc->AddObserver(this, "session-logout", PR_TRUE); diff --git a/mozilla/profile/src/nsProfile.cpp b/mozilla/profile/src/nsProfile.cpp index 36b113555cf..5c2a3860b42 100644 --- a/mozilla/profile/src/nsProfile.cpp +++ b/mozilla/profile/src/nsProfile.cpp @@ -79,7 +79,6 @@ #include "nsIChromeRegistry.h" // chromeReg #include "nsIStringBundle.h" #include "nsIObserverService.h" -#include "nsObserverService.h" #include "nsISupportsPrimitives.h" #include "nsHashtable.h" @@ -1106,7 +1105,7 @@ nsProfile::SetCurrentProfile(const PRUnichar * aCurrentProfile) isSwitch = PR_FALSE; nsCOMPtr observerService = - do_GetService(NS_OBSERVERSERVICE_CONTRACTID, &rv); + do_GetService("@mozilla.org/observer-service;1", &rv); NS_ENSURE_TRUE(observerService, NS_ERROR_FAILURE); nsISupports *subject = (nsISupports *)((nsIProfile *)this); @@ -1187,7 +1186,7 @@ NS_IMETHODIMP nsProfile::ShutDownCurrentProfile(PRUint32 shutDownType) nsresult rv; nsCOMPtr observerService = - do_GetService(NS_OBSERVERSERVICE_CONTRACTID, &rv); + do_GetService("@mozilla.org/observer-service;1", &rv); NS_ENSURE_TRUE(observerService, NS_ERROR_FAILURE); nsISupports *subject = (nsISupports *)((nsIProfile *)this); diff --git a/mozilla/rdf/chrome/src/nsChromeRegistry.cpp b/mozilla/rdf/chrome/src/nsChromeRegistry.cpp index 4fd267e1568..11342c48b2b 100644 --- a/mozilla/rdf/chrome/src/nsChromeRegistry.cpp +++ b/mozilla/rdf/chrome/src/nsChromeRegistry.cpp @@ -102,7 +102,6 @@ #include "nsAppDirectoryServiceDefs.h" #include "nsIPref.h" #include "nsIObserverService.h" -#include "nsObserverService.h" #include "nsIDOMElement.h" #include "nsIChromeEventHandler.h" #include "nsIContent.h" @@ -354,7 +353,7 @@ nsChromeRegistry::Init() NS_ASSERTION(NS_SUCCEEDED(rv), "unable to get RDF resource"); nsCOMPtr observerService = - do_GetService(NS_OBSERVERSERVICE_CONTRACTID, &rv); + do_GetService("@mozilla.org/observer-service;1", &rv); if (observerService) { observerService->AddObserver(this, "profile-before-change", PR_TRUE); observerService->AddObserver(this, "profile-do-change", PR_TRUE); diff --git a/mozilla/rdf/datasource/src/nsLocalStore.cpp b/mozilla/rdf/datasource/src/nsLocalStore.cpp index cd29835c9f6..7e5b2a3ffc3 100644 --- a/mozilla/rdf/datasource/src/nsLocalStore.cpp +++ b/mozilla/rdf/datasource/src/nsLocalStore.cpp @@ -59,7 +59,6 @@ #include "nsAppDirectoryServiceDefs.h" #include "nsIObserver.h" #include "nsIObserverService.h" -#include "nsObserverService.h" #include "nsWeakReference.h" //////////////////////////////////////////////////////////////////////// @@ -378,7 +377,7 @@ LocalStoreImpl::Init() // Register as an observer of profile changes nsCOMPtr obs = - do_GetService(NS_OBSERVERSERVICE_CONTRACTID); + do_GetService("@mozilla.org/observer-service;1"); if (obs) { obs->AddObserver(this, "profile-before-change", PR_TRUE); diff --git a/mozilla/uriloader/exthandler/nsExternalHelperAppService.cpp b/mozilla/uriloader/exthandler/nsExternalHelperAppService.cpp index 8698b84026c..af7cecd78e5 100644 --- a/mozilla/uriloader/exthandler/nsExternalHelperAppService.cpp +++ b/mozilla/uriloader/exthandler/nsExternalHelperAppService.cpp @@ -62,7 +62,6 @@ #include "nsIHttpChannel.h" #include "nsIAtom.h" #include "nsIObserverService.h" // so we can be an xpcom shutdown observer -#include "nsObserverService.h" #ifdef XP_MAC #include "nsILocalFileMac.h" @@ -149,7 +148,7 @@ nsExternalHelperAppService::nsExternalHelperAppService() : mDataSourceInitialize /* Add an observer to XPCOM shutdown */ nsresult rv = NS_OK; - nsCOMPtr obs = do_GetService(NS_OBSERVERSERVICE_CONTRACTID, &rv); + nsCOMPtr obs = do_GetService("@mozilla.org/observer-service;1", &rv); if (obs) rv = obs->AddObserver(NS_STATIC_CAST(nsIObserver*, this), NS_XPCOM_SHUTDOWN_OBSERVER_ID, PR_FALSE); @@ -587,7 +586,7 @@ nsExternalHelperAppService::Observe(nsISupports *aSubject, const char *aTopic, c ExpungeTemporaryFiles(); nsresult rv = NS_OK; - nsCOMPtr obs = do_GetService(NS_OBSERVERSERVICE_CONTRACTID, &rv); + nsCOMPtr obs = do_GetService("@mozilla.org/observer-service;1", &rv); if (obs) rv = obs->RemoveObserver(NS_STATIC_CAST(nsIObserver*, this), NS_XPCOM_SHUTDOWN_OBSERVER_ID); return NS_OK; diff --git a/mozilla/xpcom/base/nsExceptionService.cpp b/mozilla/xpcom/base/nsExceptionService.cpp index e693a9960d5..8f157eaff2b 100644 --- a/mozilla/xpcom/base/nsExceptionService.cpp +++ b/mozilla/xpcom/base/nsExceptionService.cpp @@ -42,7 +42,6 @@ #include "nsCOMPtr.h" #include "prthread.h" #include "prlock.h" -#include "nsObserverService.h" static const PRUintn BAD_TLS_INDEX = (PRUintn) -1; #define CHECK_SERVICE_USE_OK() if (!lock) return NS_ERROR_NOT_INITIALIZED @@ -179,7 +178,7 @@ nsExceptionService::nsExceptionService() NS_WARN_IF_FALSE(lock, "Error allocating ExceptionService lock"); // observe XPCOM shutdown. - nsCOMPtr observerService = do_GetService(NS_OBSERVERSERVICE_CONTRACTID); + nsCOMPtr observerService = do_GetService("@mozilla.org/observer-service;1"); NS_WARN_IF_FALSE(observerService, "Could not get observer service!"); if (observerService) observerService->AddObserver(this, NS_XPCOM_SHUTDOWN_OBSERVER_ID, PR_FALSE); diff --git a/mozilla/xpcom/base/nsMemoryImpl.cpp b/mozilla/xpcom/base/nsMemoryImpl.cpp index 7e3a71ed656..c2ffb8f3b1d 100644 --- a/mozilla/xpcom/base/nsMemoryImpl.cpp +++ b/mozilla/xpcom/base/nsMemoryImpl.cpp @@ -40,7 +40,6 @@ #include "nsAlgorithm.h" #include "nsIServiceManager.h" #include "nsIObserverService.h" -#include "nsObserverService.h" #include "nsAutoLock.h" #include "nsIThread.h" #include "nsIEventQueueService.h" @@ -456,7 +455,7 @@ nsMemoryImpl::FlushMemory(const PRUnichar* aReason, PRBool aImmediate) nsresult nsMemoryImpl::RunFlushers(nsMemoryImpl* aSelf, const PRUnichar* aReason) { - nsCOMPtr os = do_GetService(NS_OBSERVERSERVICE_CONTRACTID); + nsCOMPtr os = do_GetService("@mozilla.org/observer-service;1"); if (os) { os->NotifyObservers(aSelf, NS_MEMORY_PRESSURE_TOPIC, aReason); } diff --git a/mozilla/xpcom/build/nsXPComInit.cpp b/mozilla/xpcom/build/nsXPComInit.cpp index 09d8b7c4f04..4130054c119 100644 --- a/mozilla/xpcom/build/nsXPComInit.cpp +++ b/mozilla/xpcom/build/nsXPComInit.cpp @@ -39,9 +39,9 @@ #include "nsIRegistry.h" #include "nscore.h" #include "nsCOMPtr.h" -#include "nsObserverService.h" #include "nsObserverList.h" #include "nsObserver.h" +#include "nsObserverService.h" #include "nsProperties.h" #include "nsIProperties.h" #include "nsPersistentProperties.h" @@ -456,7 +456,7 @@ nsresult NS_COM NS_ShutdownXPCOM(nsIServiceManager* servMgr) // Block it so that the COMPtr will get deleted before we hit // servicemanager shutdown nsCOMPtr observerService = - do_GetService(NS_OBSERVERSERVICE_CONTRACTID, &rv); + do_GetService("@mozilla.org/observer-service;1", &rv); if (NS_SUCCEEDED(rv)) { nsCOMPtr mgr; diff --git a/mozilla/xpcom/components/nsComponentManager.cpp b/mozilla/xpcom/components/nsComponentManager.cpp index eb607a3bd63..e1656bb0b9d 100644 --- a/mozilla/xpcom/components/nsComponentManager.cpp +++ b/mozilla/xpcom/components/nsComponentManager.cpp @@ -52,7 +52,6 @@ #include "nsXPIDLString.h" #include "nsIObserverService.h" -#include "nsObserverService.h" #include "nsLocalFile.h" #include "nsDirectoryService.h" @@ -2599,7 +2598,7 @@ nsComponentManagerImpl::AutoRegisterImpl(PRInt32 when, nsIFile *inDirSpec) // Notify observers of xpcom autoregistration start nsCOMPtr observerService = - do_GetService(NS_OBSERVERSERVICE_CONTRACTID, &rv); + do_GetService("@mozilla.org/observer-service;1", &rv); if (NS_FAILED(rv)) { // NO COMPtr as we dont release the service manager diff --git a/mozilla/xpcom/components/nsNativeComponentLoader.cpp b/mozilla/xpcom/components/nsNativeComponentLoader.cpp index 95dbae7370a..be370261c0e 100644 --- a/mozilla/xpcom/components/nsNativeComponentLoader.cpp +++ b/mozilla/xpcom/components/nsNativeComponentLoader.cpp @@ -43,7 +43,6 @@ #include "nsCRT.h" #include "nsIObserverService.h" -#include "nsObserverService.h" #include "nsITimelineService.h" @@ -682,7 +681,7 @@ nsNativeComponentLoader::AutoUnregisterComponent(PRInt32 when, // Notify observers, if any, of autoregistration work nsCOMPtr observerService = - do_GetService(NS_OBSERVERSERVICE_CONTRACTID, &rv); + do_GetService("@mozilla.org/observer-service;1", &rv); if (NS_SUCCEEDED(rv)) { nsCOMPtr mgr; @@ -839,7 +838,7 @@ nsNativeComponentLoader::AutoRegisterComponent(PRInt32 when, // Notify observers, if any, of autoregistration work nsCOMPtr observerService = - do_GetService(NS_OBSERVERSERVICE_CONTRACTID, &rv); + do_GetService("@mozilla.org/observer-service;1", &rv); if (NS_SUCCEEDED(rv)) { nsCOMPtr mgr; diff --git a/mozilla/xpcom/ds/nsIObserver.idl b/mozilla/xpcom/ds/nsIObserver.idl index 5f67a64b6aa..3d41a259579 100644 --- a/mozilla/xpcom/ds/nsIObserver.idl +++ b/mozilla/xpcom/ds/nsIObserver.idl @@ -56,6 +56,9 @@ interface nsIObserver : nsISupports { * If you expect multiple topics/subjects, the impl is * responsible for filtering. * + * You should not modify, add, remove, or enumerate + * notifications in the implemention of observer. + * * @param aSubject : Notification specific interface pointer. * @param aTopic : The notification topic or subject. * @param aData : Notification specific wide string. diff --git a/mozilla/xpcom/ds/nsObserverService.cpp b/mozilla/xpcom/ds/nsObserverService.cpp index 013e82460b0..dacbb33461b 100644 --- a/mozilla/xpcom/ds/nsObserverService.cpp +++ b/mozilla/xpcom/ds/nsObserverService.cpp @@ -37,6 +37,7 @@ * ***** END LICENSE BLOCK ***** */ #define NS_IMPL_IDS +#include "prlog.h" #include "prlock.h" #include "nsIFactory.h" #include "nsIServiceManager.h" @@ -51,9 +52,19 @@ static NS_DEFINE_CID(kObserverServiceCID, NS_OBSERVERSERVICE_CID); -//////////////////////////////////////////////////////////////////////////////// -static nsObserverService* gObserverService = nsnull; // The one-and-only ObserverService +#if defined(PR_LOGGING) +// Log module for nsObserverService logging... +// +// To enable logging (see prlog.h for full details): +// +// set NSPR_LOG_MODULES=ObserverService:5 +// set NSPR_LOG_FILE=nspr.log +// +// this enables PR_LOG_DEBUG level information and places all output in +// the file nspr.log +PRLogModuleInfo* observerServiceLog = nsnull; +#endif /* PR_LOGGING */ //////////////////////////////////////////////////////////////////////////////// // nsObserverService Implementation @@ -61,11 +72,6 @@ static nsObserverService* gObserverService = nsnull; // The one-and-only Observe NS_IMPL_THREADSAFE_ISUPPORTS1(nsObserverService, nsIObserverService) -NS_COM nsresult NS_NewObserverService(nsIObserverService** anObserverService) -{ - return nsObserverService::GetObserverService(anObserverService); -} - nsObserverService::nsObserverService() : mObserverTopicTable(nsnull) { @@ -77,12 +83,16 @@ nsObserverService::~nsObserverService(void) { if(mObserverTopicTable) delete mObserverTopicTable; - gObserverService = nsnull; } NS_METHOD nsObserverService::Create(nsISupports* outer, const nsIID& aIID, void* *aInstancePtr) { +#if defined(PR_LOGGING) + if (!observerServiceLog) + observerServiceLog = PR_NewLogModule("ObserverService"); +#endif + nsresult rv; nsObserverService* os = new nsObserverService(); if (os == nsnull) @@ -93,20 +103,6 @@ nsObserverService::Create(nsISupports* outer, const nsIID& aIID, void* *aInstanc return rv; } -nsresult nsObserverService::GetObserverService(nsIObserverService** anObserverService) -{ - if (! gObserverService) { - nsObserverService* it = new nsObserverService(); - if (! it) - return NS_ERROR_OUT_OF_MEMORY; - gObserverService = it; - } - - NS_ADDREF(gObserverService); - *anObserverService = gObserverService; - return NS_OK; -} - static PRBool PR_CALLBACK ReleaseObserverList(nsHashKey *aKey, void *aData, void* closure) { @@ -223,6 +219,9 @@ NS_IMETHODIMP nsObserverService::NotifyObservers( nsISupports *aSubject, if ( observer ) observer->Observe( aSubject, aTopic, someData ); + + PR_LOG(observerServiceLog, PR_LOG_DEBUG, ("Notification - %s\n", aTopic ? aTopic : "undefined")); + } #endif } diff --git a/mozilla/xpcom/ds/nsObserverService.h b/mozilla/xpcom/ds/nsObserverService.h index 8661281cc38..43409f8bced 100644 --- a/mozilla/xpcom/ds/nsObserverService.h +++ b/mozilla/xpcom/ds/nsObserverService.h @@ -54,15 +54,12 @@ class nsObserverService : public nsIObserverService { public: NS_DEFINE_STATIC_CID_ACCESSOR( NS_OBSERVERSERVICE_CID ) - static nsresult GetObserverService(nsIObserverService** anObserverService); - nsObserverService(); virtual ~nsObserverService(void); NS_DECL_ISUPPORTS NS_DECL_NSIOBSERVERSERVICE - - + static NS_METHOD Create(nsISupports* outer, const nsIID& aIID, void* *aInstancePtr); diff --git a/mozilla/xpcom/tests/TestObserverService.cpp b/mozilla/xpcom/tests/TestObserverService.cpp index 6ca78d048de..90f2cb2efe7 100644 --- a/mozilla/xpcom/tests/TestObserverService.cpp +++ b/mozilla/xpcom/tests/TestObserverService.cpp @@ -40,7 +40,6 @@ #include "nsISupports.h" #include "nsIComponentManager.h" #include "nsIObserverService.h" -#include "nsObserverService.h" #include "nsIObserver.h" #include "nsIEnumerator.h" #include "nsString.h" @@ -105,7 +104,7 @@ int main(int argc, char *argv[]) nsCString topicB; topicB.Assign( "topic-B" ); nsresult rv; - nsresult res = nsComponentManager::CreateInstance(NS_OBSERVERSERVICE_CONTRACTID, + nsresult res = nsComponentManager::CreateInstance("@mozilla.org/observer-service;1", NULL, NS_GET_IID(nsIObserverService), (void **) &anObserverService); diff --git a/mozilla/xpcom/threads/nsEventQueue.cpp b/mozilla/xpcom/threads/nsEventQueue.cpp index 507b301e037..e2b343cbf98 100644 --- a/mozilla/xpcom/threads/nsEventQueue.cpp +++ b/mozilla/xpcom/threads/nsEventQueue.cpp @@ -42,7 +42,6 @@ #include "nsIServiceManager.h" #include "nsIObserverService.h" -#include "nsObserverService.h" #include "nsString.h" @@ -218,7 +217,7 @@ nsEventQueueImpl::NotifyObservers(const char *aTopic) { nsresult rv; - nsCOMPtr os = do_GetService(NS_OBSERVERSERVICE_CONTRACTID, &rv); + nsCOMPtr os = do_GetService("@mozilla.org/observer-service;1", &rv); if (NS_SUCCEEDED(rv)) { nsCOMPtr kungFuDeathGrip(this); nsCOMPtr us(do_QueryInterface(kungFuDeathGrip)); diff --git a/mozilla/xpfe/appshell/src/nsAppShellService.cpp b/mozilla/xpfe/appshell/src/nsAppShellService.cpp index 1510eecc480..90bbdf6b515 100644 --- a/mozilla/xpfe/appshell/src/nsAppShellService.cpp +++ b/mozilla/xpfe/appshell/src/nsAppShellService.cpp @@ -46,7 +46,6 @@ #include "nsIServiceManager.h" #include "nsIEventQueueService.h" #include "nsIObserverService.h" -#include "nsObserverService.h" #include "nsIObserver.h" #include "nsWeakReference.h" #include "nsXPComFactory.h" /* template implementation of a XPCOM factory */ @@ -801,7 +800,7 @@ void nsAppShellService::RegisterObserver(PRBool aRegister) NS_ASSERTION(weObserve, "who's been chopping bits off nsAppShellService?"); - rv = nsServiceManager::GetService(NS_OBSERVERSERVICE_CONTRACTID, + rv = nsServiceManager::GetService("@mozilla.org/observer-service;1", NS_GET_IID(nsIObserverService), &glop); if (NS_SUCCEEDED(rv)) { nsIObserverService *os = NS_STATIC_CAST(nsIObserverService*,glop); diff --git a/mozilla/xpfe/appshell/src/nsWebShellWindow.cpp b/mozilla/xpfe/appshell/src/nsWebShellWindow.cpp index 659b17202c0..f67b7e809fe 100644 --- a/mozilla/xpfe/appshell/src/nsWebShellWindow.cpp +++ b/mozilla/xpfe/appshell/src/nsWebShellWindow.cpp @@ -110,7 +110,6 @@ #include "nsIDocumentLoader.h" #include "nsIDocumentLoaderFactory.h" #include "nsIObserverService.h" -#include "nsObserverService.h" #include "prprf.h" //#include "nsIDOMHTMLInputElement.h" //#include "nsIDOMHTMLImageElement.h" @@ -1663,7 +1662,7 @@ nsWebShellWindow::NotifyObservers( const nsString &aTopic, const nsString &someD nsresult rv = NS_OK; // Get observer service. nsIObserverService *svc = 0; - rv = nsServiceManager::GetService( NS_OBSERVERSERVICE_CONTRACTID, + rv = nsServiceManager::GetService( "@mozilla.org/observer-service;1", NS_GET_IID(nsIObserverService), (nsISupports**)&svc ); if ( NS_SUCCEEDED( rv ) && svc ) { @@ -1673,7 +1672,7 @@ nsWebShellWindow::NotifyObservers( const nsString &aTopic, const nsString &someD topic.AppendWithConversion(aTopic); rv = svc->NotifyObservers( (nsIWebShellWindow*)this, topic.get(), someData.get() ); // Release the service. - nsServiceManager::ReleaseService( NS_OBSERVERSERVICE_CONTRACTID, svc ); + nsServiceManager::ReleaseService( "@mozilla.org/observer-service;1", svc ); } else { } return rv; diff --git a/mozilla/xpfe/appshell/src/nsXULWindow.cpp b/mozilla/xpfe/appshell/src/nsXULWindow.cpp index c74bcd4def2..f742e685edf 100644 --- a/mozilla/xpfe/appshell/src/nsXULWindow.cpp +++ b/mozilla/xpfe/appshell/src/nsXULWindow.cpp @@ -49,7 +49,6 @@ #include "nsIJSContextStack.h" #include "nsIMarkupDocumentViewer.h" #include "nsIObserverService.h" -#include "nsObserverService.h" #include "nsIWindowMediator.h" #include "nsIScreenManager.h" #include "nsIScreen.h" @@ -1430,7 +1429,7 @@ static const char *prefix = "@mozilla.org/appshell/component/browser/window;1"; NS_IMETHODIMP nsXULWindow::NotifyObservers(const PRUnichar* aTopic, const PRUnichar* aData) { - nsCOMPtr service(do_GetService(NS_OBSERVERSERVICE_CONTRACTID)); + nsCOMPtr service(do_GetService("@mozilla.org/observer-service;1")); if(!service) return NS_ERROR_FAILURE; diff --git a/mozilla/xpfe/bootstrap/nsAppRunner.cpp b/mozilla/xpfe/bootstrap/nsAppRunner.cpp index 79b77765eb4..9fe26b17fdd 100644 --- a/mozilla/xpfe/bootstrap/nsAppRunner.cpp +++ b/mozilla/xpfe/bootstrap/nsAppRunner.cpp @@ -52,7 +52,6 @@ #include "nsIAppShellService.h" #include "nsIAppStartupNotifier.h" #include "nsIObserverService.h" -#include "nsObserverService.h" #include "nsAppShellCIDs.h" #include "prprf.h" #include "nsCRT.h" @@ -1095,7 +1094,7 @@ static nsresult main1(int argc, char* argv[], nsISupports *nativeApp ) NS_TIMELINE_ENTER("init observer service"); // Setup an autoreg obserer, so that we can update a progress // string in the splash screen - nsCOMPtr obsService(do_GetService(NS_OBSERVERSERVICE_CONTRACTID)); + nsCOMPtr obsService(do_GetService("@mozilla.org/observer-service;1")); if (obsService) { nsCOMPtr splashScreenObserver(do_QueryInterface(nativeApp)); diff --git a/mozilla/xpfe/bootstrap/nsDocLoadObserver.cpp b/mozilla/xpfe/bootstrap/nsDocLoadObserver.cpp index a3d65be5b02..0a4c1752c6c 100644 --- a/mozilla/xpfe/bootstrap/nsDocLoadObserver.cpp +++ b/mozilla/xpfe/bootstrap/nsDocLoadObserver.cpp @@ -39,7 +39,6 @@ #include "nsCOMPtr.h" #include "nsError.h" #include "nsIObserverService.h" -#include "nsObserverService.h" #include "nsIServiceManager.h" #include "nsString.h" #include "nsReadableUtils.h" @@ -66,7 +65,7 @@ void nsDocLoadObserver::Register() if (!mRegistered) { nsresult rv; - nsCOMPtr anObserverService = do_GetService(NS_OBSERVERSERVICE_CONTRACTID, &rv); + nsCOMPtr anObserverService = do_GetService("@mozilla.org/observer-service;1", &rv); if (NS_SUCCEEDED(rv)) { if (NS_SUCCEEDED(anObserverService->AddObserver(this, "EndDocumentLoad", PR_FALSE))) @@ -82,7 +81,7 @@ void nsDocLoadObserver::Unregister() if (mRegistered) { nsresult rv; - nsCOMPtr anObserverService = do_GetService(NS_OBSERVERSERVICE_CONTRACTID, &rv); + nsCOMPtr anObserverService = do_GetService("@mozilla.org/observer-service;1", &rv); if (NS_SUCCEEDED(rv)) { if (NS_SUCCEEDED(anObserverService->RemoveObserver(this, diff --git a/mozilla/xpfe/bootstrap/nsNativeAppSupportWin.cpp b/mozilla/xpfe/bootstrap/nsNativeAppSupportWin.cpp index d5c7526d237..ec54dbc8245 100644 --- a/mozilla/xpfe/bootstrap/nsNativeAppSupportWin.cpp +++ b/mozilla/xpfe/bootstrap/nsNativeAppSupportWin.cpp @@ -67,7 +67,6 @@ #include "nsIPromptService.h" #include "nsNetCID.h" #include "nsIObserverService.h" -#include "nsObserverService.h" // These are needed to load a URL in a browser window. #include "nsIDOMLocation.h" @@ -2079,7 +2078,7 @@ nsNativeAppSupportWin::OnLastWindowClosing( nsIXULWindow *aWindow ) { } } - nsCOMPtr observerService(do_GetService(NS_OBSERVERSERVICE_CONTRACTID, &rv)); + nsCOMPtr observerService(do_GetService("@mozilla.org/observer-service;1", &rv)); if (NS_FAILED(rv)) return rv; observerService->NotifyObservers(nsnull, "session-logout", nsnull); diff --git a/mozilla/xpfe/browser/src/nsBrowserInstance.cpp b/mozilla/xpfe/browser/src/nsBrowserInstance.cpp index 6b746147261..d17e627a9aa 100644 --- a/mozilla/xpfe/browser/src/nsBrowserInstance.cpp +++ b/mozilla/xpfe/browser/src/nsBrowserInstance.cpp @@ -109,7 +109,6 @@ #include "nsIDocumentLoader.h" #include "nsIObserverService.h" -#include "nsObserverService.h" #include "nsIFileSpec.h" @@ -236,7 +235,7 @@ public: mCursor = mBuffer; nsCOMPtr obsServ = - do_GetService(NS_OBSERVERSERVICE_CONTRACTID, &rv); + do_GetService("@mozilla.org/observer-service;1", &rv); if (NS_FAILED(rv)) return rv; rv = obsServ->AddObserver(this, "EndDocumentLoad", PR_FALSE ); NS_ASSERTION(NS_SUCCEEDED(rv), "unable to add self to observer service"); diff --git a/mozilla/xpfe/components/bookmarks/src/nsBookmarksService.cpp b/mozilla/xpfe/components/bookmarks/src/nsBookmarksService.cpp index ae855e6d4f7..0ce5d688ed7 100644 --- a/mozilla/xpfe/components/bookmarks/src/nsBookmarksService.cpp +++ b/mozilla/xpfe/components/bookmarks/src/nsBookmarksService.cpp @@ -51,7 +51,6 @@ #include "nsIComponentManager.h" #include "nsIDOMWindow.h" #include "nsIObserverService.h" -#include "nsObserverService.h" #include "nsIRDFContainer.h" #include "nsIRDFContainerUtils.h" #include "nsIRDFService.h" @@ -1705,7 +1704,7 @@ nsBookmarksService::Init() // Register as an observer of profile changes nsCOMPtr observerService = - do_GetService(NS_OBSERVERSERVICE_CONTRACTID, &rv); + do_GetService("@mozilla.org/observer-service;1", &rv); NS_ASSERTION(observerService, "Could not get observer service."); if (observerService) { observerService->AddObserver(this, "profile-before-change", PR_TRUE); diff --git a/mozilla/xpfe/components/history/src/nsGlobalHistory.cpp b/mozilla/xpfe/components/history/src/nsGlobalHistory.cpp index 34dfc9479a5..9b771b95a80 100644 --- a/mozilla/xpfe/components/history/src/nsGlobalHistory.cpp +++ b/mozilla/xpfe/components/history/src/nsGlobalHistory.cpp @@ -79,7 +79,6 @@ #include "nsIPref.h" #include "nsIObserverService.h" -#include "nsObserverService.h" PRInt32 nsGlobalHistory::gRefCnt; nsIRDFService* nsGlobalHistory::gRDFService; @@ -2114,7 +2113,7 @@ nsGlobalHistory::Init() // register to observe profile changes nsCOMPtr observerService = - do_GetService(NS_OBSERVERSERVICE_CONTRACTID, &rv); + do_GetService("@mozilla.org/observer-service;1", &rv); NS_ASSERTION(observerService, "failed to get observer service"); if (observerService) { observerService->AddObserver(this, "profile-before-change", PR_TRUE); diff --git a/mozilla/xpfe/components/search/src/nsInternetSearchService.cpp b/mozilla/xpfe/components/search/src/nsInternetSearchService.cpp index c6cfe756133..973f881f8e4 100755 --- a/mozilla/xpfe/components/search/src/nsInternetSearchService.cpp +++ b/mozilla/xpfe/components/search/src/nsInternetSearchService.cpp @@ -76,7 +76,6 @@ #include "nsIBookmarksService.h" #include "nsIStringBundle.h" #include "nsIObserverService.h" -#include "nsObserverService.h" #include "nsIURL.h" #include "nsReadableUtils.h" @@ -897,7 +896,7 @@ InternetSearchDataSource::Init() // Register as a profile change obsevrer nsCOMPtr observerService = - do_GetService(NS_OBSERVERSERVICE_CONTRACTID, &rv); + do_GetService("@mozilla.org/observer-service;1", &rv); if (observerService) { observerService->AddObserver(this, "profile-before-change", PR_TRUE); observerService->AddObserver(this, "profile-do-change", PR_TRUE); diff --git a/mozilla/xpinstall/src/nsSoftwareUpdate.cpp b/mozilla/xpinstall/src/nsSoftwareUpdate.cpp index 39896c885a3..3b0fbda810f 100644 --- a/mozilla/xpinstall/src/nsSoftwareUpdate.cpp +++ b/mozilla/xpinstall/src/nsSoftwareUpdate.cpp @@ -33,7 +33,6 @@ #include "nsCOMPtr.h" #include "nsCRT.h" #include "nsIObserverService.h" -#include "nsObserverService.h" #include "nspr.h" #include "prlock.h" @@ -147,7 +146,7 @@ nsSoftwareUpdate::nsSoftwareUpdate() /* Add this as a shutdown observer */ /***************************************/ nsCOMPtr observerService = - do_GetService(NS_OBSERVERSERVICE_CONTRACTID, &rv); + do_GetService("@mozilla.org/observer-service;1", &rv); if (NS_SUCCEEDED(rv)) observerService->AddObserver(this, NS_XPCOM_SHUTDOWN_OBSERVER_ID, PR_FALSE); diff --git a/mozilla/xpinstall/src/nsXPIProxy.cpp b/mozilla/xpinstall/src/nsXPIProxy.cpp index 90116c425c0..84ec703173d 100644 --- a/mozilla/xpinstall/src/nsXPIProxy.cpp +++ b/mozilla/xpinstall/src/nsXPIProxy.cpp @@ -30,7 +30,6 @@ #include "nsIDOMPluginArray.h" #include "nsIServiceManager.h" #include "nsIObserverService.h" -#include "nsObserverService.h" nsXPIProxy::nsXPIProxy() { @@ -70,7 +69,7 @@ nsXPIProxy::RefreshPlugins(nsISupports *aWindow) NS_IMETHODIMP nsXPIProxy::NotifyRestartNeeded() { - nsCOMPtr obs(do_GetService(NS_OBSERVERSERVICE_CONTRACTID)); + nsCOMPtr obs(do_GetService("@mozilla.org/observer-service;1")); if (obs) obs->NotifyObservers( nsnull, "xpinstall-restart", nsnull );