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 | |
49 // Internal methods used for processing the pump callbacks. They are | 44 // Internal methods used for processing the pump callbacks. They are |
50 // public for simplicity but should not be used directly. HandlePrepare | 45 // public for simplicity but should not be used directly. HandlePrepare |
51 // is called during the prepare step of glib, and returns a timeout that | 46 // is called during the prepare step of glib, and returns a timeout that |
52 // will be passed to the poll. HandleCheck is called after the poll | 47 // will be passed to the poll. HandleCheck is called after the poll |
53 // has completed, and returns whether or not HandleDispatch should be called. | 48 // has completed, and returns whether or not HandleDispatch should be called. |
54 // HandleDispatch is called if HandleCheck returned true. | 49 // HandleDispatch is called if HandleCheck returned true. |
55 int HandlePrepare(); | 50 int HandlePrepare(); |
56 bool HandleCheck(); | 51 bool HandleCheck(); |
57 void HandleDispatch(); | 52 void HandleDispatch(); |
58 | 53 |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 | 100 |
106 // List of observers. | 101 // List of observers. |
107 ObserverList<MessagePumpObserver> observers_; | 102 ObserverList<MessagePumpObserver> observers_; |
108 | 103 |
109 DISALLOW_COPY_AND_ASSIGN(MessagePumpGlib); | 104 DISALLOW_COPY_AND_ASSIGN(MessagePumpGlib); |
110 }; | 105 }; |
111 | 106 |
112 } // namespace base | 107 } // namespace base |
113 | 108 |
114 #endif // BASE_MESSAGE_PUMP_GLIB_H_ | 109 #endif // BASE_MESSAGE_PUMP_GLIB_H_ |
OLD | NEW |