From f1bf3a2dfdef468bac4d886ae080b220722e5bee Mon Sep 17 00:00:00 2001 From: "rpotts%netscape.com" Date: Sat, 9 Jan 1999 07:18:22 +0000 Subject: [PATCH] Reworked the initialization of the PLEvent queue to use the new EventQueueService instead of calling PL_InitializeEventsLib(...) git-svn-id: svn://10.0.0.236/trunk@17450 18797224-902f-48f8-a5cc-f745e15eee43 --- .../webshell/embed/ActiveX/MozillaBrowser.cpp | 22 ++++++++++++++++--- mozilla/webshell/embed/ActiveX/StdAfx.h | 3 +++ 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/mozilla/webshell/embed/ActiveX/MozillaBrowser.cpp b/mozilla/webshell/embed/ActiveX/MozillaBrowser.cpp index c894f7ee2ec..78a70d24a01 100644 --- a/mozilla/webshell/embed/ActiveX/MozillaBrowser.cpp +++ b/mozilla/webshell/embed/ActiveX/MozillaBrowser.cpp @@ -32,6 +32,9 @@ static const std::string c_szPrefsHomePage = "browser.startup.homepage"; 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 @@ -55,16 +58,29 @@ CMozillaBrowser::CMozillaBrowser() // Controls starts off unbusy m_bBusy = FALSE; - // Initialise the events library if it hasn't been already - PL_InitializeEventsLib(""); - // Register components 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() { + // XXX: Do not call DestroyThreadEventQueue(...) for now... NG_TRACE(_T("CMozillaBrowser::~CMozillaBrowser\n")); } diff --git a/mozilla/webshell/embed/ActiveX/StdAfx.h b/mozilla/webshell/embed/ActiveX/StdAfx.h index 7bafa2a4323..0385023b5f0 100644 --- a/mozilla/webshell/embed/ActiveX/StdAfx.h +++ b/mozilla/webshell/embed/ActiveX/StdAfx.h @@ -67,6 +67,9 @@ typedef long int32; #include "prprf.h" #include "plevent.h" #include "nsRepository.h" +#include "nsIServiceManager.h" +#include "nsIEventQueueService.h" +#include "nsXPComCIID.h" #include "nsWidgetsCID.h" #include "nsGfxCIID.h" #include "nsViewsCID.h"