landing patch for bug 326273 "Implement nsIThreadManager" (Mac portions by Mark Mentovai) with reviews from bienvenu, bsmedberg, bzbarsky, josh, roc, and ssieb

git-svn-id: svn://10.0.0.236/trunk@196254 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
darin%meer.net
2006-05-10 17:30:15 +00:00
parent 489b71db67
commit 42edf059cf
375 changed files with 8634 additions and 15801 deletions

View File

@@ -39,6 +39,7 @@
#include "nsIURL.h"
#include "nsServiceManagerUtils.h"
#include "nsComponentManagerUtils.h"
#include "nsThreadUtils.h"
#include "nsNetCID.h"
#include "nsCOMPtr.h"
@@ -47,10 +48,6 @@
#include "nsILocalFile.h"
static NS_DEFINE_CID(kIOServiceCID, NS_IOSERVICE_CID);
#include "nsIEventQueueService.h"
static NS_DEFINE_CID(kEventQueueServiceCID, NS_EVENTQUEUESERVICE_CID);
static nsIEventQueue* gEventQ = nsnull;
#include "nsStringAPI.h"
#include "nsCRT.h"
#include "prprf.h"
@@ -220,14 +217,7 @@ nsresult
PageGrabber::Grab(const nsCString& aURL)
{
nsresult rv;
// Create the Event Queue for this thread...
// Unix needs this
nsCOMPtr<nsIEventQueueService> eventQService =
do_GetService(kEventQueueServiceCID, &rv);
if (NS_FAILED(rv)) return rv;
eventQService->GetThreadEventQueue(NS_CURRENT_THREAD, &gEventQ);
nsCOMPtr<nsILocalFile> file = NextFile("html");
if (!file) {
return NS_ERROR_OUT_OF_MEMORY;
@@ -270,10 +260,10 @@ PageGrabber::Grab(const nsCString& aURL)
}
// Enter the message pump to allow the URL load to proceed.
nsCOMPtr<nsIThread> thread = do_GetCurrentThread();
while ( !copier->IsDone() ) {
PLEvent *gEvent;
gEventQ->WaitForEvent(&gEvent);
gEventQ->HandleEvent(gEvent);
if (!NS_ProcessNextEvent(thread))
break;
}
rv = copier->HaveError() ? NS_ERROR_FAILURE : NS_OK;