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

Unified Diff: base/message_pump_x.cc

Issue 10392152: RefCounted types should not have public destructors, Linux fixes (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 7 months 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 side-by-side diff with in-line comments
Download patch
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;

Powered by Google App Engine
This is Rietveld 408576698