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

Unified Diff: runtime/vm/service.cc

Issue 1399743002: Straw man setExceptionPauseMode (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 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/isolate.cc ('k') | runtime/vm/service/service.md » ('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 b2205cf48ddb80c0cb4e50e6a013315580e0e8c0..a0f7f1b91fea8b326b44e71c57be036aba6584ae 100644
--- a/runtime/vm/service.cc
+++ b/runtime/vm/service.cc
@@ -3007,33 +3007,41 @@ static bool RestartVM(Isolate* isolate, JSONStream* js) {
}
-static const MethodParameter* set_exception_pause_info_params[] = {
+static const char* exception_pause_mode_names[] = {
+ "All",
+ "None",
+ "Unhandled",
+ NULL,
+};
+
+
+static Dart_ExceptionPauseInfo exception_pause_mode_values[] = {
+ kPauseOnAllExceptions,
+ kNoPauseOnExceptions,
+ kPauseOnUnhandledExceptions,
+ static_cast<Dart_ExceptionPauseInfo>(-1), // Fall through.
+};
+
+
+static const MethodParameter* set_exception_pause_mode_params[] = {
ISOLATE_PARAMETER,
+ new EnumParameter("mode", true, exception_pause_mode_names),
NULL,
};
-static bool SetExceptionPauseInfo(Isolate* isolate, JSONStream* js) {
- const char* exceptions = js->LookupParam("exceptions");
- if (exceptions == NULL) {
- PrintMissingParamError(js, "exceptions");
+static bool SetExceptionPauseMode(Isolate* isolate, JSONStream* js) {
+ const char* mode = js->LookupParam("mode");
+ if (mode == NULL) {
+ PrintMissingParamError(js, "mode");
return true;
}
-
- Dart_ExceptionPauseInfo info = kNoPauseOnExceptions;
- if (strcmp(exceptions, "none") == 0) {
- info = kNoPauseOnExceptions;
- } else if (strcmp(exceptions, "all") == 0) {
- info = kPauseOnAllExceptions;
- } else if (strcmp(exceptions, "unhandled") == 0) {
- info = kPauseOnUnhandledExceptions;
- } else {
- JSONObject jsobj(js);
- jsobj.AddProperty("type", "Error");
- jsobj.AddProperty("message", "illegal value for parameter 'exceptions'");
+ Dart_ExceptionPauseInfo info =
+ EnumMapper(mode, exception_pause_mode_names, exception_pause_mode_values);
+ if (info == -1) {
+ PrintInvalidParamError(js, "mode");
return true;
}
-
isolate->debugger()->SetExceptionPauseInfo(info);
if (Service::debug_stream.enabled()) {
ServiceEvent event(isolate, ServiceEvent::kDebuggerSettingsUpdate);
@@ -3258,8 +3266,8 @@ static ServiceMethodDescriptor service_methods_[] = {
resume_params },
{ "_requestHeapSnapshot", RequestHeapSnapshot,
request_heap_snapshot_params },
- { "_setExceptionPauseInfo", SetExceptionPauseInfo,
- set_exception_pause_info_params },
+ { "setExceptionPauseMode", SetExceptionPauseMode,
+ set_exception_pause_mode_params },
{ "_setFlag", SetFlag,
set_flags_params },
{ "setLibraryDebuggable", SetLibraryDebuggable,
« no previous file with comments | « runtime/vm/isolate.cc ('k') | runtime/vm/service/service.md » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698