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

Unified Diff: runtime/vm/service.cc

Issue 2411153002: Make reloadSources service RPC public (Closed)
Patch Set: turnidge review Created 4 years, 2 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/service_event.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 efc5c24b304a3a46a81b962b952b86f92593ea3f..abd4271746543e867143265e5b5a6dfb7bb4e358 100644
--- a/runtime/vm/service.cc
+++ b/runtime/vm/service.cc
@@ -971,6 +971,7 @@ void Service::HandleObjectRootMessage(const Array& msg_instance) {
void Service::HandleIsolateMessage(Isolate* isolate, const Array& msg) {
ASSERT(isolate != NULL);
InvokeMethod(isolate, msg);
+ MaybePause(isolate);
}
@@ -1085,6 +1086,11 @@ static void ReportPauseOnConsole(ServiceEvent* event) {
"vm-service: isolate '%s' has no debugger attached and is paused.",
name);
break;
+ case ServiceEvent::kPausePostRequest:
+ OS::PrintErr(
+ "vm-service: isolate '%s' has no debugger attached and is paused "
+ "post reload.", name);
+ break;
default:
UNREACHABLE();
break;
@@ -2510,6 +2516,7 @@ static bool GetSourceReport(Thread* thread, JSONStream* js) {
static const MethodParameter* reload_sources_params[] = {
RUNNABLE_ISOLATE_PARAMETER,
new BoolParameter("force", false),
+ new BoolParameter("pause", false),
NULL,
};
@@ -2554,10 +2561,30 @@ static bool ReloadSources(Thread* thread, JSONStream* js) {
isolate->ReloadSources(js, force_reload);
+ Service::CheckForPause(isolate, js);
+
return true;
}
+void Service::CheckForPause(Isolate* isolate, JSONStream* stream) {
+ // Should we pause?
+ isolate->set_should_pause_post_service_request(
+ BoolParameter::Parse(stream->LookupParam("pause"), false));
+}
+
+
+void Service::MaybePause(Isolate* isolate) {
+ // Don't pause twice.
+ if (!isolate->IsPaused()) {
+ if (isolate->should_pause_post_service_request()) {
+ isolate->set_should_pause_post_service_request(false);
+ isolate->PausePostRequest();
+ }
+ }
+}
+
+
static bool AddBreakpointCommon(Thread* thread,
JSONStream* js,
const String& script_uri) {
@@ -4163,6 +4190,8 @@ static const ServiceMethodDescriptor service_methods_[] = {
remove_breakpoint_params },
{ "_restartVM", RestartVM,
restart_vm_params },
+ { "reloadSources", ReloadSources,
+ reload_sources_params },
{ "_reloadSources", ReloadSources,
reload_sources_params },
{ "resume", Resume,
« no previous file with comments | « runtime/vm/service.h ('k') | runtime/vm/service_event.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698