Chromium Code Reviews| 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/message.h" | 8 #include "vm/message.h" |
| 9 #include "vm/thread.h" | 9 #include "vm/thread.h" |
| 10 #include "vm/thread_pool.h" | 10 #include "vm/thread_pool.h" |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 64 bool HasLivePorts() const { return live_ports_ > control_ports_; } | 64 bool HasLivePorts() const { return live_ports_ > control_ports_; } |
| 65 | 65 |
| 66 intptr_t live_ports() const { | 66 intptr_t live_ports() const { |
| 67 return live_ports_; | 67 return live_ports_; |
| 68 } | 68 } |
| 69 | 69 |
| 70 intptr_t control_ports() const { | 70 intptr_t control_ports() const { |
| 71 return control_ports_; | 71 return control_ports_; |
| 72 } | 72 } |
| 73 | 73 |
| 74 bool paused() const { return paused_ > 0; } | |
| 75 | |
| 76 void increment_paused() { paused_++; } | |
|
siva
2014/07/01 21:42:56
How do we ensure paused does not overflow?
Lasse Reichstein Nielsen
2014/07/02 08:11:55
If paused_ is an intptr_t, and we store one resume
siva
2014/07/02 14:52:10
True but instead of relying on that one needs to s
Ivan Posva
2014/07/03 12:51:17
Isolate::AddResumeCapability now prevents overflow
| |
| 77 void decrement_paused() { paused_--; } | |
|
siva
2014/07/01 21:42:56
ASSERT(paused_ > 0);
Ivan Posva
2014/07/03 12:51:17
Done.
| |
| 78 | |
| 74 bool pause_on_start() const { | 79 bool pause_on_start() const { |
| 75 return pause_on_start_; | 80 return pause_on_start_; |
| 76 } | 81 } |
| 77 | 82 |
| 78 void set_pause_on_start(bool pause_on_start) { | 83 void set_pause_on_start(bool pause_on_start) { |
| 79 pause_on_start_ = pause_on_start; | 84 pause_on_start_ = pause_on_start; |
| 80 } | 85 } |
| 81 | 86 |
| 82 bool paused_on_start() const { | 87 bool paused_on_start() const { |
| 83 // If pause_on_start_ is still set, tell the user we are paused, | 88 // If pause_on_start_ is still set, tell the user we are paused, |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 157 | 162 |
| 158 // Handles any pending messages. | 163 // Handles any pending messages. |
| 159 bool HandleMessages(bool allow_normal_messages, | 164 bool HandleMessages(bool allow_normal_messages, |
| 160 bool allow_multiple_normal_messages); | 165 bool allow_multiple_normal_messages); |
| 161 | 166 |
| 162 Monitor monitor_; // Protects all fields in MessageHandler. | 167 Monitor monitor_; // Protects all fields in MessageHandler. |
| 163 MessageQueue* queue_; | 168 MessageQueue* queue_; |
| 164 MessageQueue* oob_queue_; | 169 MessageQueue* oob_queue_; |
| 165 intptr_t control_ports_; // The number of open control ports usually 0 or 1. | 170 intptr_t control_ports_; // The number of open control ports usually 0 or 1. |
| 166 intptr_t live_ports_; // The number of open ports, including control ports. | 171 intptr_t live_ports_; // The number of open ports, including control ports. |
| 172 intptr_t paused_; // The number of pause messages received. | |
| 167 bool pause_on_start_; | 173 bool pause_on_start_; |
| 168 bool pause_on_exit_; | 174 bool pause_on_exit_; |
| 169 bool paused_on_exit_; | 175 bool paused_on_exit_; |
| 170 ThreadPool* pool_; | 176 ThreadPool* pool_; |
| 171 ThreadPool::Task* task_; | 177 ThreadPool::Task* task_; |
| 172 StartCallback start_callback_; | 178 StartCallback start_callback_; |
| 173 EndCallback end_callback_; | 179 EndCallback end_callback_; |
| 174 CallbackData callback_data_; | 180 CallbackData callback_data_; |
| 175 | 181 |
| 176 DISALLOW_COPY_AND_ASSIGN(MessageHandler); | 182 DISALLOW_COPY_AND_ASSIGN(MessageHandler); |
| 177 }; | 183 }; |
| 178 | 184 |
| 179 } // namespace dart | 185 } // namespace dart |
| 180 | 186 |
| 181 #endif // VM_MESSAGE_HANDLER_H_ | 187 #endif // VM_MESSAGE_HANDLER_H_ |
| OLD | NEW |