nsIChannel api change

git-svn-id: svn://10.0.0.236/trunk@37309 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
valeski%netscape.com 1999-06-29 01:54:05 +00:00
parent 863f107e7f
commit 268d31ffa8
3 changed files with 3 additions and 47 deletions

View File

@ -25,9 +25,7 @@
#else
#include "nsIIOService.h"
#include "nsIChannel.h"
#include "nsIEventQueueService.h"
static NS_DEFINE_CID(kIOServiceCID, NS_IOSERVICE_CID);
static NS_DEFINE_CID(kEventQueueServiceCID, NS_IEVENTQUEUESERVICE_CID);
#endif // NECKO
#include "nsString.h"
@ -208,10 +206,6 @@ PageGrabber::NextFile(const char* aExtension)
return cname;
}
#ifdef NECKO
static NS_DEFINE_CID(kEventQueueServiceCID, NS_EVENTQUEUESERVICE_CID);
#endif // NECKO
nsresult
PageGrabber::Grab(const nsString& aURL)
{
@ -253,18 +247,7 @@ PageGrabber::Grab(const nsString& aURL)
#ifndef NECKO
rv = url->Open(copier);
#else
nsIEventQueue *eventQ = nsnull;
NS_WITH_SERVICE(nsIEventQueueService, eqService, kEventQueueServiceCID, &rv);
if (NS_FAILED(rv)) return rv;
rv = eqService->CreateThreadEventQueue();
if (NS_FAILED(rv)) return rv;
rv = eqService->GetThreadEventQueue(PR_CurrentThread(), &eventQ);
if (NS_FAILED(rv)) return rv;
rv = channel->AsyncRead(0, -1, nsnull, eventQ, copier);
NS_RELEASE(eventQ);
rv = channel->AsyncRead(0, -1, nsnull, copier);
#endif // NECKO
if (NS_OK != rv) {

View File

@ -25,9 +25,7 @@
#else
#include "nsIIOService.h"
#include "nsIChannel.h"
#include "nsIEventQueueService.h"
static NS_DEFINE_CID(kIOServiceCID, NS_IOSERVICE_CID);
static NS_DEFINE_CID(kEventQueueServiceCID, NS_IEVENTQUEUESERVICE_CID);
#endif // NECKO
#include "nsString.h"
@ -208,10 +206,6 @@ PageGrabber::NextFile(const char* aExtension)
return cname;
}
#ifdef NECKO
static NS_DEFINE_CID(kEventQueueServiceCID, NS_EVENTQUEUESERVICE_CID);
#endif // NECKO
nsresult
PageGrabber::Grab(const nsString& aURL)
{
@ -253,18 +247,7 @@ PageGrabber::Grab(const nsString& aURL)
#ifndef NECKO
rv = url->Open(copier);
#else
nsIEventQueue *eventQ = nsnull;
NS_WITH_SERVICE(nsIEventQueueService, eqService, kEventQueueServiceCID, &rv);
if (NS_FAILED(rv)) return rv;
rv = eqService->CreateThreadEventQueue();
if (NS_FAILED(rv)) return rv;
rv = eqService->GetThreadEventQueue(PR_CurrentThread(), &eventQ);
if (NS_FAILED(rv)) return rv;
rv = channel->AsyncRead(0, -1, nsnull, eventQ, copier);
NS_RELEASE(eventQ);
rv = channel->AsyncRead(0, -1, nsnull, copier);
#endif // NECKO
if (NS_OK != rv) {

View File

@ -33,8 +33,6 @@
#include "nsIIOService.h"
#include "nsIChannel.h"
static NS_DEFINE_CID(kIOServiceCID, NS_IOSERVICE_CID);
#include "nsIEventQueueService.h"
static NS_DEFINE_CID(kEventQueueService, NS_EVENTQUEUESERVICE_CID);
#endif // NECKO
#include "nsIInputStream.h"
#include "nsIStreamListener.h"
@ -81,21 +79,13 @@ nsSoftwareUpdateListener::nsSoftwareUpdateListener(const nsString& fromURL, cons
NS_WITH_SERVICE(nsIIOService, service, kIOServiceCID, &rv);
if (NS_FAILED(rv)) return;
nsIEventQueue *eventQ = nsnull;
NS_WITH_SERVICE(nsIEventQueueService, eventQService, kEventQueueService, &rv);
if (NS_FAILED(rv)) return;
mResult = eventQService->GetThreadEventQueue(PR_CurrentThread(), &eventQ);
if (NS_FAILED(rv)) return;
// XXX NECKO verb? getter?
nsIChannel *channel = nsnull;
const char *urlStr = fromURL.GetBuffer();
rv = service->NewChannel("load", urlStr, nsnull, nsnull, &channel);
if (NS_FAILED(mResult)) return;
rv = channel->AsyncRead(0, -1, nsnull, eventQ, this);
NS_RELEASE(eventQ);
rv = channel->AsyncRead(0, -1, nsnull, this);
NS_RELEASE(channel);
mResult = rv;
return;