OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_loop/message_pump_glib.h" | 5 #include "base/message_loop/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 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
283 // syscalls and just signal that we have more work. | 283 // syscalls and just signal that we have more work. |
284 state_->has_work = true; | 284 state_->has_work = true; |
285 } | 285 } |
286 | 286 |
287 if (state_->should_quit) | 287 if (state_->should_quit) |
288 return; | 288 return; |
289 | 289 |
290 state_->delegate->DoDelayedWork(&delayed_work_time_); | 290 state_->delegate->DoDelayedWork(&delayed_work_time_); |
291 } | 291 } |
292 | 292 |
293 void MessagePumpGlib::AddObserver(MessagePumpObserver* observer) { | |
294 observers_.AddObserver(observer); | |
295 } | |
296 | |
297 void MessagePumpGlib::RemoveObserver(MessagePumpObserver* observer) { | |
298 observers_.RemoveObserver(observer); | |
299 } | |
300 | |
301 void MessagePumpGlib::Run(Delegate* delegate) { | 293 void MessagePumpGlib::Run(Delegate* delegate) { |
302 RunWithDispatcher(delegate, NULL); | 294 RunWithDispatcher(delegate, NULL); |
303 } | 295 } |
304 | 296 |
305 void MessagePumpGlib::Quit() { | 297 void MessagePumpGlib::Quit() { |
306 if (state_) { | 298 if (state_) { |
307 state_->should_quit = true; | 299 state_->should_quit = true; |
308 } else { | 300 } else { |
309 NOTREACHED() << "Quit called outside Run!"; | 301 NOTREACHED() << "Quit called outside Run!"; |
310 } | 302 } |
(...skipping 14 matching lines...) Expand all Loading... |
325 // adjusted. This will cause us to try to do work, but that's ok. | 317 // adjusted. This will cause us to try to do work, but that's ok. |
326 delayed_work_time_ = delayed_work_time; | 318 delayed_work_time_ = delayed_work_time; |
327 ScheduleWork(); | 319 ScheduleWork(); |
328 } | 320 } |
329 | 321 |
330 MessagePumpDispatcher* MessagePumpGlib::GetDispatcher() { | 322 MessagePumpDispatcher* MessagePumpGlib::GetDispatcher() { |
331 return state_ ? state_->dispatcher : NULL; | 323 return state_ ? state_->dispatcher : NULL; |
332 } | 324 } |
333 | 325 |
334 } // namespace base | 326 } // namespace base |
OLD | NEW |