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

Side by Side Diff: base/message_pump_glib.cc

Issue 5110011: A non-GTK version of menus for touchui. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: fix compile for chromeos Created 10 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
OLDNEW
1 // Copyright (c) 2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2008 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_glib.h" 5 #include "base/message_pump_glib.h"
6 6
7 #include <fcntl.h> 7 #include <fcntl.h>
8 #include <math.h> 8 #include <math.h>
9 9
10 #include <gtk/gtk.h> 10 #include <gtk/gtk.h>
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 WorkSourceCheck, 117 WorkSourceCheck,
118 WorkSourceDispatch, 118 WorkSourceDispatch,
119 NULL 119 NULL
120 }; 120 };
121 121
122 } // namespace 122 } // namespace
123 123
124 124
125 namespace base { 125 namespace base {
126 126
127 struct MessagePumpForUI::RunState {
128 Delegate* delegate;
129 Dispatcher* dispatcher;
130
131 // Used to flag that the current Run() invocation should return ASAP.
132 bool should_quit;
133
134 // Used to count how many Run() invocations are on the stack.
135 int run_depth;
136
137 // This keeps the state of whether the pump got signaled that there was new
138 // work to be done. Since we eat the message on the wake up pipe as soon as
139 // we get it, we keep that state here to stay consistent.
140 bool has_work;
141 };
142
143 MessagePumpForUI::MessagePumpForUI() 127 MessagePumpForUI::MessagePumpForUI()
144 : state_(NULL), 128 : state_(NULL),
145 context_(g_main_context_default()), 129 context_(g_main_context_default()),
146 wakeup_gpollfd_(new GPollFD) { 130 wakeup_gpollfd_(new GPollFD) {
147 // Create our wakeup pipe, which is used to flag when work was scheduled. 131 // Create our wakeup pipe, which is used to flag when work was scheduled.
148 int fds[2]; 132 int fds[2];
149 CHECK_EQ(pipe(fds), 0); 133 CHECK_EQ(pipe(fds), 0);
150 wakeup_pipe_read_ = fds[0]; 134 wakeup_pipe_read_ = fds[0];
151 wakeup_pipe_write_ = fds[1]; 135 wakeup_pipe_write_ = fds[1];
152 wakeup_gpollfd_->fd = wakeup_pipe_read_; 136 wakeup_gpollfd_->fd = wakeup_pipe_read_;
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
351 DidProcessEvent(event); 335 DidProcessEvent(event);
352 } 336 }
353 337
354 // static 338 // static
355 void MessagePumpForUI::EventDispatcher(GdkEvent* event, gpointer data) { 339 void MessagePumpForUI::EventDispatcher(GdkEvent* event, gpointer data) {
356 MessagePumpForUI* message_pump = reinterpret_cast<MessagePumpForUI*>(data); 340 MessagePumpForUI* message_pump = reinterpret_cast<MessagePumpForUI*>(data);
357 message_pump->DispatchEvents(event); 341 message_pump->DispatchEvents(event);
358 } 342 }
359 343
360 } // namespace base 344 } // namespace base
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698