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

Unified Diff: runtime/vm/message_handler.cc

Issue 1177153005: Enables clean VM shutdown. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Kill isolates from the service isolate Created 5 years, 6 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.cc
diff --git a/runtime/vm/message_handler.cc b/runtime/vm/message_handler.cc
index 6a473dd74033f4c6d019be2437de0c7a8ec29aa9..9dfa730379dc88d9eefbd91c7a323cb3beaf041e 100644
--- a/runtime/vm/message_handler.cc
+++ b/runtime/vm/message_handler.cc
@@ -42,7 +42,7 @@ MessageHandler::MessageHandler()
pause_on_exit_(false),
paused_on_start_(false),
paused_on_exit_(false),
- pool_(NULL),
+ running_(false),
task_(NULL),
start_callback_(NULL),
end_callback_(NULL),
@@ -75,8 +75,7 @@ void MessageHandler::MessageNotify(Message::Priority priority) {
}
-void MessageHandler::Run(ThreadPool* pool,
- StartCallback start_callback,
+void MessageHandler::Run(StartCallback start_callback,
EndCallback end_callback,
CallbackData data) {
MonitorLocker ml(&monitor_);
@@ -85,13 +84,13 @@ void MessageHandler::Run(ThreadPool* pool,
"\thandler: %s\n",
name());
}
- ASSERT(pool_ == NULL);
- pool_ = pool;
+ ASSERT(!running_);
+ running_ = true;
turnidge 2015/06/30 22:15:46 I think that "running_" is a bit confusing as a na
zra 2015/07/20 22:23:39 Done.
start_callback_ = start_callback;
end_callback_ = end_callback;
callback_data_ = data;
task_ = new MessageHandlerTask(this);
- pool_->Run(task_);
+ ThreadPool::Run(task_);
}
@@ -121,9 +120,9 @@ void MessageHandler::PostMessage(Message* message, bool before_events) {
}
message = NULL; // Do not access message. May have been deleted.
- if (pool_ != NULL && task_ == NULL) {
+ if (running_ && task_ == NULL) {
task_ = new MessageHandlerTask(this);
- pool_->Run(task_);
+ ThreadPool::Run(task_);
}
}
// Invoke any custom message notification.
@@ -205,7 +204,7 @@ bool MessageHandler::HandleNextMessage() {
// We can only call HandleNextMessage when this handler is not
// assigned to a thread pool.
turnidge 2015/06/30 22:15:46 Update comment.
zra 2015/07/20 22:23:39 Done.
MonitorLocker ml(&monitor_);
- ASSERT(pool_ == NULL);
+ ASSERT(!running_);
#if defined(DEBUG)
CheckAccess();
#endif
@@ -288,7 +287,7 @@ void MessageHandler::TaskCallback() {
(ok ? "no live ports" : "error"),
name());
}
- pool_ = NULL;
+ running_ = false;
run_end_callback = true;
paused_on_exit_ = false;
}

Powered by Google App Engine
This is Rietveld 408576698