*not part of the build*

fix for 78288


git-svn-id: svn://10.0.0.236/trunk@93515 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
idk%eng.sun.com
2001-05-01 03:10:03 +00:00
parent e57614fecf
commit c4a18d0110
2 changed files with 32 additions and 7 deletions

View File

@@ -22,20 +22,42 @@
#include "ORB.h"
#include "Call.h"
#include "nsHashtable.h"
class bcOIDKey : public nsHashKey {
protected:
bcOID key;
public:
bcOIDKey(bcOID oid) {
key = oid;
}
virtual ~bcOIDKey() {
}
PRUint32 HashCode(void) const {
return (PRUint32)key;
}
PRBool Equals(const nsHashKey *aKey) const {
return (key == ((const bcOIDKey *) aKey)->key);
}
nsHashKey *Clone() const {
return new bcOIDKey(key);
}
};
ORB::ORB() {
currentID = 1;
for (int i = 0; i < STUBS_COUNT; i++) {
stubs[i] = 0;
}
stubs = new nsHashtable(256,PR_TRUE);
}
ORB::~ORB() {
delete stubs;
}
bcOID ORB::RegisterStub(bcIStub *stub) {
stubs[currentID] = stub;
stubs->Put(new bcOIDKey(currentID),stub);
return currentID++;
}
@@ -58,7 +80,10 @@ int ORB::SendReceive(bcICall *call) {
}
bcIStub * ORB::GetStub(bcOID *oid) {
return stubs[*oid];
bcOIDKey *key = new bcOIDKey(*oid);
void *tmp = stubs->Get(key);
delete key;
return (bcIStub*)tmp;
}

View File

@@ -24,7 +24,7 @@
#define __ORB_h
#include "bcIORB.h"
#define STUBS_COUNT (50000)
class nsHashtable;
class ORB : public bcIORB {
public:
ORB();
@@ -34,7 +34,7 @@ public:
virtual int SendReceive(bcICall *);
private:
bcIStub * GetStub(bcOID *);
bcIStub * stubs[STUBS_COUNT]; //nb :) it's jast for now. (Mon Mar 13 16:53:03 PST 2000)
nsHashtable *stubs;
int currentID;
};
#endif