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

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: fix ups 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
Index: runtime/vm/message_handler.h
diff --git a/runtime/vm/message_handler.h b/runtime/vm/message_handler.h
index 4a939ae522101b564d5a4d7a463274fcd32bd6e4..52c5f524a0fb9d9a451b3b7bc04620c95907871d 100644
--- a/runtime/vm/message_handler.h
+++ b/runtime/vm/message_handler.h
@@ -18,13 +18,20 @@ 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.
+ };
+
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 +53,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 +186,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 +206,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_;

Powered by Google App Engine
This is Rietveld 408576698