? widget/src/gtk/dependentLibs.h ? widget/src/gtk2/dependentLibs.h ? widget/src/xremoteclient/dependentLibs.h Index: widget/src/gtk/nsGtkMozRemoteHelper.cpp =================================================================== RCS file: /cvsroot/mozilla/widget/src/gtk/nsGtkMozRemoteHelper.cpp,v retrieving revision 1.35 diff -d -u -p -r1.35 nsGtkMozRemoteHelper.cpp --- widget/src/gtk/nsGtkMozRemoteHelper.cpp 18 Apr 2004 22:00:16 -0000 1.35 +++ widget/src/gtk/nsGtkMozRemoteHelper.cpp 16 Feb 2005 05:10:05 -0000 @@ -62,6 +62,20 @@ Atom nsGtkMozRemoteHelper::sMozUserAtom Atom nsGtkMozRemoteHelper::sMozProfileAtom = 0; Atom nsGtkMozRemoteHelper::sMozProgramAtom = 0; +#define ARRAY_LENGTH(array_) (sizeof(array_)/sizeof(array_[0])) + +// Minimize the roundtrips to the X-server +static char *XAtomNames[] = { + MOZILLA_VERSION_PROP, + MOZILLA_LOCK_PROP, + MOZILLA_COMMAND_PROP, + MOZILLA_RESPONSE_PROP, + MOZILLA_USER_PROP, + MOZILLA_PROFILE_PROP, + MOZILLA_PROGRAM_PROP +}; +static Atom XAtoms[ARRAY_LENGTH(XAtomNames)]; + // XXX get this dynamically static const char sRemoteVersion[] = "5.0"; @@ -200,23 +214,22 @@ nsGtkMozRemoteHelper::HandlePropertyChan void nsGtkMozRemoteHelper::EnsureAtoms(void) { - // init our atoms if we need to - if (!sMozVersionAtom) - sMozVersionAtom = XInternAtom(GDK_DISPLAY(), MOZILLA_VERSION_PROP, False); - if (!sMozLockAtom) - sMozLockAtom = XInternAtom(GDK_DISPLAY(), MOZILLA_LOCK_PROP, False); - if (!sMozCommandAtom) - sMozCommandAtom = XInternAtom(GDK_DISPLAY(), MOZILLA_COMMAND_PROP, False); - if (!sMozResponseAtom) - sMozResponseAtom = XInternAtom(GDK_DISPLAY(), MOZILLA_RESPONSE_PROP, - False); - if (!sMozUserAtom) - sMozUserAtom = XInternAtom(GDK_DISPLAY(), MOZILLA_USER_PROP, False); - if (!sMozProfileAtom) - sMozProfileAtom = XInternAtom(GDK_DISPLAY(), MOZILLA_PROFILE_PROP, False); - if (!sMozProgramAtom) - sMozProgramAtom = XInternAtom(GDK_DISPLAY(), MOZILLA_PROGRAM_PROP, False); + // init our atoms if we need to + static PRBool initialized; + if (!initialized) { + XInternAtoms(GDK_DISPLAY(), XAtomNames, ARRAY_LENGTH(XAtomNames), False, XAtoms); + int i = 0; + sMozVersionAtom = XAtoms[i++]; + sMozLockAtom = XAtoms[i++]; + sMozCommandAtom = XAtoms[i++]; + sMozResponseAtom = XAtoms[i++]; + sMozUserAtom = XAtoms[i++]; + sMozProfileAtom = XAtoms[i++]; + sMozProgramAtom = XAtoms[i++]; + + initialized = PR_TRUE; + } } Index: widget/src/gtk2/nsGtkMozRemoteHelper.cpp =================================================================== RCS file: /cvsroot/mozilla/widget/src/gtk2/nsGtkMozRemoteHelper.cpp,v retrieving revision 1.5 diff -d -u -p -r1.5 nsGtkMozRemoteHelper.cpp --- widget/src/gtk2/nsGtkMozRemoteHelper.cpp 18 Apr 2004 22:00:17 -0000 1.5 +++ widget/src/gtk2/nsGtkMozRemoteHelper.cpp 16 Feb 2005 05:10:06 -0000 @@ -65,6 +65,20 @@ Atom nsGtkMozRemoteHelper::sMozUserAtom Atom nsGtkMozRemoteHelper::sMozProfileAtom = 0; Atom nsGtkMozRemoteHelper::sMozProgramAtom = 0; +#define ARRAY_LENGTH(array_) (sizeof(array_)/sizeof(array_[0])) + +// Minimize the roundtrips to the X-server +static char *XAtomNames[] = { + MOZILLA_VERSION_PROP, + MOZILLA_LOCK_PROP, + MOZILLA_COMMAND_PROP, + MOZILLA_RESPONSE_PROP, + MOZILLA_USER_PROP, + MOZILLA_PROFILE_PROP, + MOZILLA_PROGRAM_PROP +}; +static Atom XAtoms[ARRAY_LENGTH(XAtomNames)]; + // XXX get this dynamically static const char sRemoteVersion[] = "5.0"; @@ -203,23 +217,22 @@ nsGtkMozRemoteHelper::HandlePropertyChan void nsGtkMozRemoteHelper::EnsureAtoms(void) { - // init our atoms if we need to - if (!sMozVersionAtom) - sMozVersionAtom = XInternAtom(GDK_DISPLAY(), MOZILLA_VERSION_PROP, False); - if (!sMozLockAtom) - sMozLockAtom = XInternAtom(GDK_DISPLAY(), MOZILLA_LOCK_PROP, False); - if (!sMozCommandAtom) - sMozCommandAtom = XInternAtom(GDK_DISPLAY(), MOZILLA_COMMAND_PROP, False); - if (!sMozResponseAtom) - sMozResponseAtom = XInternAtom(GDK_DISPLAY(), MOZILLA_RESPONSE_PROP, - False); - if (!sMozUserAtom) - sMozUserAtom = XInternAtom(GDK_DISPLAY(), MOZILLA_USER_PROP, False); - if (!sMozProfileAtom) - sMozProfileAtom = XInternAtom(GDK_DISPLAY(), MOZILLA_PROFILE_PROP, False); - if (!sMozProgramAtom) - sMozProgramAtom = XInternAtom(GDK_DISPLAY(), MOZILLA_PROGRAM_PROP, False); + // init our atoms if we need to + static PRBool initialized; + if (!initialized) { + XInternAtoms(GDK_DISPLAY(), XAtomNames, ARRAY_LENGTH(XAtomNames), False, XAtoms); + int i = 0; + sMozVersionAtom = XAtoms[i++]; + sMozLockAtom = XAtoms[i++]; + sMozCommandAtom = XAtoms[i++]; + sMozResponseAtom = XAtoms[i++]; + sMozUserAtom = XAtoms[i++]; + sMozProfileAtom = XAtoms[i++]; + sMozProgramAtom = XAtoms[i++]; + + initialized = PR_TRUE; + } } Index: widget/src/xremoteclient/XRemoteClient.cpp =================================================================== RCS file: /cvsroot/mozilla/widget/src/xremoteclient/XRemoteClient.cpp,v retrieving revision 1.15 diff -d -u -p -r1.15 XRemoteClient.cpp --- widget/src/xremoteclient/XRemoteClient.cpp 18 Apr 2004 22:00:39 -0000 1.15 +++ widget/src/xremoteclient/XRemoteClient.cpp 16 Feb 2005 05:10:06 -0000 @@ -64,6 +64,8 @@ #define MOZILLA_PROFILE_PROP "_MOZILLA_PROFILE" #define MOZILLA_PROGRAM_PROP "_MOZILLA_PROGRAM" +#define ARRAY_LENGTH(array_) (sizeof(array_)/sizeof(array_[0])) + static PRLogModuleInfo *sRemoteLm = NULL; XRemoteClient::XRemoteClient() @@ -93,6 +95,19 @@ XRemoteClient::~XRemoteClient() NS_IMPL_ISUPPORTS1(XRemoteClient, nsIXRemoteClient) #endif +// Minimize the roundtrips to the X-server +static char *XAtomNames[] = { + MOZILLA_VERSION_PROP, + MOZILLA_LOCK_PROP, + MOZILLA_COMMAND_PROP, + MOZILLA_RESPONSE_PROP, + "WM_STATE", + MOZILLA_USER_PROP, + MOZILLA_PROFILE_PROP, + MOZILLA_PROGRAM_PROP +}; +static Atom XAtoms[ARRAY_LENGTH(XAtomNames)]; + NS_IMETHODIMP XRemoteClient::Init (void) { @@ -106,14 +121,17 @@ XRemoteClient::Init (void) return NS_ERROR_FAILURE; // get our atoms - mMozVersionAtom = XInternAtom(mDisplay, MOZILLA_VERSION_PROP, False); - mMozLockAtom = XInternAtom(mDisplay, MOZILLA_LOCK_PROP, False); - mMozCommandAtom = XInternAtom(mDisplay, MOZILLA_COMMAND_PROP, False); - mMozResponseAtom = XInternAtom(mDisplay, MOZILLA_RESPONSE_PROP, False); - mMozWMStateAtom = XInternAtom(mDisplay, "WM_STATE", False); - mMozUserAtom = XInternAtom(mDisplay, MOZILLA_USER_PROP, False); - mMozProfileAtom = XInternAtom(mDisplay, MOZILLA_PROFILE_PROP, False); - mMozProgramAtom = XInternAtom(mDisplay, MOZILLA_PROGRAM_PROP, False); + XInternAtoms(mDisplay, XAtomNames, ARRAY_LENGTH(XAtomNames), False, XAtoms); + + int i = 0; + mMozVersionAtom = XAtoms[i++]; + mMozLockAtom = XAtoms[i++]; + mMozCommandAtom = XAtoms[i++]; + mMozResponseAtom = XAtoms[i++]; + mMozWMStateAtom = XAtoms[i++]; + mMozUserAtom = XAtoms[i++]; + mMozProfileAtom = XAtoms[i++]; + mMozProgramAtom = XAtoms[i++]; mInitialized = PR_TRUE;