Reworked the initialization of the PLEvent queue to use the new EventQueueService instead of calling PL_InitializeEventsLib(...)

This commit is contained in:
rpotts%netscape.com 1999-01-09 07:18:22 +00:00
parent 7f3ba5f84a
commit 152716d52b
2 changed files with 22 additions and 3 deletions

View File

@ -32,6 +32,9 @@ static const std::string c_szPrefsHomePage = "browser.startup.homepage";
static const std::string c_szDefaultPage = "resource://res/MozillaControl.html"; static const std::string c_szDefaultPage = "resource://res/MozillaControl.html";
static NS_DEFINE_IID(kIEventQueueServiceIID, NS_IEVENTQUEUESERVICE_IID);
static NS_DEFINE_IID(kEventQueueServiceCID, NS_EVENTQUEUESERVICE_CID);
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// CMozillaBrowser // CMozillaBrowser
@ -55,16 +58,29 @@ CMozillaBrowser::CMozillaBrowser()
// Controls starts off unbusy // Controls starts off unbusy
m_bBusy = FALSE; m_bBusy = FALSE;
// Initialise the events library if it hasn't been already
PL_InitializeEventsLib("");
// Register components // Register components
NS_SetupRegistry(); NS_SetupRegistry();
// Create the Event Queue for the UI thread...
//
// If an event queue already exists for the thread, then
// CreateThreadEventQueue(...) will fail...
nsresult rv;
nsIEventQueueService* eventQService = NULL;
rv = nsServiceManager::GetService(kEventQueueServiceCID,
kIEventQueueServiceIID,
(nsISupports **)&eventQService);
if (NS_SUCCEEDED(rv)) {
rv = eventQService->CreateThreadEventQueue();
nsServiceManager::ReleaseService(kEventQueueServiceCID, eventQService);
}
} }
CMozillaBrowser::~CMozillaBrowser() CMozillaBrowser::~CMozillaBrowser()
{ {
// XXX: Do not call DestroyThreadEventQueue(...) for now...
NG_TRACE(_T("CMozillaBrowser::~CMozillaBrowser\n")); NG_TRACE(_T("CMozillaBrowser::~CMozillaBrowser\n"));
} }

View File

@ -67,6 +67,9 @@ typedef long int32;
#include "prprf.h" #include "prprf.h"
#include "plevent.h" #include "plevent.h"
#include "nsRepository.h" #include "nsRepository.h"
#include "nsIServiceManager.h"
#include "nsIEventQueueService.h"
#include "nsXPComCIID.h"
#include "nsWidgetsCID.h" #include "nsWidgetsCID.h"
#include "nsGfxCIID.h" #include "nsGfxCIID.h"
#include "nsViewsCID.h" #include "nsViewsCID.h"