Create an event queue via the EventQueueService for the UI thread...

git-svn-id: svn://10.0.0.236/trunk@17145 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
rpotts%netscape.com
1999-01-05 05:58:08 +00:00
parent 9493f3c102
commit ec65ee7ade
2 changed files with 22 additions and 0 deletions

View File

@@ -28,6 +28,9 @@
#include "nsIPref.h"
#include "nsINetService.h"
#include "nsRepository.h"
#include "nsIServiceManager.h"
#include "nsIEventQueueService.h"
#include "nsXPComCIID.h"
#include "nsWebCrawler.h"
#include "prprf.h"
#include "plstr.h"
@@ -70,10 +73,12 @@ extern nsresult NS_NewBrowserWindowFactory(nsIFactory** aFactory);
extern nsresult NS_NewXPBaseWindowFactory(nsIFactory** aFactory);
extern "C" void NS_SetupRegistry();
static NS_DEFINE_IID(kEventQueueServiceCID, NS_EVENTQUEUESERVICE_CID);
static NS_DEFINE_IID(kAppShellCID, NS_APPSHELL_CID);
static NS_DEFINE_IID(kBrowserWindowCID, NS_BROWSER_WINDOW_CID);
static NS_DEFINE_IID(kXPBaseWindowCID, NS_XPBASE_WINDOW_CID);
static NS_DEFINE_IID(kIEventQueueServiceIID, NS_IEVENTQUEUESERVICE_IID);
static NS_DEFINE_IID(kIAppShellIID, NS_IAPPSHELL_IID);
static NS_DEFINE_IID(kIBrowserWindowIID, NS_IBROWSER_WINDOW_IID);
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
@@ -179,6 +184,16 @@ nsViewerApp::Initialize(int argc, char** argv)
return rv;
}
// Create the Event Queue for the UI thread...
rv = nsServiceManager::GetService(kEventQueueServiceCID,
kIEventQueueServiceIID,
(nsISupports **)&mEventQService);
if (NS_OK == rv) {
// XXX: What if this fails?
rv = mEventQService->CreateThreadEventQueue();
}
// Create widget application shell
rv = nsRepository::CreateInstance(kAppShellCID, nsnull, kIAppShellIID,
(void**)&mAppShell);
@@ -268,6 +283,11 @@ nsViewerApp::Exit()
Destroy();
mAppShell->Exit();
NS_RELEASE(mAppShell);
if (nsnull != mEventQService) {
nsServiceManager::ReleaseService(kEventQueueServiceCID, mEventQService);
mEventQService = nsnull;
}
return NS_OK;
}

View File

@@ -25,6 +25,7 @@
#include "nsVoidArray.h"
#include "nsWebCrawler.h"
class nsIEventQueueService;
class nsIPref;
class nsBrowserWindow;
class nsIBrowserWindow;
@@ -76,6 +77,7 @@ protected:
nsIAppShell* mAppShell;
nsIPref* mPrefs;
nsIEventQueueService* mEventQService;
nsString mStartURL;
PRBool mDoPurify;
PRBool mLoadTestFromFile;