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

Side by Side Diff: base/message_pump_glib.cc

Issue 8872055: Refactor MessagePumpX to dispatch events inside of the source Dispatch function. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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
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_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 <glib.h> 10 #include <glib.h>
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
199 // first iteration of the loop, so RunAllPending() works correctly. 199 // first iteration of the loop, so RunAllPending() works correctly.
200 bool more_work_is_plausible = true; 200 bool more_work_is_plausible = true;
201 201
202 // We run our own loop instead of using g_main_loop_quit in one of the 202 // We run our own loop instead of using g_main_loop_quit in one of the
203 // callbacks. This is so we only quit our own loops, and we don't quit 203 // callbacks. This is so we only quit our own loops, and we don't quit
204 // nested loops run by others. TODO(deanm): Is this what we want? 204 // nested loops run by others. TODO(deanm): Is this what we want?
205 for (;;) { 205 for (;;) {
206 // Don't block if we think we have more work to do. 206 // Don't block if we think we have more work to do.
207 bool block = !more_work_is_plausible; 207 bool block = !more_work_is_plausible;
208 208
209 more_work_is_plausible = RunOnce(context_, block); 209 more_work_is_plausible = g_main_context_iteration(context_, block);
210 if (state_->should_quit) 210 if (state_->should_quit)
211 break; 211 break;
212 212
213 more_work_is_plausible |= state_->delegate->DoWork(); 213 more_work_is_plausible |= state_->delegate->DoWork();
214 if (state_->should_quit) 214 if (state_->should_quit)
215 break; 215 break;
216 216
217 more_work_is_plausible |= 217 more_work_is_plausible |=
218 state_->delegate->DoDelayedWork(&delayed_work_time_); 218 state_->delegate->DoDelayedWork(&delayed_work_time_);
219 if (state_->should_quit) 219 if (state_->should_quit)
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
324 // adjusted. This will cause us to try to do work, but that's ok. 324 // adjusted. This will cause us to try to do work, but that's ok.
325 delayed_work_time_ = delayed_work_time; 325 delayed_work_time_ = delayed_work_time;
326 ScheduleWork(); 326 ScheduleWork();
327 } 327 }
328 328
329 MessagePumpDispatcher* MessagePumpGlib::GetDispatcher() { 329 MessagePumpDispatcher* MessagePumpGlib::GetDispatcher() {
330 return state_ ? state_->dispatcher : NULL; 330 return state_ ? state_->dispatcher : NULL;
331 } 331 }
332 332
333 } // namespace base 333 } // namespace base
OLDNEW
« base/message_loop.cc ('K') | « base/message_pump_glib.h ('k') | base/message_pump_gtk.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698