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

Unified Diff: runtime/vm/service.cc

Issue 271153002: Add pause/resume for isolates in vmservice/observatory. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: gen js Created 6 years, 7 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.h ('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 5b3f7789177fc3b6562aff0a32747d8e5ce70fc2..41c3ff519b2516ac9d42eab8957f4119bc3d717c 100644
--- a/runtime/vm/service.cc
+++ b/runtime/vm/service.cc
@@ -1391,6 +1391,34 @@ static bool HandleScripts(Isolate* isolate, JSONStream* js) {
}
+static bool HandleDebugResume(Isolate* isolate, JSONStream* js) {
+ if (isolate->message_handler()->paused_on_start()) {
+ isolate->message_handler()->set_pause_on_start(false);
+ JSONObject jsobj(js);
+ jsobj.AddProperty("type", "Success");
+ jsobj.AddProperty("id", "");
+ return true;
+ }
+ if (isolate->message_handler()->paused_on_exit()) {
+ isolate->message_handler()->set_pause_on_exit(false);
+ JSONObject jsobj(js);
+ jsobj.AddProperty("type", "Success");
+ jsobj.AddProperty("id", "");
+ return true;
+ }
+ if (isolate->debugger()->PauseEvent() != NULL) {
+ isolate->Resume();
+ JSONObject jsobj(js);
+ jsobj.AddProperty("type", "Success");
+ jsobj.AddProperty("id", "");
+ return true;
+ }
+
+ PrintError(js, "VM was not paused");
+ return true;
+}
+
+
static bool HandleDebug(Isolate* isolate, JSONStream* js) {
if (js->num_arguments() == 1) {
PrintError(js, "Must specify a subcommand");
@@ -1423,6 +1451,25 @@ static bool HandleDebug(Isolate* isolate, JSONStream* js) {
PrintError(js, "Command too long");
return true;
}
+ } else if (strcmp(command, "pause") == 0) {
+ if (js->num_arguments() == 2) {
+ // TODO(turnidge): Don't double-interrupt the isolate here.
+ isolate->ScheduleInterrupts(Isolate::kApiInterrupt);
+ JSONObject jsobj(js);
+ jsobj.AddProperty("type", "Success");
+ jsobj.AddProperty("id", "");
+ return true;
+ } else {
+ PrintError(js, "Command too long");
+ return true;
+ }
+ } else if (strcmp(command, "resume") == 0) {
+ if (js->num_arguments() == 2) {
+ return HandleDebugResume(isolate, js);
+ } else {
+ PrintError(js, "Command too long");
+ return true;
+ }
} else {
PrintError(js, "Unrecognized subcommand '%s'", js->GetArgument(1));
return true;
@@ -1575,27 +1622,6 @@ static bool HandleAllocationProfile(Isolate* isolate, JSONStream* js) {
}
-static bool HandleResume(Isolate* isolate, JSONStream* js) {
- if (isolate->message_handler()->pause_on_start()) {
- isolate->message_handler()->set_pause_on_start(false);
- JSONObject jsobj(js);
- jsobj.AddProperty("type", "Success");
- jsobj.AddProperty("id", "");
- return true;
- }
- if (isolate->message_handler()->pause_on_exit()) {
- isolate->message_handler()->set_pause_on_exit(false);
- JSONObject jsobj(js);
- jsobj.AddProperty("type", "Success");
- jsobj.AddProperty("id", "");
- return true;
- }
-
- PrintError(js, "VM was not paused");
- return true;
-}
-
-
static bool HandleTypeArguments(Isolate* isolate, JSONStream* js) {
ObjectStore* object_store = isolate->object_store();
const Array& table = Array::Handle(object_store->canonical_type_arguments());
@@ -1730,7 +1756,6 @@ static IsolateMessageHandlerEntry isolate_handlers[] = {
{ "libraries", HandleLibraries },
{ "objects", HandleObjects },
{ "profile", HandleProfile },
- { "resume", HandleResume },
{ "scripts", HandleScripts },
{ "stacktrace", HandleStackTrace },
{ "typearguments", HandleTypeArguments },
« no previous file with comments | « runtime/vm/message_handler.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698