| 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 #ifndef BASE_MESSAGE_PUMP_GLIB_H_ | 5 #ifndef BASE_MESSAGE_PUMP_GLIB_H_ |
| 6 #define BASE_MESSAGE_PUMP_GLIB_H_ | 6 #define BASE_MESSAGE_PUMP_GLIB_H_ |
| 7 | 7 |
| 8 #include "base/base_export.h" |
| 8 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 9 #include "base/message_pump.h" | 10 #include "base/message_pump.h" |
| 10 #include "base/observer_list.h" | 11 #include "base/observer_list.h" |
| 11 #include "base/time.h" | 12 #include "base/time.h" |
| 12 | 13 |
| 13 typedef struct _GMainContext GMainContext; | 14 typedef struct _GMainContext GMainContext; |
| 14 typedef struct _GPollFD GPollFD; | 15 typedef struct _GPollFD GPollFD; |
| 15 typedef struct _GSource GSource; | 16 typedef struct _GSource GSource; |
| 16 | 17 |
| 17 namespace base { | 18 namespace base { |
| 18 | 19 |
| 19 // MessagePumpObserver is notified prior to an event being dispatched. As | 20 // MessagePumpObserver is notified prior to an event being dispatched. As |
| 20 // Observers are notified of every change, they have to be FAST! The platform | 21 // Observers are notified of every change, they have to be FAST! The platform |
| 21 // specific implementation of the class is in message_pump_gtk/message_pump_x. | 22 // specific implementation of the class is in message_pump_gtk/message_pump_x. |
| 22 class MessagePumpObserver; | 23 class MessagePumpObserver; |
| 23 | 24 |
| 24 // MessagePumpDispatcher is used during a nested invocation of Run to dispatch | 25 // MessagePumpDispatcher is used during a nested invocation of Run to dispatch |
| 25 // events. If Run is invoked with a non-NULL MessagePumpDispatcher, MessageLoop | 26 // events. If Run is invoked with a non-NULL MessagePumpDispatcher, MessageLoop |
| 26 // does not dispatch events (or invoke gtk_main_do_event), rather every event is | 27 // does not dispatch events (or invoke gtk_main_do_event), rather every event is |
| 27 // passed to Dispatcher's Dispatch method for dispatch. It is up to the | 28 // passed to Dispatcher's Dispatch method for dispatch. It is up to the |
| 28 // Dispatcher to dispatch, or not, the event. The platform specific | 29 // Dispatcher to dispatch, or not, the event. The platform specific |
| 29 // implementation of the class is in message_pump_gtk/message_pump_x. | 30 // implementation of the class is in message_pump_gtk/message_pump_x. |
| 30 class MessagePumpDispatcher; | 31 class MessagePumpDispatcher; |
| 31 | 32 |
| 32 // This class implements a base MessagePump needed for TYPE_UI MessageLoops on | 33 // This class implements a base MessagePump needed for TYPE_UI MessageLoops on |
| 33 // platforms using GLib. | 34 // platforms using GLib. |
| 34 class MessagePumpGlib : public MessagePump { | 35 class BASE_EXPORT MessagePumpGlib : public MessagePump { |
| 35 public: | 36 public: |
| 36 MessagePumpGlib(); | 37 MessagePumpGlib(); |
| 37 | 38 |
| 38 // Like MessagePump::Run, but events are routed through dispatcher. | 39 // Like MessagePump::Run, but events are routed through dispatcher. |
| 39 virtual void RunWithDispatcher(Delegate* delegate, | 40 virtual void RunWithDispatcher(Delegate* delegate, |
| 40 MessagePumpDispatcher* dispatcher); | 41 MessagePumpDispatcher* dispatcher); |
| 41 | 42 |
| 42 // Internal methods used for processing the pump callbacks. They are | 43 // Internal methods used for processing the pump callbacks. They are |
| 43 // public for simplicity but should not be used directly. HandlePrepare | 44 // public for simplicity but should not be used directly. HandlePrepare |
| 44 // is called during the prepare step of glib, and returns a timeout that | 45 // is called during the prepare step of glib, and returns a timeout that |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 | 101 |
| 101 // List of observers. | 102 // List of observers. |
| 102 ObserverList<MessagePumpObserver> observers_; | 103 ObserverList<MessagePumpObserver> observers_; |
| 103 | 104 |
| 104 DISALLOW_COPY_AND_ASSIGN(MessagePumpGlib); | 105 DISALLOW_COPY_AND_ASSIGN(MessagePumpGlib); |
| 105 }; | 106 }; |
| 106 | 107 |
| 107 } // namespace base | 108 } // namespace base |
| 108 | 109 |
| 109 #endif // BASE_MESSAGE_PUMP_GLIB_H_ | 110 #endif // BASE_MESSAGE_PUMP_GLIB_H_ |
| OLD | NEW |