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

Unified Diff: runtime/vm/service.cc

Issue 204003002: Support wedging isolates before startup or before exit. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/vm/message_handler.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/service.cc
diff --git a/runtime/vm/service.cc b/runtime/vm/service.cc
index 35178e3007804bff98da41b2dd03cb6f1f71fb42..ece6c7085182f07a3d387f079659bca95d836b58 100644
--- a/runtime/vm/service.cc
+++ b/runtime/vm/service.cc
@@ -14,6 +14,7 @@
#include "vm/debugger.h"
#include "vm/isolate.h"
#include "vm/message.h"
+#include "vm/message_handler.h"
#include "vm/native_entry.h"
#include "vm/native_arguments.h"
#include "vm/object.h"
@@ -263,6 +264,9 @@ Isolate* Service::GetServiceIsolate(void* callback_data) {
if (isolate == NULL) {
return NULL;
}
+ // We don't want to pause the service isolate.
+ isolate->message_handler()->set_pause_on_start(false);
+ isolate->message_handler()->set_pause_on_exit(false);
Isolate::SetCurrent(isolate);
{
// Install the dart:vmservice library.
@@ -366,6 +370,11 @@ bool Service::SendIsolateStartupMessage() {
MessageWriter writer(&data, &allocator);
writer.WriteMessage(list);
intptr_t len = writer.BytesWritten();
+ if (FLAG_trace_service) {
+ OS::Print("Isolate %s %" Pd64 " registered with service \n",
+ name.ToCString(),
+ Dart_GetMainPortId());
+ }
return PortMap::PostMessage(
new Message(port_, data, len, Message::kNormalPriority));
}
@@ -378,15 +387,22 @@ bool Service::SendIsolateShutdownMessage() {
Isolate* isolate = Isolate::Current();
ASSERT(isolate != NULL);
HANDLESCOPE(isolate);
+ const String& name = String::Handle(String::New(isolate->name()));
+ ASSERT(!name.IsNull());
const Array& list = Array::Handle(
MakeServiceControlMessage(Dart_GetMainPortId(),
VM_SERVICE_ISOLATE_SHUTDOWN_MESSAGE_ID,
- String::Handle(String::null())));
+ name));
ASSERT(!list.IsNull());
uint8_t* data = NULL;
MessageWriter writer(&data, &allocator);
writer.WriteMessage(list);
intptr_t len = writer.BytesWritten();
+ if (FLAG_trace_service) {
+ OS::Print("Isolate %s %" Pd64 " deregistered with service \n",
+ name.ToCString(),
+ Dart_GetMainPortId());
+ }
return PortMap::PostMessage(
new Message(port_, data, len, Message::kNormalPriority));
}
@@ -1414,9 +1430,16 @@ static bool HandleAllocationProfile(Isolate* isolate, JSONStream* js) {
}
-static bool HandleUnpin(Isolate* isolate, JSONStream* js) {
+static bool HandleResume(Isolate* isolate, JSONStream* js) {
// TODO(johnmccutchan): What do I respond with??
- isolate->ClosePinPort();
+ if (isolate->message_handler()->pause_on_start()) {
+ isolate->message_handler()->set_pause_on_start(false);
+ return true;
+ }
+ if (isolate->message_handler()->pause_on_exit()) {
+ isolate->message_handler()->set_pause_on_exit(false);
+ return true;
+ }
return true;
}
@@ -1440,7 +1463,7 @@ static IsolateMessageHandlerEntry isolate_handlers[] = {
{ "libraries", HandleLibraries },
{ "objects", HandleObjects },
{ "profile", HandleProfile },
- { "unpin", HandleUnpin },
+ { "resume", HandleResume },
{ "scripts", HandleScripts },
{ "stacktrace", HandleStackTrace },
};
« no previous file with comments | « runtime/vm/message_handler.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698