| Index: base/message_pump_x.cc
|
| diff --git a/base/message_pump_x.cc b/base/message_pump_x.cc
|
| index 67e0b6c824a2bb057344d5512ccbec628f1bbf86..b16cf35e29422310a9116d7abdd21caf09c591bc 100644
|
| --- a/base/message_pump_x.cc
|
| +++ b/base/message_pump_x.cc
|
| @@ -93,13 +93,6 @@ MessagePumpX::MessagePumpX() : MessagePumpGlib(),
|
| InitXSource();
|
| }
|
|
|
| -MessagePumpX::~MessagePumpX() {
|
| - g_source_destroy(x_source_);
|
| - g_source_unref(x_source_);
|
| - XCloseDisplay(g_xdisplay);
|
| - g_xdisplay = NULL;
|
| -}
|
| -
|
| // static
|
| Display* MessagePumpX::GetDefaultXDisplay() {
|
| if (!g_xdisplay)
|
| @@ -118,6 +111,30 @@ void MessagePumpX::SetDefaultDispatcher(MessagePumpDispatcher* dispatcher) {
|
| g_default_dispatcher = dispatcher;
|
| }
|
|
|
| +gboolean MessagePumpX::DispatchXEvents() {
|
| + Display* display = GetDefaultXDisplay();
|
| + DCHECK(display);
|
| + MessagePumpDispatcher* dispatcher =
|
| + GetDispatcher() ? GetDispatcher() : g_default_dispatcher;
|
| +
|
| + // In the general case, we want to handle all pending events before running
|
| + // the tasks. This is what happens in the message_pump_glib case.
|
| + while (XPending(display)) {
|
| + XEvent xev;
|
| + XNextEvent(display, &xev);
|
| + if (dispatcher && ProcessXEvent(dispatcher, &xev))
|
| + return TRUE;
|
| + }
|
| + return TRUE;
|
| +}
|
| +
|
| +MessagePumpX::~MessagePumpX() {
|
| + g_source_destroy(x_source_);
|
| + g_source_unref(x_source_);
|
| + XCloseDisplay(g_xdisplay);
|
| + g_xdisplay = NULL;
|
| +}
|
| +
|
| void MessagePumpX::InitXSource() {
|
| // CHECKs are to help track down crbug.com/113106.
|
| CHECK(!x_source_);
|
| @@ -160,23 +177,6 @@ bool MessagePumpX::ProcessXEvent(MessagePumpDispatcher* dispatcher,
|
| return should_quit;
|
| }
|
|
|
| -gboolean MessagePumpX::DispatchXEvents() {
|
| - Display* display = GetDefaultXDisplay();
|
| - DCHECK(display);
|
| - MessagePumpDispatcher* dispatcher =
|
| - GetDispatcher() ? GetDispatcher() : g_default_dispatcher;
|
| -
|
| - // In the general case, we want to handle all pending events before running
|
| - // the tasks. This is what happens in the message_pump_glib case.
|
| - while (XPending(display)) {
|
| - XEvent xev;
|
| - XNextEvent(display, &xev);
|
| - if (dispatcher && ProcessXEvent(dispatcher, &xev))
|
| - return TRUE;
|
| - }
|
| - return TRUE;
|
| -}
|
| -
|
| bool MessagePumpX::WillProcessXEvent(XEvent* xevent) {
|
| if (!observers().might_have_observers())
|
| return false;
|
|
|