diff --git a/netwerk/base/public/nsIFileTransportService.idl b/netwerk/base/public/nsIFileTransportService.idl new file mode 100644 index 000000000000..50f88640f032 --- /dev/null +++ b/netwerk/base/public/nsIFileTransportService.idl @@ -0,0 +1,58 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * + * The contents of this file are subject to the Netscape Public License + * Version 1.0 (the "NPL"); you may not use this file except in + * compliance with the NPL. You may obtain a copy of the NPL at + * http://www.mozilla.org/NPL/ + * + * Software distributed under the NPL is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL + * for the specific language governing rights and limitations under the + * NPL. + * + * The Initial Developer of this code under the NPL is Netscape + * Communications Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All Rights + * Reserved. + */ + +#include "nsISupports.idl" +%{C++ +#include "nsFileSpec.h" +%} + +interface nsIChannel; +interface nsIEventSinkGetter; +interface nsIInputStream; +interface nsIRunnable; +native nsFileSpec(nsFileSpec&); + +[scriptable, uuid(d4ced500-6882-11d3-9382-00104ba0fd40)] +interface nsIFileTransportService : nsISupports +{ + [noscript] nsIChannel CreateTransport(in nsFileSpec spec, // XXX change to nsIFile later + in string command, + in nsIEventSinkGetter getter); + + // This version can be used with an existing input stream to serve + // as a data pump: + nsIChannel CreateTransportFromStream(in nsIInputStream fromStream, + in string command, + in nsIEventSinkGetter getter); + + void DispatchRequest(in nsIRunnable runnable); + void Suspend(in nsIRunnable trans); + void Resume(in nsIRunnable trans); + void ProcessPendingRequests(); + void Shutdown(); +}; + +%{C++ +#define NS_FILETRANSPORTSERVICE_CID \ +{ /* 2bb2b250-ea35-11d2-931b-00104ba0fd40 */ \ + 0x2bb2b250, \ + 0xea35, \ + 0x11d2, \ + {0x93, 0x1b, 0x00, 0x10, 0x4b, 0xa0, 0xfd, 0x40} \ +} +%} diff --git a/netwerk/base/public/nsISocketTransportService.idl b/netwerk/base/public/nsISocketTransportService.idl new file mode 100644 index 000000000000..163407b3d7cb --- /dev/null +++ b/netwerk/base/public/nsISocketTransportService.idl @@ -0,0 +1,42 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * + * The contents of this file are subject to the Netscape Public License + * Version 1.0 (the "NPL"); you may not use this file except in + * compliance with the NPL. You may obtain a copy of the NPL at + * http://www.mozilla.org/NPL/ + * + * Software distributed under the NPL is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL + * for the specific language governing rights and limitations under the + * NPL. + * + * The Initial Developer of this code under the NPL is Netscape + * Communications Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All Rights + * Reserved. + */ + +#include "nsISupports.idl" + +interface nsIChannel; + +[scriptable, uuid(05331390-6884-11d3-9382-00104ba0fd40)] +interface nsISocketTransportService : nsISupports +{ + nsIChannel CreateTransport(in string host, + in long port); + nsIChannel CreateTransportOfType(in string socketType, + in string host, + in long port); + void Shutdown(); +}; + +%{C++ +#define NS_SOCKETTRANSPORTSERVICE_CID \ +{ /* c07e81e0-ef12-11d2-92b6-00105a1b0d64 */ \ + 0xc07e81e0, \ + 0xef12, \ + 0x11d2, \ + {0x92, 0xb6, 0x00, 0x10, 0x5a, 0x1b, 0x0d, 0x64} \ +} +%} diff --git a/xpcom/threads/nsIRunnable.idl b/xpcom/threads/nsIRunnable.idl new file mode 100644 index 000000000000..c1b2a7ad2346 --- /dev/null +++ b/xpcom/threads/nsIRunnable.idl @@ -0,0 +1,25 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * The contents of this file are subject to the Netscape Public License + * Version 1.0 (the "NPL"); you may not use this file except in + * compliance with the NPL. You may obtain a copy of the NPL at + * http://www.mozilla.org/NPL/ + * + * Software distributed under the NPL is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL + * for the specific language governing rights and limitations under the + * NPL. + * + * The Initial Developer of this code under the NPL is Netscape + * Communications Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All Rights + * Reserved. + */ + +#include "nsISupports.idl" + +[scriptable, uuid(4a2abaf0-6886-11d3-9382-00104ba0fd40)] +interface nsIRunnable : nsISupports +{ + void Run(); +}; diff --git a/xpcom/threads/nsIThread.idl b/xpcom/threads/nsIThread.idl new file mode 100644 index 000000000000..b40701452d4f --- /dev/null +++ b/xpcom/threads/nsIThread.idl @@ -0,0 +1,67 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * The contents of this file are subject to the Netscape Public License + * Version 1.0 (the "NPL"); you may not use this file except in + * compliance with the NPL. You may obtain a copy of the NPL at + * http://www.mozilla.org/NPL/ + * + * Software distributed under the NPL is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL + * for the specific language governing rights and limitations under the + * NPL. + * + * The Initial Developer of this code under the NPL is Netscape + * Communications Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All Rights + * Reserved. + */ + +#include "nsISupports.idl" +%{C++ +#include "prthread.h" +%} + +interface nsIRunnable; + +native PRThreadPriority(PRThreadPriority); +native PRThreadScope(PRThreadScope); +native PRThreadState(PRThreadState); +[ptr] native PRThread(PRThread); + +[scriptable, uuid(6be5e380-6886-11d3-9382-00104ba0fd40)] +interface nsIThread : nsISupports +{ + void Join(); + void Interrupt(); + attribute PRThreadPriority Priority; + readonly attribute PRThreadScope Scope; + readonly attribute PRThreadState State; + [noscript] PRThread GetPRThread(); + +%{C++ + // returns the nsIThread for the current thread: + static NS_COM nsresult GetCurrent(nsIThread* *result); + + // returns the nsIThread for an arbitrary PRThread: + static NS_COM nsresult GetIThread(PRThread* prthread, nsIThread* *result); + + // initializes the "main" thread (really, just saves the current thread + // at time of calling. meant to be called once at app startup, in lieu + // of proper static initializers, to save the primordial thread + // for later recall.) + static NS_COM nsresult SetMainThread(); + + // return the "main" thread + static NS_COM nsresult GetMainThread(nsIThread **result); +%} +}; + +%{C++ +extern NS_COM nsresult +NS_NewThread(nsIThread* *result, + nsIRunnable* runnable, + PRUint32 stackSize = 0, + PRThreadPriority priority = PR_PRIORITY_NORMAL, + PRThreadScope scope = PR_GLOBAL_THREAD, + PRThreadState state = PR_JOINABLE_THREAD); +%} diff --git a/xpcom/threads/nsIThreadPool.idl b/xpcom/threads/nsIThreadPool.idl new file mode 100644 index 000000000000..568ef0efa29f --- /dev/null +++ b/xpcom/threads/nsIThreadPool.idl @@ -0,0 +1,41 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * The contents of this file are subject to the Netscape Public License + * Version 1.0 (the "NPL"); you may not use this file except in + * compliance with the NPL. You may obtain a copy of the NPL at + * http://www.mozilla.org/NPL/ + * + * Software distributed under the NPL is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL + * for the specific language governing rights and limitations under the + * NPL. + * + * The Initial Developer of this code under the NPL is Netscape + * Communications Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All Rights + * Reserved. + */ + +#include "nsISupports.idl" +%{C++ +#include "prthread.h" +%} + +interface nsIRunnable; + +[scriptable, uuid(0c728db0-6887-11d3-9382-00104ba0fd40)] +interface nsIThreadPool : nsISupports +{ + void DispatchRequest(in nsIRunnable runnable); + void ProcessPendingRequests(); + void Shutdown(); +}; + +%{C++ +extern NS_COM nsresult +NS_NewThreadPool(nsIThreadPool* *result, + PRUint32 minThreads, PRUint32 maxThreads, + PRUint32 stackSize = 0, + PRThreadPriority priority = PR_PRIORITY_NORMAL, + PRThreadScope scope = PR_GLOBAL_THREAD); +%}