OLD | NEW |
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 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
308 } | 308 } |
309 | 309 |
310 void MessagePumpForUI::WillProcessEvent(GdkEvent* event) { | 310 void MessagePumpForUI::WillProcessEvent(GdkEvent* event) { |
311 FOR_EACH_OBSERVER(Observer, observers_, WillProcessEvent(event)); | 311 FOR_EACH_OBSERVER(Observer, observers_, WillProcessEvent(event)); |
312 } | 312 } |
313 | 313 |
314 void MessagePumpForUI::DidProcessEvent(GdkEvent* event) { | 314 void MessagePumpForUI::DidProcessEvent(GdkEvent* event) { |
315 FOR_EACH_OBSERVER(Observer, observers_, DidProcessEvent(event)); | 315 FOR_EACH_OBSERVER(Observer, observers_, DidProcessEvent(event)); |
316 } | 316 } |
317 | 317 |
| 318 void MessagePumpForUI::Run(Delegate* delegate) { |
| 319 RunWithDispatcher(delegate, NULL); |
| 320 } |
| 321 |
318 void MessagePumpForUI::Quit() { | 322 void MessagePumpForUI::Quit() { |
319 if (state_) { | 323 if (state_) { |
320 state_->should_quit = true; | 324 state_->should_quit = true; |
321 } else { | 325 } else { |
322 NOTREACHED() << "Quit called outside Run!"; | 326 NOTREACHED() << "Quit called outside Run!"; |
323 } | 327 } |
324 } | 328 } |
325 | 329 |
326 void MessagePumpForUI::ScheduleWork() { | 330 void MessagePumpForUI::ScheduleWork() { |
327 // This can be called on any thread, so we don't want to touch any state | 331 // This can be called on any thread, so we don't want to touch any state |
(...skipping 23 matching lines...) Expand all Loading... |
351 DidProcessEvent(event); | 355 DidProcessEvent(event); |
352 } | 356 } |
353 | 357 |
354 // static | 358 // static |
355 void MessagePumpForUI::EventDispatcher(GdkEvent* event, gpointer data) { | 359 void MessagePumpForUI::EventDispatcher(GdkEvent* event, gpointer data) { |
356 MessagePumpForUI* message_pump = reinterpret_cast<MessagePumpForUI*>(data); | 360 MessagePumpForUI* message_pump = reinterpret_cast<MessagePumpForUI*>(data); |
357 message_pump->DispatchEvents(event); | 361 message_pump->DispatchEvents(event); |
358 } | 362 } |
359 | 363 |
360 } // namespace base | 364 } // namespace base |
OLD | NEW |