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

Unified Diff: runtime/vm/message_handler.cc

Issue 3006883002: Make service protocol respect isolate lifecycle (Closed)
Patch Set: Merged with upstream Created 3 years, 4 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/service_event.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/message_handler.cc
diff --git a/runtime/vm/message_handler.cc b/runtime/vm/message_handler.cc
index a6d7da81957f28f95736193f94e93155ea721c51..e35d72a3d0c27cc497d50bbf3362f189b2d37b40 100644
--- a/runtime/vm/message_handler.cc
+++ b/runtime/vm/message_handler.cc
@@ -517,14 +517,8 @@ void MessageHandler::PausedOnStart(bool paused) {
void MessageHandler::PausedOnStartLocked(MonitorLocker* ml, bool paused) {
if (paused) {
ASSERT(!is_paused_on_start_);
- is_paused_on_start_ = true;
+ ASSERT(paused_timestamp_ == -1);
paused_timestamp_ = OS::GetCurrentTimeMillis();
- } else {
- ASSERT(is_paused_on_start_);
- is_paused_on_start_ = false;
- paused_timestamp_ = -1;
- }
- if (is_paused_on_start_) {
// Temporarily release the monitor when calling out to
// NotifyPauseOnStart. This avoids a dead lock that can occur
// when this message handler tries to post a message while a
@@ -532,12 +526,17 @@ void MessageHandler::PausedOnStartLocked(MonitorLocker* ml, bool paused) {
ml->Exit();
NotifyPauseOnStart();
ml->Enter();
+ is_paused_on_start_ = true;
} else {
+ ASSERT(is_paused_on_start_);
+ ASSERT(paused_timestamp_ != -1);
+ paused_timestamp_ = -1;
// Resumed. Clear the resume request of the owning isolate.
Isolate* owning_isolate = isolate();
if (owning_isolate != NULL) {
owning_isolate->GetAndClearResumeRequest();
}
+ is_paused_on_start_ = false;
}
}
@@ -549,14 +548,8 @@ void MessageHandler::PausedOnExit(bool paused) {
void MessageHandler::PausedOnExitLocked(MonitorLocker* ml, bool paused) {
if (paused) {
ASSERT(!is_paused_on_exit_);
- is_paused_on_exit_ = true;
+ ASSERT(paused_timestamp_ == -1);
paused_timestamp_ = OS::GetCurrentTimeMillis();
- } else {
- ASSERT(is_paused_on_exit_);
- is_paused_on_exit_ = false;
- paused_timestamp_ = -1;
- }
- if (is_paused_on_exit_) {
// Temporarily release the monitor when calling out to
// NotifyPauseOnExit. This avoids a dead lock that can
// occur when this message handler tries to post a message
@@ -564,12 +557,17 @@ void MessageHandler::PausedOnExitLocked(MonitorLocker* ml, bool paused) {
ml->Exit();
NotifyPauseOnExit();
ml->Enter();
+ is_paused_on_exit_ = true;
} else {
+ ASSERT(is_paused_on_exit_);
+ ASSERT(paused_timestamp_ != -1);
+ paused_timestamp_ = -1;
// Resumed. Clear the resume request of the owning isolate.
Isolate* owning_isolate = isolate();
if (owning_isolate != NULL) {
owning_isolate->GetAndClearResumeRequest();
}
+ is_paused_on_exit_ = false;
}
}
#endif // !defined(PRODUCT)
« no previous file with comments | « runtime/vm/isolate.cc ('k') | runtime/vm/service_event.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698