ipcDConnectService.h revision 677833bc953b6cb418c701facbdcf4aa18d6c44e
/* vim:set ts=2 sw=2 et cindent: */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Mozilla IPC.
*
* The Initial Developer of the Original Code is IBM Corporation.
* Portions created by the Initial Developer are Copyright (C) 2004
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Darin Fisher <darin@meer.net>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
// DConnect service is multithreaded by default...
#if !defined(DCONNECT_SINGLETHREADED) && !defined(DCONNECT_MULTITHREADED)
#define DCONNECT_MULTITHREADED
#endif
#include "ipcIDConnectService.h"
#include "ipcdclient.h"
#include "nsIInterfaceInfo.h"
#include "nsIInterfaceInfoManager.h"
#include "nsCOMPtr.h"
#include "nsAutoPtr.h"
#include "nsDataHashtable.h"
#include "nsHashKeys.h"
#include "nsHashSets.h"
#include "nsVoidArray.h"
#include "nsAutoLock.h"
#include "xptcall.h"
#include "xptinfo.h"
#if defined(DCONNECT_MULTITHREADED)
#include "ipcList.h"
struct DConnectOp;
{
{
}
const DConnectOp *op;
};
#endif
// a key class used to identify DConnectInstance objects stored in a hash table
// by a composite of peer ID, XPCOM object pointer and IID this pointer represents
{
struct Key
{
const nsISupports *mObj;
};
typedef const Key *KeyTypePointer;
~DConnectInstanceKey() {}
}
}
enum { ALLOW_MEMMOVE = PR_TRUE };
};
// extend nsVoidHashSet for compatibility with some nsTHashtable methods
{
}
void Clear() {
}
};
// a key class used to identify DConnectStub objects stored in a hash table
// by a composite of peer ID and DConAddr
{
struct Key
{
};
typedef const Key *KeyTypePointer;
~DConnectStubKey() {}
}
}
enum { ALLOW_MEMMOVE = PR_TRUE };
};
{
NS_HIDDEN_(void) Shutdown();
const nsXPTMethodInfo *methodInfo,
const nsXPTParamInfo ¶mInfo,
// public only for DConnectStub::~DConnectStub()
// public only for DConnectInstance::Release()
// public only for DConnectStub::CallMethod()
}
const nsISupports *,
const nsIID *,
DConnectInstance **);
#if defined(DCONNECT_MULTITHREADED)
#endif
// lock to protect access to instance and stub sets and the disconnected flag
// table of local object instances allocated on behalf of a peer
// (keys are interface pointers of real objects these instances represent)
// hashset containing the same instances as above
// (used for quick parameter validity checks)
// table of remote object stubs allocated to communicate with peer's instances
// this is true after IPC_Shutdown() has been called
// our IPC client ID
// global lock to protect access to DConnectStub internal data
#if defined(DCONNECT_MULTITHREADED)
// pool of worker threads to serve incoming requests
// queue of pending requests
// monitor to protect mPendingQ
// number of waiting workers
// monitor used to wait on changes in mWaitingWorkers.
#endif
// global ipcDConnectService instance for internal usage
static ipcDConnectService *mInstance;
};
#define IPC_DCONNECTSERVICE_CLASSNAME \
"ipcDConnectService"
#define IPC_DCONNECTSERVICE_CONTRACTID \
#define IPC_DCONNECTSERVICE_CID \
{ /* 63a5d9dc-4828-425a-bd50-bd10a4b26f2c */ \
0x63a5d9dc, \
0x4828, \
0x425a, \
{0xbd, 0x50, 0xbd, 0x10, 0xa4, 0xb2, 0x6f, 0x2c} \
}