Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1550)

Side by Side Diff: base/message_pump_x.cc

Issue 8890042: Share X connection between GLSurfaceGLX/EGL and MessagePumpX/GTK (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix hang in unittests Created 9 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | content/gpu/gpu_main.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/message_pump_x.h" 5 #include "base/message_pump_x.h"
6 6
7 #include <X11/extensions/XInput2.h> 7 #include <X11/extensions/XInput2.h>
8 8
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/message_loop.h" 10 #include "base/message_loop.h"
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 } 160 }
161 161
162 return should_quit; 162 return should_quit;
163 } 163 }
164 164
165 bool MessagePumpX::RunOnce(GMainContext* context, bool block) { 165 bool MessagePumpX::RunOnce(GMainContext* context, bool block) {
166 Display* display = GetDefaultXDisplay(); 166 Display* display = GetDefaultXDisplay();
167 MessagePumpDispatcher* dispatcher = 167 MessagePumpDispatcher* dispatcher =
168 GetDispatcher() ? GetDispatcher() : g_default_dispatcher; 168 GetDispatcher() ? GetDispatcher() : g_default_dispatcher;
169 169
170 if (!display || !dispatcher) 170 if (!display)
171 return g_main_context_iteration(context, block); 171 return g_main_context_iteration(context, block);
172 172
173 // In the general case, we want to handle all pending events before running 173 // In the general case, we want to handle all pending events before running
174 // the tasks. This is what happens in the message_pump_glib case. 174 // the tasks. This is what happens in the message_pump_glib case.
175 while (XPending(display)) { 175 while (XPending(display)) {
176 XEvent xev; 176 XEvent xev;
177 XNextEvent(display, &xev); 177 XNextEvent(display, &xev);
178 if (ProcessXEvent(dispatcher, &xev)) 178 if (dispatcher && ProcessXEvent(dispatcher, &xev))
179 return true; 179 return true;
180 } 180 }
181 181
182 return g_main_context_iteration(context, block); 182 return g_main_context_iteration(context, block);
183 } 183 }
184 184
185 bool MessagePumpX::WillProcessXEvent(XEvent* xevent) { 185 bool MessagePumpX::WillProcessXEvent(XEvent* xevent) {
186 if (!observers().might_have_observers()) 186 if (!observers().might_have_observers())
187 return false; 187 return false;
188 ObserverListBase<MessagePumpObserver>::Iterator it(observers()); 188 ObserverListBase<MessagePumpObserver>::Iterator it(observers());
189 MessagePumpObserver* obs; 189 MessagePumpObserver* obs;
190 while ((obs = it.GetNext()) != NULL) { 190 while ((obs = it.GetNext()) != NULL) {
191 if (obs->WillProcessEvent(xevent)) 191 if (obs->WillProcessEvent(xevent))
192 return true; 192 return true;
193 } 193 }
194 return false; 194 return false;
195 } 195 }
196 196
197 void MessagePumpX::DidProcessXEvent(XEvent* xevent) { 197 void MessagePumpX::DidProcessXEvent(XEvent* xevent) {
198 FOR_EACH_OBSERVER(MessagePumpObserver, observers(), DidProcessEvent(xevent)); 198 FOR_EACH_OBSERVER(MessagePumpObserver, observers(), DidProcessEvent(xevent));
199 } 199 }
200 200
201 } // namespace base 201 } // namespace base
OLDNEW
« no previous file with comments | « no previous file | content/gpu/gpu_main.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698