Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(544)

Side by Side Diff: runtime/vm/message_handler.h

Issue 1748953003: - Add assertions in MutexLocker/MonitorLocker to ensure that the code enclosed (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: code-review-comments Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « runtime/vm/megamorphic_cache_table.cc ('k') | runtime/vm/message_handler.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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"
11 #include "vm/thread_pool.h" 11 #include "vm/thread_pool.h"
12 12
13 namespace dart { 13 namespace dart {
14 14
15 // Forward declarations.
16 class MonitorLocker;
17
15 // A MessageHandler is an entity capable of accepting messages. 18 // A MessageHandler is an entity capable of accepting messages.
16 class MessageHandler { 19 class MessageHandler {
17 protected: 20 protected:
18 MessageHandler(); 21 MessageHandler();
19 22
20 public: 23 public:
21 enum MessageStatus { 24 enum MessageStatus {
22 kOK, // We successfully handled a message. 25 kOK, // We successfully handled a message.
23 kError, // We encountered an error handling a message. 26 kError, // We encountered an error handling a message.
24 kRestart, // The VM is restarting. 27 kRestart, // The VM is restarting.
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
218 void PausedOnStartLocked(bool paused); 221 void PausedOnStartLocked(bool paused);
219 void PausedOnExitLocked(bool paused); 222 void PausedOnExitLocked(bool paused);
220 223
221 // Dequeue the next message. Prefer messages from the oob_queue_ to 224 // Dequeue the next message. Prefer messages from the oob_queue_ to
222 // messages from the queue_. 225 // messages from the queue_.
223 Message* DequeueMessage(Message::Priority min_priority); 226 Message* DequeueMessage(Message::Priority min_priority);
224 227
225 void ClearOOBQueue(); 228 void ClearOOBQueue();
226 229
227 // Handles any pending messages. 230 // Handles any pending messages.
228 MessageStatus HandleMessages(bool allow_normal_messages, 231 MessageStatus HandleMessages(MonitorLocker* ml,
232 bool allow_normal_messages,
229 bool allow_multiple_normal_messages); 233 bool allow_multiple_normal_messages);
230 234
231 Monitor monitor_; // Protects all fields in MessageHandler. 235 Monitor monitor_; // Protects all fields in MessageHandler.
232 MessageQueue* queue_; 236 MessageQueue* queue_;
233 MessageQueue* oob_queue_; 237 MessageQueue* oob_queue_;
234 // This flag is not thread safe and can only reliably be accessed on a single 238 // This flag is not thread safe and can only reliably be accessed on a single
235 // thread. 239 // thread.
236 bool oob_message_handling_allowed_; 240 bool oob_message_handling_allowed_;
237 intptr_t live_ports_; // The number of open ports, including control ports. 241 intptr_t live_ports_; // The number of open ports, including control ports.
238 intptr_t paused_; // The number of pause messages received. 242 intptr_t paused_; // The number of pause messages received.
239 bool should_pause_on_start_; 243 bool should_pause_on_start_;
240 bool should_pause_on_exit_; 244 bool should_pause_on_exit_;
241 bool is_paused_on_start_; 245 bool is_paused_on_start_;
242 bool is_paused_on_exit_; 246 bool is_paused_on_exit_;
243 int64_t paused_timestamp_; 247 int64_t paused_timestamp_;
244 ThreadPool* pool_; 248 ThreadPool* pool_;
245 ThreadPool::Task* task_; 249 ThreadPool::Task* task_;
246 StartCallback start_callback_; 250 StartCallback start_callback_;
247 EndCallback end_callback_; 251 EndCallback end_callback_;
248 CallbackData callback_data_; 252 CallbackData callback_data_;
249 253
250 DISALLOW_COPY_AND_ASSIGN(MessageHandler); 254 DISALLOW_COPY_AND_ASSIGN(MessageHandler);
251 }; 255 };
252 256
253 } // namespace dart 257 } // namespace dart
254 258
255 #endif // VM_MESSAGE_HANDLER_H_ 259 #endif // VM_MESSAGE_HANDLER_H_
OLDNEW
« no previous file with comments | « runtime/vm/megamorphic_cache_table.cc ('k') | runtime/vm/message_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698