From 386b829e9b92a5520251c2a6ec4f5a62565bd637 Mon Sep 17 00:00:00 2001 From: "idk%eng.sun.com" Date: Fri, 4 May 2001 08:45:12 +0000 Subject: [PATCH] *not part of the build* fixes for 78866 and 78865 --- java/xpcom/connect/public/bcIORB.h | 1 + java/xpcom/connect/src/ORB.cpp | 29 ++++++++++++++++++++++++++--- java/xpcom/connect/src/ORB.h | 4 +++- 3 files changed, 30 insertions(+), 4 deletions(-) diff --git a/java/xpcom/connect/public/bcIORB.h b/java/xpcom/connect/public/bcIORB.h index a153386b115b..29fc2b3132f2 100644 --- a/java/xpcom/connect/public/bcIORB.h +++ b/java/xpcom/connect/public/bcIORB.h @@ -30,6 +30,7 @@ class bcIORB { public: virtual bcOID RegisterStub(bcIStub *stub) = 0; + virtual void RegisterStubWithOID(bcIStub *stub, bcOID *oid) = 0; virtual bcICall * CreateCall(bcIID *, bcOID *, bcMID) = 0; virtual int SendReceive(bcICall *) = 0; //virtual IThread * GetThread(TID) = 0; diff --git a/java/xpcom/connect/src/ORB.cpp b/java/xpcom/connect/src/ORB.cpp index ca632c78ebbf..f3b7c662cbd8 100644 --- a/java/xpcom/connect/src/ORB.cpp +++ b/java/xpcom/connect/src/ORB.cpp @@ -24,7 +24,6 @@ #include "Call.h" #include "nsHashtable.h" - class bcOIDKey : public nsHashKey { protected: bcOID key; @@ -57,8 +56,14 @@ ORB::~ORB() { } bcOID ORB::RegisterStub(bcIStub *stub) { - stubs->Put(new bcOIDKey(currentID),stub); - return currentID++; + bcOID oid = GenerateOID(); + stubs->Put(new bcOIDKey(oid),stub); + return oid; +} + +void ORB:: RegisterStubWithOID(bcIStub *stub, bcOID *oid) { + stubs->Put(new bcOIDKey(*oid),stub); + return; } bcICall * ORB::CreateCall(bcIID *iid, bcOID *oid, bcMID mid) { @@ -88,3 +93,21 @@ bcIStub * ORB::GetStub(bcOID *oid) { +struct bcOIDstruct { + PRUint16 high; + PRUint16 low; +}; +bcOID ORB::GenerateOID() { + bcOID oid; + bcOIDstruct oidStruct; + oidStruct.low = currentID++; + oidStruct.high = ((PRUint32)this); + oid = *(bcOID*)&oidStruct; + return oid; + +} + + + + + diff --git a/java/xpcom/connect/src/ORB.h b/java/xpcom/connect/src/ORB.h index 4103c26fdd88..b9b6f4d6e93b 100644 --- a/java/xpcom/connect/src/ORB.h +++ b/java/xpcom/connect/src/ORB.h @@ -30,11 +30,13 @@ public: ORB(); virtual ~ORB(); virtual bcOID RegisterStub(bcIStub *stub); + virtual void RegisterStubWithOID(bcIStub *stub, bcOID *oid); virtual bcICall * CreateCall(bcIID *, bcOID *, bcMID); virtual int SendReceive(bcICall *); private: bcIStub * GetStub(bcOID *); + bcOID GenerateOID(); nsHashtable *stubs; - int currentID; + unsigned int currentID; }; #endif