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

Unified Diff: runtime/vm/service.cc

Issue 2759533002: Remove legacy restart code (Closed)
Patch Set: asiva review Created 3 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/service.h ('k') | runtime/vm/thread.h » ('j') | 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 855229f3de76d26da70ee24e8f128cfbe46cc013..05f7fcdeba7ed62dbe0af5b77cf20021f312a966 100644
--- a/runtime/vm/service.cc
+++ b/runtime/vm/service.cc
@@ -813,9 +813,9 @@ void Service::PostError(const String& method_name,
}
-void Service::InvokeMethod(Isolate* I,
- const Array& msg,
- bool parameters_are_dart_objects) {
+RawError* Service::InvokeMethod(Isolate* I,
+ const Array& msg,
+ bool parameters_are_dart_objects) {
Thread* T = Thread::Current();
ASSERT(I == T->isolate());
ASSERT(I != NULL);
@@ -877,7 +877,7 @@ void Service::InvokeMethod(Isolate* I,
// For now, always return an error.
PrintInvalidParamError(&js, "_idZone");
js.PostReply();
- return;
+ return T->get_and_clear_sticky_error();
}
}
const char* c_method_name = method_name.ToCString();
@@ -886,7 +886,7 @@ void Service::InvokeMethod(Isolate* I,
if (method != NULL) {
if (!ValidateParameters(method->parameters, &js)) {
js.PostReply();
- return;
+ return T->get_and_clear_sticky_error();
}
if (method->entry(T, &js)) {
js.PostReply();
@@ -895,7 +895,7 @@ void Service::InvokeMethod(Isolate* I,
// so this case shouldn't be reached, at present.
UNIMPLEMENTED();
}
- return;
+ return T->get_and_clear_sticky_error();
}
EmbedderServiceHandler* handler = FindIsolateEmbedderHandler(c_method_name);
@@ -905,7 +905,7 @@ void Service::InvokeMethod(Isolate* I,
if (handler != NULL) {
EmbedderHandleMessage(handler, &js);
- return;
+ return T->get_and_clear_sticky_error();
}
const Instance& extension_handler =
@@ -915,32 +915,32 @@ void Service::InvokeMethod(Isolate* I,
param_values, reply_port, seq);
// Schedule was successful. Extension code will post a reply
// asynchronously.
- return;
+ return T->get_and_clear_sticky_error();
}
PrintUnrecognizedMethodError(&js);
js.PostReply();
- return;
+ return T->get_and_clear_sticky_error();
}
}
-void Service::HandleRootMessage(const Array& msg_instance) {
+RawError* Service::HandleRootMessage(const Array& msg_instance) {
Isolate* isolate = Isolate::Current();
- InvokeMethod(isolate, msg_instance);
+ return InvokeMethod(isolate, msg_instance);
}
-void Service::HandleObjectRootMessage(const Array& msg_instance) {
+RawError* Service::HandleObjectRootMessage(const Array& msg_instance) {
Isolate* isolate = Isolate::Current();
- InvokeMethod(isolate, msg_instance, true);
+ return InvokeMethod(isolate, msg_instance, true);
}
-void Service::HandleIsolateMessage(Isolate* isolate, const Array& msg) {
+RawError* Service::HandleIsolateMessage(Isolate* isolate, const Array& msg) {
ASSERT(isolate != NULL);
- InvokeMethod(isolate, msg);
- MaybePause(isolate);
+ const Error& error = Error::Handle(InvokeMethod(isolate, msg));
+ return MaybePause(isolate, error);
}
@@ -2538,14 +2538,18 @@ void Service::CheckForPause(Isolate* isolate, JSONStream* stream) {
}
-void Service::MaybePause(Isolate* isolate) {
+RawError* Service::MaybePause(Isolate* isolate, const Error& error) {
// Don't pause twice.
if (!isolate->IsPaused()) {
if (isolate->should_pause_post_service_request()) {
isolate->set_should_pause_post_service_request(false);
- isolate->PausePostRequest();
+ // Before pausing, restore the sticky error. The debugger will return it
+ // from PausePostRequest.
+ Thread::Current()->set_sticky_error(error);
+ return isolate->PausePostRequest();
}
}
+ return error.raw();
}
@@ -3861,18 +3865,6 @@ static bool GetVM(Thread* thread, JSONStream* js) {
}
-static const MethodParameter* restart_vm_params[] = {
- NO_ISOLATE_PARAMETER, NULL,
-};
-
-
-static bool RestartVM(Thread* thread, JSONStream* js) {
- Isolate::KillAllIsolates(Isolate::kVMRestartMsg);
- PrintSuccess(js);
- return true;
-}
-
-
static const char* exception_pause_mode_names[] = {
"All", "None", "Unhandled", NULL,
};
@@ -4142,8 +4134,6 @@ static const ServiceMethodDescriptor service_methods_[] = {
pause_params },
{ "removeBreakpoint", RemoveBreakpoint,
remove_breakpoint_params },
- { "_restartVM", RestartVM,
- restart_vm_params },
{ "reloadSources", ReloadSources,
reload_sources_params },
{ "_reloadSources", ReloadSources,
« no previous file with comments | « runtime/vm/service.h ('k') | runtime/vm/thread.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698