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

Unified Diff: base/message_pump_glib.h

Issue 10833: Rewrite the glib UI pump. (Closed)
Patch Set: Created 12 years, 1 month 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
« no previous file with comments | « no previous file | base/message_pump_glib.cc » ('j') | base/message_pump_glib.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/message_pump_glib.h
diff --git a/base/message_pump_glib.h b/base/message_pump_glib.h
index 01cd4b651c617d699504a41f4f3f4d255cf2282b..26aec49cc7628204445355d29d9aecc21275b775 100644
--- a/base/message_pump_glib.h
+++ b/base/message_pump_glib.h
@@ -29,47 +29,14 @@ class MessagePumpForUI : public MessagePump {
// We may make recursive calls to Run, so we save state that needs to be
// separate between them in this structure type.
struct RunState {
- // This is the delegate argument passed to Run.
Delegate* delegate;
- // This tells us when to exit the event pump.
- bool keep_running;
- // This tells our work source when to dispatch DoWork and DoDelayedWork.
- bool should_do_work;
- // This tells our idle source when to dispatch DoIdleWork.
- bool should_do_idle_work;
- // Unlike the work source, which is shared by all calls to Run, each Run
- // call gets its own idle source because we need to destroy it when we have
- // no idle work, and we don't want to destroy someone else's source.
- GSource* idle_source;
- };
- struct WorkSource : GSource {
- MessagePumpForUI* self;
- };
+ // Used to flag that the current Run() invocation should return ASAP.
+ bool should_quit;
- // The source with these callbacks remain in the main loop forever. They
- // will dispatch DoWork and DoDelayedWork, and calculate when and how long
- // to block when GLib calls poll internally.
- static GSourceFuncs WorkSourceFuncs;
- static gboolean WorkSourcePrepare(GSource* source, gint* timeout_ms);
- static gboolean WorkSourceCheck(GSource* source);
- static gboolean WorkSourceDispatch(GSource* source, GSourceFunc unused_func,
- gpointer unused_data);
-
- // The source that uses these callbacks is added as an idle source, which
- // means GLib will call it when there is no other work to do. We continue
- // doing work as long as DoIdleWork or the other work functions return true.
- // Once no work remains, we remove the idle source so GLib will block instead
- // of firing it. Then we re-add it when we wake up.
- static GSourceFuncs IdleSourceFuncs;
- static gboolean IdleSourcePrepare(GSource* source, gint* timeout_ms);
- static gboolean IdleSourceCheck(GSource* source);
- static gboolean IdleSourceDispatch(GSource* source, GSourceFunc unused_func,
- gpointer unused_data);
-
- // This adds a GLib source to the main loop.
- GSource* AddSource(GSourceFuncs* funcs, gint priority,
- GPollFD* optional_poll_fd);
+ // Used to count how many Run() invocations are on the stack.
+ int run_depth;
+ };
RunState* state_;
« no previous file with comments | « no previous file | base/message_pump_glib.cc » ('j') | base/message_pump_glib.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698