OLD | NEW |
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 #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 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/message_pump.h" | 10 #include "base/message_pump.h" |
(...skipping 23 matching lines...) Expand all Loading... |
34 // platforms using GLib. | 34 // platforms using GLib. |
35 class MessagePumpGlib : public MessagePump { | 35 class MessagePumpGlib : public MessagePump { |
36 public: | 36 public: |
37 MessagePumpGlib(); | 37 MessagePumpGlib(); |
38 virtual ~MessagePumpGlib(); | 38 virtual ~MessagePumpGlib(); |
39 | 39 |
40 // Like MessagePump::Run, but events are routed through dispatcher. | 40 // Like MessagePump::Run, but events are routed through dispatcher. |
41 virtual void RunWithDispatcher(Delegate* delegate, | 41 virtual void RunWithDispatcher(Delegate* delegate, |
42 MessagePumpDispatcher* dispatcher); | 42 MessagePumpDispatcher* dispatcher); |
43 | 43 |
| 44 // Run a single iteration of the mainloop. A return value of true indicates |
| 45 // that an event was handled. |block| indicates if it should wait if no event |
| 46 // is ready for processing. |
| 47 virtual bool RunOnce(GMainContext* context, bool block) = 0; |
| 48 |
44 // Internal methods used for processing the pump callbacks. They are | 49 // Internal methods used for processing the pump callbacks. They are |
45 // public for simplicity but should not be used directly. HandlePrepare | 50 // public for simplicity but should not be used directly. HandlePrepare |
46 // is called during the prepare step of glib, and returns a timeout that | 51 // is called during the prepare step of glib, and returns a timeout that |
47 // will be passed to the poll. HandleCheck is called after the poll | 52 // will be passed to the poll. HandleCheck is called after the poll |
48 // has completed, and returns whether or not HandleDispatch should be called. | 53 // has completed, and returns whether or not HandleDispatch should be called. |
49 // HandleDispatch is called if HandleCheck returned true. | 54 // HandleDispatch is called if HandleCheck returned true. |
50 int HandlePrepare(); | 55 int HandlePrepare(); |
51 bool HandleCheck(); | 56 bool HandleCheck(); |
52 void HandleDispatch(); | 57 void HandleDispatch(); |
53 | 58 |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 | 105 |
101 // List of observers. | 106 // List of observers. |
102 ObserverList<MessagePumpObserver> observers_; | 107 ObserverList<MessagePumpObserver> observers_; |
103 | 108 |
104 DISALLOW_COPY_AND_ASSIGN(MessagePumpGlib); | 109 DISALLOW_COPY_AND_ASSIGN(MessagePumpGlib); |
105 }; | 110 }; |
106 | 111 |
107 } // namespace base | 112 } // namespace base |
108 | 113 |
109 #endif // BASE_MESSAGE_PUMP_GLIB_H_ | 114 #endif // BASE_MESSAGE_PUMP_GLIB_H_ |
OLD | NEW |