| 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 RUNTIME_VM_MESSAGE_HANDLER_H_ | 5 #ifndef RUNTIME_VM_MESSAGE_HANDLER_H_ |
| 6 #define RUNTIME_VM_MESSAGE_HANDLER_H_ | 6 #define RUNTIME_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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 | 72 |
| 73 // Returns true if there are pending OOB messages for this message | 73 // Returns true if there are pending OOB messages for this message |
| 74 // handler. | 74 // handler. |
| 75 bool HasOOBMessages(); | 75 bool HasOOBMessages(); |
| 76 | 76 |
| 77 // A message handler tracks how many live ports it has. | 77 // A message handler tracks how many live ports it has. |
| 78 bool HasLivePorts() const { return live_ports_ > 0; } | 78 bool HasLivePorts() const { return live_ports_ > 0; } |
| 79 | 79 |
| 80 intptr_t live_ports() const { return live_ports_; } | 80 intptr_t live_ports() const { return live_ports_; } |
| 81 | 81 |
| 82 void DebugDump(); | |
| 83 | |
| 84 bool paused() const { return paused_ > 0; } | 82 bool paused() const { return paused_ > 0; } |
| 85 | 83 |
| 86 void increment_paused() { paused_++; } | 84 void increment_paused() { paused_++; } |
| 87 void decrement_paused() { | 85 void decrement_paused() { |
| 88 ASSERT(paused_ > 0); | 86 ASSERT(paused_ > 0); |
| 89 paused_--; | 87 paused_--; |
| 90 } | 88 } |
| 91 | 89 |
| 92 bool ShouldPauseOnStart(MessageStatus status) const; | 90 #if !defined(PRODUCT) |
| 91 void DebugDump(); |
| 92 |
| 93 bool should_pause_on_start() const { return should_pause_on_start_; } | 93 bool should_pause_on_start() const { return should_pause_on_start_; } |
| 94 | 94 |
| 95 void set_should_pause_on_start(bool should_pause_on_start) { | 95 void set_should_pause_on_start(bool should_pause_on_start) { |
| 96 should_pause_on_start_ = should_pause_on_start; | 96 should_pause_on_start_ = should_pause_on_start; |
| 97 } | 97 } |
| 98 | 98 |
| 99 bool is_paused_on_start() const { return is_paused_on_start_; } | 99 bool is_paused_on_start() const { return is_paused_on_start_; } |
| 100 | 100 |
| 101 bool ShouldPauseOnExit(MessageStatus status) const; | |
| 102 bool should_pause_on_exit() const { return should_pause_on_exit_; } | 101 bool should_pause_on_exit() const { return should_pause_on_exit_; } |
| 103 | 102 |
| 104 void set_should_pause_on_exit(bool should_pause_on_exit) { | 103 void set_should_pause_on_exit(bool should_pause_on_exit) { |
| 105 should_pause_on_exit_ = should_pause_on_exit; | 104 should_pause_on_exit_ = should_pause_on_exit; |
| 106 } | 105 } |
| 107 | 106 |
| 108 bool is_paused_on_exit() const { return is_paused_on_exit_; } | 107 bool is_paused_on_exit() const { return is_paused_on_exit_; } |
| 109 | 108 |
| 110 // Timestamp of the paused on start or paused on exit. | 109 // Timestamp of the paused on start or paused on exit. |
| 111 int64_t paused_timestamp() const { return paused_timestamp_; } | 110 int64_t paused_timestamp() const { return paused_timestamp_; } |
| 112 | 111 |
| 112 bool ShouldPauseOnStart(MessageStatus status) const; |
| 113 bool ShouldPauseOnExit(MessageStatus status) const; |
| 113 void PausedOnStart(bool paused); | 114 void PausedOnStart(bool paused); |
| 114 void PausedOnExit(bool paused); | 115 void PausedOnExit(bool paused); |
| 116 #endif |
| 115 | 117 |
| 116 // Gives temporary ownership of |queue| and |oob_queue|. Using this object | 118 // Gives temporary ownership of |queue| and |oob_queue|. Using this object |
| 117 // has the side effect that no OOB messages will be handled if a stack | 119 // has the side effect that no OOB messages will be handled if a stack |
| 118 // overflow interrupt is delivered. | 120 // overflow interrupt is delivered. |
| 119 class AcquiredQueues : public ValueObject { | 121 class AcquiredQueues : public ValueObject { |
| 120 public: | 122 public: |
| 121 explicit AcquiredQueues(MessageHandler* handler); | 123 explicit AcquiredQueues(MessageHandler* handler); |
| 122 | 124 |
| 123 ~AcquiredQueues(); | 125 ~AcquiredQueues(); |
| 124 | 126 |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 225 bool allow_multiple_normal_messages); | 227 bool allow_multiple_normal_messages); |
| 226 | 228 |
| 227 Monitor monitor_; // Protects all fields in MessageHandler. | 229 Monitor monitor_; // Protects all fields in MessageHandler. |
| 228 MessageQueue* queue_; | 230 MessageQueue* queue_; |
| 229 MessageQueue* oob_queue_; | 231 MessageQueue* oob_queue_; |
| 230 // This flag is not thread safe and can only reliably be accessed on a single | 232 // This flag is not thread safe and can only reliably be accessed on a single |
| 231 // thread. | 233 // thread. |
| 232 bool oob_message_handling_allowed_; | 234 bool oob_message_handling_allowed_; |
| 233 intptr_t live_ports_; // The number of open ports, including control ports. | 235 intptr_t live_ports_; // The number of open ports, including control ports. |
| 234 intptr_t paused_; // The number of pause messages received. | 236 intptr_t paused_; // The number of pause messages received. |
| 237 #if !defined(PRODUCT) |
| 235 bool should_pause_on_start_; | 238 bool should_pause_on_start_; |
| 236 bool should_pause_on_exit_; | 239 bool should_pause_on_exit_; |
| 237 bool is_paused_on_start_; | 240 bool is_paused_on_start_; |
| 238 bool is_paused_on_exit_; | 241 bool is_paused_on_exit_; |
| 242 int64_t paused_timestamp_; |
| 243 #endif |
| 239 bool delete_me_; | 244 bool delete_me_; |
| 240 int64_t paused_timestamp_; | |
| 241 ThreadPool* pool_; | 245 ThreadPool* pool_; |
| 242 ThreadPool::Task* task_; | 246 ThreadPool::Task* task_; |
| 243 StartCallback start_callback_; | 247 StartCallback start_callback_; |
| 244 EndCallback end_callback_; | 248 EndCallback end_callback_; |
| 245 CallbackData callback_data_; | 249 CallbackData callback_data_; |
| 246 | 250 |
| 247 DISALLOW_COPY_AND_ASSIGN(MessageHandler); | 251 DISALLOW_COPY_AND_ASSIGN(MessageHandler); |
| 248 }; | 252 }; |
| 249 | 253 |
| 250 } // namespace dart | 254 } // namespace dart |
| 251 | 255 |
| 252 #endif // RUNTIME_VM_MESSAGE_HANDLER_H_ | 256 #endif // RUNTIME_VM_MESSAGE_HANDLER_H_ |
| OLD | NEW |