bug 33099

r=shaver
a=edburns

Native code changes: This fix eradicates all
occurrences of the following symbols
 nsComponentManager nsServiceManeger
And replaces them with their nsI counterparts.
The following ns* classes still are used in
webclient, and no plans exist to replace them
with nsI counterparts: nsresult nsCOMPtr
nsCRT nsnull * nsServiceManager occurrences
were replaced with do_GetService(), using a
PROGID. * nsComponentManager occurrences were replaced with a call on the global class gComponentManager, declared in the new file ns_globals.h, and defined in WrapperFactoryImpl.cpp. ns_globals.h is included in jni_util.h. See the attachment to bug 33099 for ns_globals.h * Added deallocation code to WindowControlImpl.cpp nativeTerminate. I know it doesn't do much, but it's correct. Java code changes: * Added static method BrowserControlFactory.appTerminate(). This method simply calls the existing BrowserControlImpl.appTerminate(), which calls WrapperFactoryImpl.cpp nativeTerminate(). BrowserControlFactory.appTerminate() is called from EmbeddedMozilla's WindowListener, which gets fired when the user signals she wants the app to terminate.


git-svn-id: svn://10.0.0.236/trunk@66563 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
edburns%acm.org
2000-04-20 18:16:05 +00:00
parent fd8819aef9
commit 394bcff4aa
10 changed files with 169 additions and 74 deletions

View File

@@ -43,27 +43,22 @@
#include "nsIEventQueueService.h" // for PLEventQueue
#include "nsIPref.h" // for preferences
#include "nsRepository.h"
#include "nsIServiceManager.h" // for nsServiceManager::GetService
#include "nsIServiceManager.h" // for do_GetService
#include "nsISessionHistory.h" // for history
#include "nsIThread.h" // for PRThread
//nsIWebShell is included in jni_util.h
#include "prlog.h" // for PR_ASSERT
#ifdef XP_UNIX
#include <unistd.h>
#include "gdksuperwin.h"
#include "gtkmozarea.h"
#endif
static NS_DEFINE_IID(kIEventQueueServiceIID, NS_IEVENTQUEUESERVICE_IID);
static NS_DEFINE_IID(kEventQueueServiceCID, NS_EVENTQUEUESERVICE_CID);
static NS_DEFINE_IID(kWebShellCID, NS_WEB_SHELL_CID);
static NS_DEFINE_IID(kIWebShellIID, NS_IWEB_SHELL_IID);
static NS_DEFINE_CID(kPrefCID, NS_PREF_CID);
static NS_DEFINE_IID(kISessionHistoryIID, NS_ISESSIONHISTORY_IID);
static NS_DEFINE_CID(kSessionHistoryCID, NS_SESSIONHISTORY_CID);
@@ -92,7 +87,7 @@ nsresult InitMozillaStuff (WebShellInitContext * arg);
// Local data
//
static nsISessionHistory *gHistory = nsnull;
nsISessionHistory *gHistory = nsnull;
char * errorMessages[] = {
"No Error",
@@ -331,7 +326,12 @@ static void event_processor_callback(gpointer data,
nsresult InitMozillaStuff (WebShellInitContext * initContext)
{
nsIEventQueueService * aEventQService = nsnull;
PR_ASSERT(gComponentManager);
nsCOMPtr<nsIEventQueueService>
aEventQService = do_GetService(NS_EVENTQUEUESERVICE_PROGID);
// if we get here, we know that aEventQService is not null.
nsresult rv = NS_ERROR_FAILURE;
PRBool allowPlugins = PR_FALSE;
@@ -346,11 +346,7 @@ nsresult InitMozillaStuff (WebShellInitContext * initContext)
#endif
// Create the Event Queue for the UI thread...
rv = nsServiceManager::GetService(kEventQueueServiceCID,
kIEventQueueServiceIID,
(nsISupports **) &aEventQService);
if (NS_FAILED(rv)) {
if (!aEventQService) {
initContext->initFailCode = kEventQueueError;
return rv;
}
@@ -452,23 +448,20 @@ nsresult InitMozillaStuff (WebShellInitContext * initContext)
}
#endif
nsIPref *prefs;
nsCOMPtr<nsIPref> prefs = do_GetService(NS_PREF_PROGID);
rv = nsServiceManager::GetService(kPrefCID,
nsIPref::GetIID(),
(nsISupports **)&prefs);
if (NS_SUCCEEDED(rv)) {
if (nsnull == gHistory) { // only do this once per app.
if (prefs) {
if (nsnull == gComponentManager) { // only do this once per app.
prefs->ReadUserPrefs();
}
// Set the prefs in the outermost webshell.
initContext->webShell->SetPrefs(prefs);
nsServiceManager::ReleaseService(kPrefCID, prefs);
}
if (nsnull == gHistory) {
rv = nsComponentManager::CreateInstance(kSessionHistoryCID, nsnull, kISessionHistoryIID,
(void**)&gHistory);
rv = gComponentManager->CreateInstance(kSessionHistoryCID, nsnull,
kISessionHistoryIID,
(void**)&gHistory);
if (NS_FAILED(rv)) {
initContext->initFailCode = kHistoryWebShellError;
return rv;