From 2e50b6f4f75c2bf1f9fd220794b6de2daf16a3fc Mon Sep 17 00:00:00 2001 From: "darin%netscape.com" Date: Thu, 14 Nov 2002 19:37:01 +0000 Subject: [PATCH] eliminate primary name from "client hello" (not needed, and added problematic dependency on libpref). git-svn-id: svn://10.0.0.236/trunk@133838 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/modules/ipc/common/ipcm.h | 8 ++---- .../modules/ipc/daemon/ipcCommandModule.cpp | 5 ---- mozilla/modules/ipc/public/ipcIService.idl | 7 ----- mozilla/modules/ipc/src/Makefile.in | 1 - mozilla/modules/ipc/src/ipcService.cpp | 28 +------------------ mozilla/modules/ipc/src/ipcTransport.cpp | 8 ++---- mozilla/modules/ipc/src/ipcTransport.h | 4 +-- mozilla/modules/ipc/src/ipcTransportUnix.cpp | 2 +- mozilla/modules/ipc/src/ipcTransportWin.cpp | 2 +- mozilla/modules/ipc/test/Makefile.in | 1 - mozilla/modules/ipc/test/TestIPC.cpp | 18 ++++-------- 11 files changed, 15 insertions(+), 69 deletions(-) diff --git a/mozilla/modules/ipc/common/ipcm.h b/mozilla/modules/ipc/common/ipcm.h index 6efcd7ba89c..2cf6d10f2ff 100644 --- a/mozilla/modules/ipc/common/ipcm.h +++ b/mozilla/modules/ipc/common/ipcm.h @@ -144,15 +144,13 @@ enum { // // XXX may want to pass other information here. // -class ipcmMessageClientHello : public ipcMessage_DWORD_STR +class ipcmMessageClientHello : public ipcMessage_DWORD { public: static const PRUint32 MSG_TYPE; - ipcmMessageClientHello(const char *primaryName) - : ipcMessage_DWORD_STR(IPCM_TARGET, MSG_TYPE, primaryName) {} - - const char *PrimaryName() const { return Second(); } + ipcmMessageClientHello() + : ipcMessage_DWORD(IPCM_TARGET, MSG_TYPE) {} }; // diff --git a/mozilla/modules/ipc/daemon/ipcCommandModule.cpp b/mozilla/modules/ipc/daemon/ipcCommandModule.cpp index 01413e72a39..b5dd44778eb 100644 --- a/mozilla/modules/ipc/daemon/ipcCommandModule.cpp +++ b/mozilla/modules/ipc/daemon/ipcCommandModule.cpp @@ -113,11 +113,6 @@ struct ipcCommandModule { LOG(("got CLIENT_HELLO\n")); - ipcMessageCast msg(rawMsg); - const char *name = msg->PrimaryName(); - if (name) - client->AddName(name); - IPC_SendMsg(client, new ipcmMessageClientID(client->ID())); } diff --git a/mozilla/modules/ipc/public/ipcIService.idl b/mozilla/modules/ipc/public/ipcIService.idl index 5b88a4be431..8a9dd4a0f84 100644 --- a/mozilla/modules/ipc/public/ipcIService.idl +++ b/mozilla/modules/ipc/public/ipcIService.idl @@ -78,13 +78,6 @@ interface ipcIService : nsISupports */ readonly attribute unsigned long clientID; - /** - * returns the "primary client name" of this process. this value is taken - * from the pref "ipc.primary-client-name" at IPC service initialization - * time. - */ - readonly attribute ACString primaryClientName; - /** * this process can appear under several client names. use the following * methods to add or remove names for this process. diff --git a/mozilla/modules/ipc/src/Makefile.in b/mozilla/modules/ipc/src/Makefile.in index d23d24bb5c3..0103ff5f006 100644 --- a/mozilla/modules/ipc/src/Makefile.in +++ b/mozilla/modules/ipc/src/Makefile.in @@ -52,7 +52,6 @@ REQUIRES = \ xpcom \ string \ necko \ - pref \ $(NULL) CPPSRCS = \ diff --git a/mozilla/modules/ipc/src/ipcService.cpp b/mozilla/modules/ipc/src/ipcService.cpp index d4fd2ee0ab6..0570347b45d 100644 --- a/mozilla/modules/ipc/src/ipcService.cpp +++ b/mozilla/modules/ipc/src/ipcService.cpp @@ -40,8 +40,6 @@ #include "plstr.h" #include "nsIServiceManager.h" -#include "nsIPrefService.h" -#include "nsIPrefBranch.h" #include "nsIObserverService.h" #include "nsICategoryManager.h" #include "nsCategoryManagerUtils.h" @@ -171,24 +169,7 @@ ipcService::Init() return NS_ERROR_OUT_OF_MEMORY; NS_ADDREF(mTransport); - // read preferences - nsCAutoString appName; - nsCOMPtr prefserv(do_GetService(NS_PREFSERVICE_CONTRACTID)); - if (prefserv) { - nsCOMPtr prefbranch; - prefserv->GetBranch(nsnull, getter_AddRefs(prefbranch)); - if (prefbranch) { - nsXPIDLCString val; - prefbranch->GetCharPref(IPC_SERVICE_PREF_PRIMARY_CLIENT_NAME, - getter_Copies(val)); - if (!val.IsEmpty()) - appName = val; - } - } - if (appName.IsEmpty()) - appName = NS_LITERAL_CSTRING("test-app"); - - rv = mTransport->Init(appName, this); + rv = mTransport->Init(this); if (NS_FAILED(rv)) return rv; return NS_OK; @@ -269,13 +250,6 @@ ipcService::GetClientID(PRUint32 *clientID) return NS_OK; } -NS_IMETHODIMP -ipcService::GetPrimaryClientName(nsACString &primaryName) -{ - primaryName.Truncate(); // XXX implement me - return NS_OK; -} - NS_IMETHODIMP ipcService::AddClientName(const nsACString &name) { diff --git a/mozilla/modules/ipc/src/ipcTransport.cpp b/mozilla/modules/ipc/src/ipcTransport.cpp index e0f7d2b6c63..0f3e9a795cb 100644 --- a/mozilla/modules/ipc/src/ipcTransport.cpp +++ b/mozilla/modules/ipc/src/ipcTransport.cpp @@ -59,13 +59,11 @@ //----------------------------------------------------------------------------- nsresult -ipcTransport::Init(const nsACString &appName, - ipcTransportObserver *obs) +ipcTransport::Init(ipcTransportObserver *obs) { - mAppName = appName; - mObserver = obs; + LOG(("ipcTransport::Init\n")); - LOG(("ipcTransport::Init [app-name=%s]\n", mAppName.get())); + mObserver = obs; #ifdef XP_UNIX nsresult rv = InitUnix(); diff --git a/mozilla/modules/ipc/src/ipcTransport.h b/mozilla/modules/ipc/src/ipcTransport.h index 1110af5f1f2..2830637641c 100644 --- a/mozilla/modules/ipc/src/ipcTransport.h +++ b/mozilla/modules/ipc/src/ipcTransport.h @@ -90,8 +90,7 @@ public: virtual ~ipcTransport() {} - nsresult Init(const nsACString &appName, - ipcTransportObserver *observer); + nsresult Init(ipcTransportObserver *observer); nsresult Shutdown(); // takes ownership of |msg| @@ -120,7 +119,6 @@ private: ipcMessageQ mDelayedQ; ipcTransportObserver *mObserver; nsCOMPtr mTimer; - nsCString mAppName; PRPackedBool mSentHello; PRPackedBool mHaveConnection; PRPackedBool mSpawnedDaemon; diff --git a/mozilla/modules/ipc/src/ipcTransportUnix.cpp b/mozilla/modules/ipc/src/ipcTransportUnix.cpp index 7b7e79a5483..22c7225b86f 100644 --- a/mozilla/modules/ipc/src/ipcTransportUnix.cpp +++ b/mozilla/modules/ipc/src/ipcTransportUnix.cpp @@ -142,7 +142,7 @@ ipcTransport::OnStartRequest(nsIRequest *req) // // send CLIENT_HELLO; expect CLIENT_ID in response. // - SendMsg_Internal(new ipcmMessageClientHello(mAppName.get())); + SendMsg_Internal(new ipcmMessageClientHello()); mSentHello = PR_TRUE; } } diff --git a/mozilla/modules/ipc/src/ipcTransportWin.cpp b/mozilla/modules/ipc/src/ipcTransportWin.cpp index 7cb70e1e16a..6c696590b65 100644 --- a/mozilla/modules/ipc/src/ipcTransportWin.cpp +++ b/mozilla/modules/ipc/src/ipcTransportWin.cpp @@ -320,7 +320,7 @@ ipcTransport::Connect() // // send CLIENT_HELLO; expect CLIENT_ID in response. // - SendMsg_Internal(new ipcmMessageClientHello(mAppName.get())); + SendMsg_Internal(new ipcmMessageClientHello()); mSentHello = PR_TRUE; return NS_OK; diff --git a/mozilla/modules/ipc/test/Makefile.in b/mozilla/modules/ipc/test/Makefile.in index e3fe967e2fe..8e8273657f6 100644 --- a/mozilla/modules/ipc/test/Makefile.in +++ b/mozilla/modules/ipc/test/Makefile.in @@ -30,7 +30,6 @@ MODULE = test_ipc REQUIRES = xpcom \ string \ ipc \ - pref \ $(NULL) CPPSRCS = \ diff --git a/mozilla/modules/ipc/test/TestIPC.cpp b/mozilla/modules/ipc/test/TestIPC.cpp index 6070e286243..f5d143b4087 100644 --- a/mozilla/modules/ipc/test/TestIPC.cpp +++ b/mozilla/modules/ipc/test/TestIPC.cpp @@ -36,8 +36,6 @@ * ***** END LICENSE BLOCK ***** */ #include "ipcIService.h" -#include "nsIPrefService.h" -#include "nsIPrefBranch.h" #include "nsIEventQueueService.h" #include "nsIServiceManager.h" #include "nsIComponentRegistrar.h" @@ -188,21 +186,15 @@ int main(int argc, char **argv) rv = eqs->GetThreadEventQueue(NS_CURRENT_THREAD, &gEventQ); RETURN_IF_FAILED(rv, "GetThreadEventQueue"); - if (argc > 1) { - printf("*** using client name [%s]\n", argv[1]); - nsCOMPtr prefserv(do_GetService(NS_PREFSERVICE_CONTRACTID)); - if (prefserv) { - nsCOMPtr prefbranch; - prefserv->GetBranch(nsnull, getter_AddRefs(prefbranch)); - if (prefbranch) - prefbranch->SetCharPref(IPC_SERVICE_PREF_PRIMARY_CLIENT_NAME, argv[1]); - } - } - nsCOMPtr ipcServ(do_GetService("@mozilla.org/ipc/service;1", &rv)); RETURN_IF_FAILED(rv, "do_GetService(ipcServ)"); NS_ADDREF(gIpcServ = ipcServ); + if (argc > 1) { + printf("*** using client name [%s]\n", argv[1]); + gIpcServ->AddClientName(nsDependentCString(argv[1])); + } + ipcServ->SetMessageObserver(kTestTargetID, new myIpcMessageObserver()); const char *data =