eliminate primary name from "client hello" (not needed, and added

problematic dependency on libpref).
This commit is contained in:
darin%netscape.com 2002-11-14 19:37:01 +00:00
Родитель cb349b9ce3
Коммит ea1bf00e1b
11 изменённых файлов: 15 добавлений и 69 удалений

Просмотреть файл

@ -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) {}
};
//

Просмотреть файл

@ -113,11 +113,6 @@ struct ipcCommandModule
{
LOG(("got CLIENT_HELLO\n"));
ipcMessageCast<ipcmMessageClientHello> msg(rawMsg);
const char *name = msg->PrimaryName();
if (name)
client->AddName(name);
IPC_SendMsg(client, new ipcmMessageClientID(client->ID()));
}

Просмотреть файл

@ -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.

Просмотреть файл

@ -52,7 +52,6 @@ REQUIRES = \
xpcom \
string \
necko \
pref \
$(NULL)
CPPSRCS = \

Просмотреть файл

@ -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<nsIPrefService> prefserv(do_GetService(NS_PREFSERVICE_CONTRACTID));
if (prefserv) {
nsCOMPtr<nsIPrefBranch> 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)
{

Просмотреть файл

@ -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();

Просмотреть файл

@ -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<nsITimer> mTimer;
nsCString mAppName;
PRPackedBool mSentHello;
PRPackedBool mHaveConnection;
PRPackedBool mSpawnedDaemon;

Просмотреть файл

@ -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;
}
}

Просмотреть файл

@ -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;

Просмотреть файл

@ -30,7 +30,6 @@ MODULE = test_ipc
REQUIRES = xpcom \
string \
ipc \
pref \
$(NULL)
CPPSRCS = \

Просмотреть файл

@ -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<nsIPrefService> prefserv(do_GetService(NS_PREFSERVICE_CONTRACTID));
if (prefserv) {
nsCOMPtr<nsIPrefBranch> prefbranch;
prefserv->GetBranch(nsnull, getter_AddRefs(prefbranch));
if (prefbranch)
prefbranch->SetCharPref(IPC_SERVICE_PREF_PRIMARY_CLIENT_NAME, argv[1]);
}
}
nsCOMPtr<ipcIService> 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 =