Annotation of /trunk/mozilla-firefox/patches/mozilla-firefox-1.0.7-remote-intern-atoms.patch
Parent Directory | Revision Log
Revision 153 -
(hide annotations)
(download)
Tue May 8 20:52:56 2007 UTC (17 years, 4 months ago) by niro
File size: 7091 byte(s)
Tue May 8 20:52:56 2007 UTC (17 years, 4 months ago) by niro
File size: 7091 byte(s)
-import
1 | niro | 153 | ? widget/src/gtk/dependentLibs.h |
2 | ? widget/src/gtk2/dependentLibs.h | ||
3 | ? widget/src/xremoteclient/dependentLibs.h | ||
4 | Index: widget/src/gtk/nsGtkMozRemoteHelper.cpp | ||
5 | =================================================================== | ||
6 | RCS file: /cvsroot/mozilla/widget/src/gtk/nsGtkMozRemoteHelper.cpp,v | ||
7 | retrieving revision 1.35 | ||
8 | diff -d -u -p -r1.35 nsGtkMozRemoteHelper.cpp | ||
9 | --- widget/src/gtk/nsGtkMozRemoteHelper.cpp 18 Apr 2004 22:00:16 -0000 1.35 | ||
10 | +++ widget/src/gtk/nsGtkMozRemoteHelper.cpp 16 Feb 2005 05:10:05 -0000 | ||
11 | @@ -62,6 +62,20 @@ Atom nsGtkMozRemoteHelper::sMozUserAtom | ||
12 | Atom nsGtkMozRemoteHelper::sMozProfileAtom = 0; | ||
13 | Atom nsGtkMozRemoteHelper::sMozProgramAtom = 0; | ||
14 | |||
15 | +#define ARRAY_LENGTH(array_) (sizeof(array_)/sizeof(array_[0])) | ||
16 | + | ||
17 | +// Minimize the roundtrips to the X-server | ||
18 | +static char *XAtomNames[] = { | ||
19 | + MOZILLA_VERSION_PROP, | ||
20 | + MOZILLA_LOCK_PROP, | ||
21 | + MOZILLA_COMMAND_PROP, | ||
22 | + MOZILLA_RESPONSE_PROP, | ||
23 | + MOZILLA_USER_PROP, | ||
24 | + MOZILLA_PROFILE_PROP, | ||
25 | + MOZILLA_PROGRAM_PROP | ||
26 | +}; | ||
27 | +static Atom XAtoms[ARRAY_LENGTH(XAtomNames)]; | ||
28 | + | ||
29 | // XXX get this dynamically | ||
30 | static const char sRemoteVersion[] = "5.0"; | ||
31 | |||
32 | @@ -200,23 +214,22 @@ nsGtkMozRemoteHelper::HandlePropertyChan | ||
33 | void | ||
34 | nsGtkMozRemoteHelper::EnsureAtoms(void) | ||
35 | { | ||
36 | - // init our atoms if we need to | ||
37 | - if (!sMozVersionAtom) | ||
38 | - sMozVersionAtom = XInternAtom(GDK_DISPLAY(), MOZILLA_VERSION_PROP, False); | ||
39 | - if (!sMozLockAtom) | ||
40 | - sMozLockAtom = XInternAtom(GDK_DISPLAY(), MOZILLA_LOCK_PROP, False); | ||
41 | - if (!sMozCommandAtom) | ||
42 | - sMozCommandAtom = XInternAtom(GDK_DISPLAY(), MOZILLA_COMMAND_PROP, False); | ||
43 | - if (!sMozResponseAtom) | ||
44 | - sMozResponseAtom = XInternAtom(GDK_DISPLAY(), MOZILLA_RESPONSE_PROP, | ||
45 | - False); | ||
46 | - if (!sMozUserAtom) | ||
47 | - sMozUserAtom = XInternAtom(GDK_DISPLAY(), MOZILLA_USER_PROP, False); | ||
48 | - if (!sMozProfileAtom) | ||
49 | - sMozProfileAtom = XInternAtom(GDK_DISPLAY(), MOZILLA_PROFILE_PROP, False); | ||
50 | - if (!sMozProgramAtom) | ||
51 | - sMozProgramAtom = XInternAtom(GDK_DISPLAY(), MOZILLA_PROGRAM_PROP, False); | ||
52 | + // init our atoms if we need to | ||
53 | + static PRBool initialized; | ||
54 | + if (!initialized) { | ||
55 | + XInternAtoms(GDK_DISPLAY(), XAtomNames, ARRAY_LENGTH(XAtomNames), False, XAtoms); | ||
56 | |||
57 | + int i = 0; | ||
58 | + sMozVersionAtom = XAtoms[i++]; | ||
59 | + sMozLockAtom = XAtoms[i++]; | ||
60 | + sMozCommandAtom = XAtoms[i++]; | ||
61 | + sMozResponseAtom = XAtoms[i++]; | ||
62 | + sMozUserAtom = XAtoms[i++]; | ||
63 | + sMozProfileAtom = XAtoms[i++]; | ||
64 | + sMozProgramAtom = XAtoms[i++]; | ||
65 | + | ||
66 | + initialized = PR_TRUE; | ||
67 | + } | ||
68 | } | ||
69 | |||
70 | |||
71 | Index: widget/src/gtk2/nsGtkMozRemoteHelper.cpp | ||
72 | =================================================================== | ||
73 | RCS file: /cvsroot/mozilla/widget/src/gtk2/nsGtkMozRemoteHelper.cpp,v | ||
74 | retrieving revision 1.5 | ||
75 | diff -d -u -p -r1.5 nsGtkMozRemoteHelper.cpp | ||
76 | --- widget/src/gtk2/nsGtkMozRemoteHelper.cpp 18 Apr 2004 22:00:17 -0000 1.5 | ||
77 | +++ widget/src/gtk2/nsGtkMozRemoteHelper.cpp 16 Feb 2005 05:10:06 -0000 | ||
78 | @@ -65,6 +65,20 @@ Atom nsGtkMozRemoteHelper::sMozUserAtom | ||
79 | Atom nsGtkMozRemoteHelper::sMozProfileAtom = 0; | ||
80 | Atom nsGtkMozRemoteHelper::sMozProgramAtom = 0; | ||
81 | |||
82 | +#define ARRAY_LENGTH(array_) (sizeof(array_)/sizeof(array_[0])) | ||
83 | + | ||
84 | +// Minimize the roundtrips to the X-server | ||
85 | +static char *XAtomNames[] = { | ||
86 | + MOZILLA_VERSION_PROP, | ||
87 | + MOZILLA_LOCK_PROP, | ||
88 | + MOZILLA_COMMAND_PROP, | ||
89 | + MOZILLA_RESPONSE_PROP, | ||
90 | + MOZILLA_USER_PROP, | ||
91 | + MOZILLA_PROFILE_PROP, | ||
92 | + MOZILLA_PROGRAM_PROP | ||
93 | +}; | ||
94 | +static Atom XAtoms[ARRAY_LENGTH(XAtomNames)]; | ||
95 | + | ||
96 | // XXX get this dynamically | ||
97 | static const char sRemoteVersion[] = "5.0"; | ||
98 | |||
99 | @@ -203,23 +217,22 @@ nsGtkMozRemoteHelper::HandlePropertyChan | ||
100 | void | ||
101 | nsGtkMozRemoteHelper::EnsureAtoms(void) | ||
102 | { | ||
103 | - // init our atoms if we need to | ||
104 | - if (!sMozVersionAtom) | ||
105 | - sMozVersionAtom = XInternAtom(GDK_DISPLAY(), MOZILLA_VERSION_PROP, False); | ||
106 | - if (!sMozLockAtom) | ||
107 | - sMozLockAtom = XInternAtom(GDK_DISPLAY(), MOZILLA_LOCK_PROP, False); | ||
108 | - if (!sMozCommandAtom) | ||
109 | - sMozCommandAtom = XInternAtom(GDK_DISPLAY(), MOZILLA_COMMAND_PROP, False); | ||
110 | - if (!sMozResponseAtom) | ||
111 | - sMozResponseAtom = XInternAtom(GDK_DISPLAY(), MOZILLA_RESPONSE_PROP, | ||
112 | - False); | ||
113 | - if (!sMozUserAtom) | ||
114 | - sMozUserAtom = XInternAtom(GDK_DISPLAY(), MOZILLA_USER_PROP, False); | ||
115 | - if (!sMozProfileAtom) | ||
116 | - sMozProfileAtom = XInternAtom(GDK_DISPLAY(), MOZILLA_PROFILE_PROP, False); | ||
117 | - if (!sMozProgramAtom) | ||
118 | - sMozProgramAtom = XInternAtom(GDK_DISPLAY(), MOZILLA_PROGRAM_PROP, False); | ||
119 | + // init our atoms if we need to | ||
120 | + static PRBool initialized; | ||
121 | + if (!initialized) { | ||
122 | + XInternAtoms(GDK_DISPLAY(), XAtomNames, ARRAY_LENGTH(XAtomNames), False, XAtoms); | ||
123 | |||
124 | + int i = 0; | ||
125 | + sMozVersionAtom = XAtoms[i++]; | ||
126 | + sMozLockAtom = XAtoms[i++]; | ||
127 | + sMozCommandAtom = XAtoms[i++]; | ||
128 | + sMozResponseAtom = XAtoms[i++]; | ||
129 | + sMozUserAtom = XAtoms[i++]; | ||
130 | + sMozProfileAtom = XAtoms[i++]; | ||
131 | + sMozProgramAtom = XAtoms[i++]; | ||
132 | + | ||
133 | + initialized = PR_TRUE; | ||
134 | + } | ||
135 | } | ||
136 | |||
137 | |||
138 | Index: widget/src/xremoteclient/XRemoteClient.cpp | ||
139 | =================================================================== | ||
140 | RCS file: /cvsroot/mozilla/widget/src/xremoteclient/XRemoteClient.cpp,v | ||
141 | retrieving revision 1.15 | ||
142 | diff -d -u -p -r1.15 XRemoteClient.cpp | ||
143 | --- widget/src/xremoteclient/XRemoteClient.cpp 18 Apr 2004 22:00:39 -0000 1.15 | ||
144 | +++ widget/src/xremoteclient/XRemoteClient.cpp 16 Feb 2005 05:10:06 -0000 | ||
145 | @@ -64,6 +64,8 @@ | ||
146 | #define MOZILLA_PROFILE_PROP "_MOZILLA_PROFILE" | ||
147 | #define MOZILLA_PROGRAM_PROP "_MOZILLA_PROGRAM" | ||
148 | |||
149 | +#define ARRAY_LENGTH(array_) (sizeof(array_)/sizeof(array_[0])) | ||
150 | + | ||
151 | static PRLogModuleInfo *sRemoteLm = NULL; | ||
152 | |||
153 | XRemoteClient::XRemoteClient() | ||
154 | @@ -93,6 +95,19 @@ XRemoteClient::~XRemoteClient() | ||
155 | NS_IMPL_ISUPPORTS1(XRemoteClient, nsIXRemoteClient) | ||
156 | #endif | ||
157 | |||
158 | +// Minimize the roundtrips to the X-server | ||
159 | +static char *XAtomNames[] = { | ||
160 | + MOZILLA_VERSION_PROP, | ||
161 | + MOZILLA_LOCK_PROP, | ||
162 | + MOZILLA_COMMAND_PROP, | ||
163 | + MOZILLA_RESPONSE_PROP, | ||
164 | + "WM_STATE", | ||
165 | + MOZILLA_USER_PROP, | ||
166 | + MOZILLA_PROFILE_PROP, | ||
167 | + MOZILLA_PROGRAM_PROP | ||
168 | +}; | ||
169 | +static Atom XAtoms[ARRAY_LENGTH(XAtomNames)]; | ||
170 | + | ||
171 | NS_IMETHODIMP | ||
172 | XRemoteClient::Init (void) | ||
173 | { | ||
174 | @@ -106,14 +121,17 @@ XRemoteClient::Init (void) | ||
175 | return NS_ERROR_FAILURE; | ||
176 | |||
177 | // get our atoms | ||
178 | - mMozVersionAtom = XInternAtom(mDisplay, MOZILLA_VERSION_PROP, False); | ||
179 | - mMozLockAtom = XInternAtom(mDisplay, MOZILLA_LOCK_PROP, False); | ||
180 | - mMozCommandAtom = XInternAtom(mDisplay, MOZILLA_COMMAND_PROP, False); | ||
181 | - mMozResponseAtom = XInternAtom(mDisplay, MOZILLA_RESPONSE_PROP, False); | ||
182 | - mMozWMStateAtom = XInternAtom(mDisplay, "WM_STATE", False); | ||
183 | - mMozUserAtom = XInternAtom(mDisplay, MOZILLA_USER_PROP, False); | ||
184 | - mMozProfileAtom = XInternAtom(mDisplay, MOZILLA_PROFILE_PROP, False); | ||
185 | - mMozProgramAtom = XInternAtom(mDisplay, MOZILLA_PROGRAM_PROP, False); | ||
186 | + XInternAtoms(mDisplay, XAtomNames, ARRAY_LENGTH(XAtomNames), False, XAtoms); | ||
187 | + | ||
188 | + int i = 0; | ||
189 | + mMozVersionAtom = XAtoms[i++]; | ||
190 | + mMozLockAtom = XAtoms[i++]; | ||
191 | + mMozCommandAtom = XAtoms[i++]; | ||
192 | + mMozResponseAtom = XAtoms[i++]; | ||
193 | + mMozWMStateAtom = XAtoms[i++]; | ||
194 | + mMozUserAtom = XAtoms[i++]; | ||
195 | + mMozProfileAtom = XAtoms[i++]; | ||
196 | + mMozProgramAtom = XAtoms[i++]; | ||
197 | |||
198 | mInitialized = PR_TRUE; | ||
199 |