OLD | NEW |
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 #ifndef VM_MESSAGE_HANDLER_H_ | 5 #ifndef VM_MESSAGE_HANDLER_H_ |
6 #define VM_MESSAGE_HANDLER_H_ | 6 #define VM_MESSAGE_HANDLER_H_ |
7 | 7 |
8 #include "vm/isolate.h" | 8 #include "vm/isolate.h" |
9 #include "vm/message.h" | 9 #include "vm/message.h" |
10 #include "vm/os_thread.h" | 10 #include "vm/os_thread.h" |
(...skipping 18 matching lines...) Expand all Loading... |
29 | 29 |
30 // Runs this message handler on the thread pool. | 30 // Runs this message handler on the thread pool. |
31 // | 31 // |
32 // Before processing messages, the optional StartFunction is run. | 32 // Before processing messages, the optional StartFunction is run. |
33 // | 33 // |
34 // A message handler will run until it terminates either normally or | 34 // A message handler will run until it terminates either normally or |
35 // abnormally. Normal termination occurs when the message handler | 35 // abnormally. Normal termination occurs when the message handler |
36 // no longer has any live ports. Abnormal termination occurs when | 36 // no longer has any live ports. Abnormal termination occurs when |
37 // HandleMessage() indicates that an error has occurred during | 37 // HandleMessage() indicates that an error has occurred during |
38 // message processing. | 38 // message processing. |
39 void Run(ThreadPool* pool, | 39 void Run(StartCallback start_callback, |
40 StartCallback start_callback, | |
41 EndCallback end_callback, | 40 EndCallback end_callback, |
42 CallbackData data); | 41 CallbackData data); |
43 | 42 |
44 // Handles the next message for this message handler. Should only | 43 // Handles the next message for this message handler. Should only |
45 // be used when not running the handler on the thread pool (via Run | 44 // be used when not running the handler on the thread pool (via Run |
46 // or RunBlocking). | 45 // or RunBlocking). |
47 // | 46 // |
48 // Returns true on success. | 47 // Returns true on success. |
49 bool HandleNextMessage(); | 48 bool HandleNextMessage(); |
50 | 49 |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
200 MessageQueue* oob_queue_; | 199 MessageQueue* oob_queue_; |
201 // This flag is not thread safe and can only reliably be accessed on a single | 200 // This flag is not thread safe and can only reliably be accessed on a single |
202 // thread. | 201 // thread. |
203 bool oob_message_handling_allowed_; | 202 bool oob_message_handling_allowed_; |
204 intptr_t live_ports_; // The number of open ports, including control ports. | 203 intptr_t live_ports_; // The number of open ports, including control ports. |
205 intptr_t paused_; // The number of pause messages received. | 204 intptr_t paused_; // The number of pause messages received. |
206 bool pause_on_start_; | 205 bool pause_on_start_; |
207 bool pause_on_exit_; | 206 bool pause_on_exit_; |
208 bool paused_on_start_; | 207 bool paused_on_start_; |
209 bool paused_on_exit_; | 208 bool paused_on_exit_; |
210 ThreadPool* pool_; | 209 bool running_; |
211 ThreadPool::Task* task_; | 210 ThreadPool::Task* task_; |
212 StartCallback start_callback_; | 211 StartCallback start_callback_; |
213 EndCallback end_callback_; | 212 EndCallback end_callback_; |
214 CallbackData callback_data_; | 213 CallbackData callback_data_; |
215 | 214 |
216 DISALLOW_COPY_AND_ASSIGN(MessageHandler); | 215 DISALLOW_COPY_AND_ASSIGN(MessageHandler); |
217 }; | 216 }; |
218 | 217 |
219 } // namespace dart | 218 } // namespace dart |
220 | 219 |
221 #endif // VM_MESSAGE_HANDLER_H_ | 220 #endif // VM_MESSAGE_HANDLER_H_ |
OLD | NEW |