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

Unified Diff: runtime/vm/message_handler.h

Issue 1371193005: VM restart + shutdown fixes (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: more code review Created 5 years, 2 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/vm/isolate.cc ('k') | runtime/vm/message_handler.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/message_handler.h
diff --git a/runtime/vm/message_handler.h b/runtime/vm/message_handler.h
index 4a939ae522101b564d5a4d7a463274fcd32bd6e4..f4d907ca8765c0a0bb3cdd1ce0b801cd40d4cab4 100644
--- a/runtime/vm/message_handler.h
+++ b/runtime/vm/message_handler.h
@@ -18,13 +18,21 @@ class MessageHandler {
MessageHandler();
public:
+ enum MessageStatus {
+ kOK, // We successfully handled a message.
+ kError, // We encountered an error handling a message.
+ kRestart, // The VM is restarting.
+ kShutdown, // The VM is shutting down.
+ };
+ static const char* MessageStatusString(MessageStatus status);
+
virtual ~MessageHandler();
// Allow subclasses to provide a handler name.
virtual const char* name() const;
typedef uword CallbackData;
- typedef bool (*StartCallback)(CallbackData data);
+ typedef MessageStatus (*StartCallback)(CallbackData data);
typedef void (*EndCallback)(CallbackData data);
// Runs this message handler on the thread pool.
@@ -46,13 +54,13 @@ class MessageHandler {
// or RunBlocking).
//
// Returns true on success.
- bool HandleNextMessage();
+ MessageStatus HandleNextMessage();
// Handles any OOB messages for this message handler. Can be used
// even if the message handler is running on the thread pool.
//
// Returns true on success.
- bool HandleOOBMessages();
+ MessageStatus HandleOOBMessages();
// Returns true if there are pending OOB messages for this message
// handler.
@@ -179,7 +187,7 @@ class MessageHandler {
// Handles a single message. Provided by subclass.
//
// Returns true on success.
- virtual bool HandleMessage(Message* message) = 0;
+ virtual MessageStatus HandleMessage(Message* message) = 0;
virtual void NotifyPauseOnStart() {}
virtual void NotifyPauseOnExit() {}
@@ -199,9 +207,11 @@ class MessageHandler {
// messages from the queue_.
Message* DequeueMessage(Message::Priority min_priority);
+ void ClearOOBQueue();
+
// Handles any pending messages.
- bool HandleMessages(bool allow_normal_messages,
- bool allow_multiple_normal_messages);
+ MessageStatus HandleMessages(bool allow_normal_messages,
+ bool allow_multiple_normal_messages);
Monitor monitor_; // Protects all fields in MessageHandler.
MessageQueue* queue_;
« no previous file with comments | « runtime/vm/isolate.cc ('k') | runtime/vm/message_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698