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/lockers.h" | 9 #include "vm/lockers.h" |
10 #include "vm/message.h" | 10 #include "vm/message.h" |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
180 void ClosePort(Dart_Port port); | 180 void ClosePort(Dart_Port port); |
181 | 181 |
182 // Notifies this handler that all ports are being closed. | 182 // Notifies this handler that all ports are being closed. |
183 void CloseAllPorts(); | 183 void CloseAllPorts(); |
184 | 184 |
185 // Returns true if the handler is owned by the PortMap. | 185 // Returns true if the handler is owned by the PortMap. |
186 // | 186 // |
187 // This is used to delete handlers when their last live port is closed. | 187 // This is used to delete handlers when their last live port is closed. |
188 virtual bool OwnedByPortMap() const { return false; } | 188 virtual bool OwnedByPortMap() const { return false; } |
189 | 189 |
| 190 // Requests deletion of this message handler when the next task |
| 191 // completes. |
| 192 void RequestDeletion(); |
| 193 |
190 void increment_live_ports(); | 194 void increment_live_ports(); |
191 void decrement_live_ports(); | 195 void decrement_live_ports(); |
192 // ------------ END PortMap API ------------ | 196 // ------------ END PortMap API ------------ |
193 | 197 |
194 // Custom message notification. Optionally provided by subclass. | 198 // Custom message notification. Optionally provided by subclass. |
195 virtual void MessageNotify(Message::Priority priority); | 199 virtual void MessageNotify(Message::Priority priority); |
196 | 200 |
197 // Handles a single message. Provided by subclass. | 201 // Handles a single message. Provided by subclass. |
198 // | 202 // |
199 // Returns true on success. | 203 // Returns true on success. |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
234 MessageQueue* oob_queue_; | 238 MessageQueue* oob_queue_; |
235 // This flag is not thread safe and can only reliably be accessed on a single | 239 // This flag is not thread safe and can only reliably be accessed on a single |
236 // thread. | 240 // thread. |
237 bool oob_message_handling_allowed_; | 241 bool oob_message_handling_allowed_; |
238 intptr_t live_ports_; // The number of open ports, including control ports. | 242 intptr_t live_ports_; // The number of open ports, including control ports. |
239 intptr_t paused_; // The number of pause messages received. | 243 intptr_t paused_; // The number of pause messages received. |
240 bool should_pause_on_start_; | 244 bool should_pause_on_start_; |
241 bool should_pause_on_exit_; | 245 bool should_pause_on_exit_; |
242 bool is_paused_on_start_; | 246 bool is_paused_on_start_; |
243 bool is_paused_on_exit_; | 247 bool is_paused_on_exit_; |
| 248 bool delete_me_; |
244 int64_t paused_timestamp_; | 249 int64_t paused_timestamp_; |
245 ThreadPool* pool_; | 250 ThreadPool* pool_; |
246 ThreadPool::Task* task_; | 251 ThreadPool::Task* task_; |
247 StartCallback start_callback_; | 252 StartCallback start_callback_; |
248 EndCallback end_callback_; | 253 EndCallback end_callback_; |
249 CallbackData callback_data_; | 254 CallbackData callback_data_; |
250 | 255 |
251 DISALLOW_COPY_AND_ASSIGN(MessageHandler); | 256 DISALLOW_COPY_AND_ASSIGN(MessageHandler); |
252 }; | 257 }; |
253 | 258 |
254 } // namespace dart | 259 } // namespace dart |
255 | 260 |
256 #endif // VM_MESSAGE_HANDLER_H_ | 261 #endif // VM_MESSAGE_HANDLER_H_ |
OLD | NEW |