зеркало из https://github.com/mozilla/gecko-dev.git
Fixed up all the IIDs to be new/unique. Made nsFileTransport work (needs tuned).
This commit is contained in:
Родитель
759e5cc63f
Коммит
f3f777441d
|
@ -21,13 +21,12 @@
|
|||
|
||||
#include "nsISupports.h"
|
||||
|
||||
// XXX regenerate:
|
||||
#define NS_ICANCELABLE_IID \
|
||||
{ /* 677d9a90-93ee-11d2-816a-006008119d7a */ \
|
||||
0x677d9a90, \
|
||||
0x93ee, \
|
||||
{ /* 077437d0-ea35-11d2-931b-00104ba0fd40 */ \
|
||||
0x077437d0, \
|
||||
0xea35, \
|
||||
0x11d2, \
|
||||
{0x81, 0x6a, 0x00, 0x6f, 0xc8, 0x11, 0x9d, 0x7a} \
|
||||
{0x93, 0x1b, 0x00, 0x10, 0x4b, 0xa0, 0xfd, 0x40} \
|
||||
}
|
||||
|
||||
class nsICancelable : public nsISupports
|
||||
|
|
|
@ -24,13 +24,12 @@
|
|||
|
||||
class nsIProtocolConnection;
|
||||
|
||||
// XXX regenerate:
|
||||
#define NS_ICONNECTIONGROUP_IID \
|
||||
{ /* 677d9a90-93ee-11d2-816a-006008119d7a */ \
|
||||
0x677d9a90, \
|
||||
0x93ee, \
|
||||
{ /* 163290f0-ea35-11d2-931b-00104ba0fd40 */ \
|
||||
0x163290f0, \
|
||||
0xea35, \
|
||||
0x11d2, \
|
||||
{0x81, 0x6a, 0x00, 0x6f, 0xc8, 0x11, 0x9d, 0x7a} \
|
||||
{0x93, 0x1b, 0x00, 0x10, 0x4b, 0xa0, 0xfd, 0x40} \
|
||||
}
|
||||
|
||||
class nsIConnectionGroup : public nsICancelable, public nsICollection
|
||||
|
|
|
@ -27,22 +27,20 @@ class nsIStreamListener;
|
|||
class nsIProtocolConnection;
|
||||
class nsITransport;
|
||||
|
||||
// XXX regenerate:
|
||||
#define NS_IFILETRANSPORTSERVICE_IID \
|
||||
{ /* 677d9a90-93ee-11d2-816a-006008119d7a */ \
|
||||
0x677d9a90, \
|
||||
0x93ee, \
|
||||
{ /* 2355dca0-ea35-11d2-931b-00104ba0fd40 */ \
|
||||
0x2355dca0, \
|
||||
0xea35, \
|
||||
0x11d2, \
|
||||
{0x81, 0x6a, 0x00, 0x60, 0xf8, 0x12, 0x9d, 0x7a} \
|
||||
{0x93, 0x1b, 0x00, 0x10, 0x4b, 0xa0, 0xfd, 0x40} \
|
||||
}
|
||||
|
||||
// XXX regenerate:
|
||||
#define NS_FILETRANSPORTSERVICE_CID \
|
||||
{ /* 677d9a90-93ee-11d2-816a-006008119d7a */ \
|
||||
0x677d9a90, \
|
||||
0x93ee, \
|
||||
{ /* 2bb2b250-ea35-11d2-931b-00104ba0fd40 */ \
|
||||
0x2bb2b250, \
|
||||
0xea35, \
|
||||
0x11d2, \
|
||||
{0x81, 0x6a, 0x00, 0x60, 0xf8, 0x32, 0x9d, 0x7a} \
|
||||
{0x93, 0x1b, 0x00, 0x10, 0x4b, 0xa0, 0xfd, 0x40} \
|
||||
}
|
||||
|
||||
class nsIFileTransportService : public nsISupports
|
||||
|
|
|
@ -26,22 +26,20 @@ class nsIProtocolConnection;
|
|||
class nsIConnectionGroup;
|
||||
class nsIProtocolHandler;
|
||||
|
||||
// XXX regenerate:
|
||||
#define NS_INETSERVICE_IID \
|
||||
{ /* 677d9a90-93ee-11d2-816a-006008119d7a */ \
|
||||
0x677d9a90, \
|
||||
0x93ee, \
|
||||
{ /* 3c70f340-ea35-11d2-931b-00104ba0fd40 */ \
|
||||
0x3c70f340, \
|
||||
0xea35, \
|
||||
0x11d2, \
|
||||
{0x81, 0x6a, 0x00, 0x60, 0xc8, 0x11, 0x9d, 0x7a} \
|
||||
{0x93, 0x1b, 0x00, 0x10, 0x4b, 0xa0, 0xfd, 0x40} \
|
||||
}
|
||||
|
||||
// XXX regenerate:
|
||||
#define NS_NETSERVICE_CID \
|
||||
{ /* 677d9a90-93ee-11d2-816a-006008119d7a */ \
|
||||
0x677d9a90, \
|
||||
0x93ee, \
|
||||
{ /* 451ec5e0-ea35-11d2-931b-00104ba0fd40 */ \
|
||||
0x451ec5e0, \
|
||||
0xea35, \
|
||||
0x11d2, \
|
||||
{0x81, 0x6a, 0x01, 0x60, 0xc8, 0x11, 0x9d, 0x7a} \
|
||||
{0x93, 0x1b, 0x00, 0x10, 0x4b, 0xa0, 0xfd, 0x40} \
|
||||
}
|
||||
|
||||
class nsINetService : public nsISupports
|
||||
|
|
|
@ -25,13 +25,12 @@ class nsIUrl;
|
|||
class nsIInputStream;
|
||||
class nsIOutputStream;
|
||||
|
||||
// XXX regenerate:
|
||||
#define NS_IPROTOCOLCONNECTION_IID \
|
||||
{ /* 677d9a90-93ee-11d2-816a-006008119d7a */ \
|
||||
0x677d9a90, \
|
||||
0x93ee, \
|
||||
{ /* 4ec29db0-ea35-11d2-931b-00104ba0fd40 */ \
|
||||
0x4ec29db0, \
|
||||
0xea35, \
|
||||
0x11d2, \
|
||||
{0x81, 0x6a, 0x00, 0x60, 0xb8, 0x11, 0x9d, 0x7a} \
|
||||
{0x93, 0x1b, 0x00, 0x10, 0x4b, 0xa0, 0xfd, 0x40} \
|
||||
}
|
||||
|
||||
class nsIProtocolConnection : public nsICancelable
|
||||
|
|
|
@ -23,13 +23,12 @@
|
|||
|
||||
class nsIConnectionGroup;
|
||||
|
||||
// XXX regenerate:
|
||||
#define NS_IPROTOCOLHANDLER_IID \
|
||||
{ /* 677d9a90-93ee-11d2-816a-006008119d7a */ \
|
||||
0x677d9a90, \
|
||||
0x93ee, \
|
||||
{ /* 5da8b1b0-ea35-11d2-931b-00104ba0fd40 */ \
|
||||
0x5da8b1b0, \
|
||||
0xea35, \
|
||||
0x11d2, \
|
||||
{0x81, 0x6a, 0x00, 0x60, 0xa8, 0x11, 0x9d, 0x7a} \
|
||||
{0x93, 0x1b, 0x00, 0x10, 0x4b, 0xa0, 0xfd, 0x40} \
|
||||
}
|
||||
|
||||
class nsIProtocolHandler : public nsISupports
|
||||
|
|
|
@ -28,13 +28,12 @@ class nsIInputStream;
|
|||
class nsIProtocolConnection;
|
||||
class nsIString;
|
||||
|
||||
// XXX regenerate:
|
||||
#define NS_ISTREAMLISTENER_IID \
|
||||
{ /* 677d9a90-93ee-11d2-816a-006008119d7a */ \
|
||||
0x677d9a90, \
|
||||
0x93ee, \
|
||||
{ /* 68d9d640-ea35-11d2-931b-00104ba0fd40 */ \
|
||||
0x68d9d640, \
|
||||
0xea35, \
|
||||
0x11d2, \
|
||||
{0x81, 0x6a, 0x00, 0x60, 0x09, 0x11, 0x9d, 0x7a} \
|
||||
{0x93, 0x1b, 0x00, 0x10, 0x4b, 0xa0, 0xfd, 0x40} \
|
||||
}
|
||||
|
||||
class nsIStreamListener : public nsISupports
|
||||
|
@ -82,11 +81,14 @@ public:
|
|||
|
||||
};
|
||||
|
||||
/* Generic status codes for OnStopBinding */
|
||||
// Generic status codes for OnStopBinding:
|
||||
#define NS_BINDING_SUCCEEDED NS_OK
|
||||
#define NS_BINDING_FAILED NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_NETWORK, 1)
|
||||
#define NS_BINDING_ABORTED NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_NETWORK, 2)
|
||||
|
||||
// A marshaling stream listener is used to ship data over to another thread specified
|
||||
// by the thread's event queue. The receiver stream listener is then used to receive
|
||||
// the data on the other thread.
|
||||
extern nsresult
|
||||
NS_NewMarshalingStreamListener(PLEventQueue* eventQueue,
|
||||
nsIStreamListener* receiver,
|
||||
|
|
|
@ -24,13 +24,12 @@
|
|||
class nsIStreamListener;
|
||||
class nsIStreamObserver;
|
||||
|
||||
// XXX regenerate:
|
||||
#define NS_ITRANSPORT_IID \
|
||||
{ /* 677d9a90-93ee-11d2-816a-006008119d7a */ \
|
||||
0x677d9a90, \
|
||||
0x93ee, \
|
||||
{ /* 7aa38100-ea35-11d2-931b-00104ba0fd40 */ \
|
||||
0x7aa38100, \
|
||||
0xea35, \
|
||||
0x11d2, \
|
||||
{0x81, 0x6a, 0x00, 0x60, 0xe8, 0x11, 0x9d, 0x7a} \
|
||||
{0x93, 0x1b, 0x00, 0x10, 0x4b, 0xa0, 0xfd, 0x40} \
|
||||
}
|
||||
|
||||
class nsITransport : public nsICancelable
|
||||
|
|
|
@ -23,13 +23,12 @@
|
|||
|
||||
#undef GetPort // Windows (sigh)
|
||||
|
||||
// XXX regenerate:
|
||||
#define NS_IURL_IID \
|
||||
{ /* 677d9a90-93ee-11d2-816a-006008119d7a */ \
|
||||
0x677d9a90, \
|
||||
0x93ee, \
|
||||
{ /* 82c1b000-ea35-11d2-931b-00104ba0fd40 */ \
|
||||
0x82c1b000, \
|
||||
0xea35, \
|
||||
0x11d2, \
|
||||
{0x81, 0x6a, 0x00, 0x60, 0xf8, 0x11, 0x9d, 0x7a} \
|
||||
{0x93, 0x1b, 0x00, 0x10, 0x4b, 0xa0, 0xfd, 0x40} \
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -22,6 +22,9 @@
|
|||
#include "nsIProtocolConnection.h"
|
||||
#include "nsCRT.h"
|
||||
#include "nscore.h"
|
||||
#include "nsIFileStream.h"
|
||||
#include "nsFileSpec.h"
|
||||
#include "nsIByteBuffer.h"
|
||||
|
||||
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
|
||||
|
||||
|
@ -109,53 +112,61 @@ nsFileTransport::Resume(void)
|
|||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
nsresult
|
||||
nsFileTransport::OnStartBinding()
|
||||
{
|
||||
return mListener->OnStartBinding(mConnection);
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsFileTransport::OnDataAvailable(nsIInputStream* stream, PRUint32 count)
|
||||
{
|
||||
return mListener->OnDataAvailable(mConnection, stream, count);
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsFileTransport::OnStopBinding(nsresult status, nsIString* msg)
|
||||
{
|
||||
return mListener->OnStopBinding(mConnection, status, msg);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFileTransport::Run(void)
|
||||
{
|
||||
nsresult rv;
|
||||
#if 0
|
||||
nsISupports* fs;
|
||||
nsIInputStream* inStr;
|
||||
nsFileSpec spec(mPath);
|
||||
PRUint32 count;
|
||||
nsIInputStream* fileStr = nsnull;
|
||||
nsIByteBuffer* buf = nsnull;
|
||||
nsIInputStream* inStr = nsnull;
|
||||
|
||||
request->OnStartBinding(mConnection); // always send the start notification
|
||||
rv = mListener->OnStartBinding(mConnection); // always send the start notification
|
||||
|
||||
rv = NS_NewTypicalInputFileStream(&fs, request->mSpec);
|
||||
rv = NS_NewTypicalInputFileStream(&fs, spec);
|
||||
if (NS_FAILED(rv)) goto done;
|
||||
rv = fs->QueryInterface(nsIInputStream::GetIID(), (void**)&inStr);
|
||||
rv = fs->QueryInterface(nsIInputStream::GetIID(), (void**)&fileStr);
|
||||
NS_RELEASE(fs);
|
||||
if (NS_FAILED(rv)) goto done;
|
||||
|
||||
while (PR_TRUE) {
|
||||
if (request->IsCanceled()) {
|
||||
rv = NS_USER_CANCELED;
|
||||
rv = NS_NewByteBuffer(&buf, nsnull, NS_FILE_TRANSPORT_BUFFER_SIZE);
|
||||
if (NS_FAILED(rv)) goto done;
|
||||
|
||||
rv = NS_NewByteBufferInputStream(buf, &inStr);
|
||||
if (NS_FAILED(rv)) goto done;
|
||||
|
||||
rv = fileStr->GetLength(&count);
|
||||
if (NS_FAILED(rv)) goto done;
|
||||
|
||||
while (count > 0) {
|
||||
// check if the user canceled:
|
||||
if (mCanceled) {
|
||||
rv = NS_BINDING_ABORTED;
|
||||
break;
|
||||
}
|
||||
request->OnDataAvailable(mConnection, inStr, count);
|
||||
|
||||
// reuse the buffer each time around
|
||||
PRUint32 amt = PR_MIN(NS_FILE_TRANSPORT_BUFFER_SIZE, count);
|
||||
PRInt32 filledAmt = buf->Fill(&rv, fileStr, 0);
|
||||
if (NS_FAILED(rv)) goto done;
|
||||
|
||||
// and feed the buffer to the application via the byte buffer stream:
|
||||
rv = mListener->OnDataAvailable(mConnection, inStr, count);
|
||||
if (NS_FAILED(rv)) goto done;
|
||||
|
||||
count -= filledAmt;
|
||||
}
|
||||
|
||||
done:
|
||||
request->OnStopBinding(mConnection, rv, msg);
|
||||
NS_RELEASE(inStr);
|
||||
#endif
|
||||
inStr->Close();
|
||||
NS_IF_RELEASE(buf);
|
||||
NS_IF_RELEASE(inStr);
|
||||
NS_IF_RELEASE(fileStr);
|
||||
|
||||
// XXX where do we get the error message?
|
||||
rv = mListener->OnStopBinding(mConnection, rv, nsnull);
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
|
|
@ -51,11 +51,6 @@ public:
|
|||
nsIStreamListener* listener,
|
||||
PLEventQueue* appEventQueue,
|
||||
nsIProtocolConnection* connection);
|
||||
PRBool IsCanceled() { return mCanceled; }
|
||||
|
||||
nsresult OnStartBinding();
|
||||
nsresult OnDataAvailable(nsIInputStream* stream, PRUint32 count);
|
||||
nsresult OnStopBinding(nsresult status, nsIString* msg);
|
||||
|
||||
protected:
|
||||
nsIProtocolConnection* mConnection;
|
||||
|
@ -65,4 +60,6 @@ protected:
|
|||
|
||||
};
|
||||
|
||||
#define NS_FILE_TRANSPORT_BUFFER_SIZE (4*1024)
|
||||
|
||||
#endif /* nsFileTransport_h___ */
|
||||
|
|
|
@ -25,13 +25,6 @@
|
|||
#include "nscore.h"
|
||||
#include "plevent.h"
|
||||
|
||||
class nsIStreamObserver;
|
||||
class nsIStreamListener;
|
||||
class nsITransport;
|
||||
class nsFileTransport;
|
||||
class nsFileTransportService;
|
||||
class nsIProtocolConnection;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#define NS_FILE_TRANSPORT_WORKER_COUNT 4
|
||||
|
|
|
@ -39,7 +39,7 @@ public:
|
|||
// nsMarshalingStreamListener methods:
|
||||
nsMarshalingStreamListener(PLEventQueue* eventQueue,
|
||||
nsIStreamListener* receiver)
|
||||
: mEventQueue(eventQueue), mReceiver(receiver) {
|
||||
: mEventQueue(eventQueue), mReceiver(receiver), mStatus(NS_OK) {
|
||||
NS_INIT_REFCNT();
|
||||
}
|
||||
virtual ~nsMarshalingStreamListener();
|
||||
|
@ -263,14 +263,14 @@ protected:
|
|||
|
||||
nsOnStopBindingEvent::~nsOnStopBindingEvent()
|
||||
{
|
||||
NS_RELEASE(mMessage);
|
||||
NS_IF_RELEASE(mMessage);
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsOnStopBindingEvent::Init(nsresult status, nsIString* aMsg)
|
||||
{
|
||||
mMessage = aMsg;
|
||||
NS_ADDREF(mMessage);
|
||||
NS_IF_ADDREF(mMessage);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -22,10 +22,10 @@
|
|||
#include "nscore.h"
|
||||
#include "nsString2.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsITransportService.h"
|
||||
#include "nsIFileTransportService.h"
|
||||
#include "nsConnectionGroup.h"
|
||||
|
||||
static NS_DEFINE_CID(kTransportService, NS_TRANSPORTSERVICE_CID);
|
||||
static NS_DEFINE_CID(kFileTransportService, NS_FILETRANSPORTSERVICE_CID);
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
@ -124,11 +124,15 @@ nsNetService::Open(nsIUrl* url, nsISupports* eventSink,
|
|||
NS_IMETHODIMP
|
||||
nsNetService::HasActiveConnections()
|
||||
{
|
||||
#if 0
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsITransportService, trans, kTransportService, &rv);
|
||||
NS_WITH_SERVICE(nsIFileTransportService, trans, kFileTransportService, &rv);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
return trans->HasActiveTransports();
|
||||
#else
|
||||
return NS_OK;
|
||||
#endif
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -25,13 +25,12 @@
|
|||
|
||||
class nsIUrl;
|
||||
|
||||
// XXX regenerate:
|
||||
#define NS_IHTTPLISTENER_IID \
|
||||
{ /* 677d9a90-93ee-11d2-816a-006008119d7a */ \
|
||||
0x677d9a90, \
|
||||
0x93ee, \
|
||||
{ /* a831c800-ea35-11d2-931b-00104ba0fd40 */ \
|
||||
0xa831c800, \
|
||||
0xea35, \
|
||||
0x11d2, \
|
||||
{0x85, 0x6a, 0x00, 0x60, 0xb8, 0x11, 0x9d, 0x7a} \
|
||||
{0x93, 0x1b, 0x00, 0x10, 0x4b, 0xa0, 0xfd, 0x40} \
|
||||
}
|
||||
|
||||
class nsIHttpListener : public nsIHttpObserver
|
||||
|
|
|
@ -25,13 +25,12 @@
|
|||
|
||||
class nsIUrl;
|
||||
|
||||
// XXX regenerate:
|
||||
#define NS_IHTTPOBSERVER_IID \
|
||||
{ /* 677d9a90-93ee-11d2-816a-006008119d7a */ \
|
||||
0x677d9a90, \
|
||||
0x93ee, \
|
||||
{ /* b297b0a0-ea35-11d2-931b-00104ba0fd40 */ \
|
||||
0xb297b0a0, \
|
||||
0xea35, \
|
||||
0x11d2, \
|
||||
{0x85, 0x6a, 0x00, 0x60, 0xb8, 0x11, 0x9d, 0x7a} \
|
||||
{0x93, 0x1b, 0x00, 0x10, 0x4b, 0xa0, 0xfd, 0x40} \
|
||||
}
|
||||
|
||||
class nsIHttpObserver : public nsISupports
|
||||
|
|
|
@ -21,13 +21,12 @@
|
|||
|
||||
#include "nsIProtocolConnection.h"
|
||||
|
||||
// XXX regenerate:
|
||||
#define NS_IHTTPPROTOCOLCONNECTION_IID \
|
||||
{ /* 677d9a90-93ee-11d2-816a-006008119d7a */ \
|
||||
0x677d9a90, \
|
||||
0x93ee, \
|
||||
{ /* bd88a750-ea35-11d2-931b-00104ba0fd40 */ \
|
||||
0xbd88a750, \
|
||||
0xea35, \
|
||||
0x11d2, \
|
||||
{0x83, 0x6a, 0x00, 0x60, 0xb8, 0x11, 0x9d, 0x7a} \
|
||||
{0x93, 0x1b, 0x00, 0x10, 0x4b, 0xa0, 0xfd, 0x40} \
|
||||
}
|
||||
|
||||
class nsIHttpProtocolConnection : public nsIProtocolConnection
|
||||
|
|
|
@ -21,13 +21,12 @@
|
|||
|
||||
#include "nsIProtocolHandler.h"
|
||||
|
||||
// XXX regenerate:
|
||||
#define NS_IHTTPPROTOCOLHANDLER_IID \
|
||||
{ /* 677d9a90-93ee-11d2-816a-006008119d7a */ \
|
||||
0x677d9a90, \
|
||||
0x93ee, \
|
||||
{ /* c7a0a160-ea35-11d2-931b-00104ba0fd40 */ \
|
||||
0xc7a0a160, \
|
||||
0xea35, \
|
||||
0x11d2, \
|
||||
{0x86, 0x6a, 0x00, 0x60, 0xb8, 0x11, 0x9d, 0x7a} \
|
||||
{0x93, 0x1b, 0x00, 0x10, 0x4b, 0xa0, 0xfd, 0x40} \
|
||||
}
|
||||
|
||||
class nsIHttpProtocolHandler : public nsIProtocolHandler
|
||||
|
|
Загрузка…
Ссылка в новой задаче