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

Side by Side Diff: runtime/vm/service.cc

Issue 1665773004: Add necessary support functions so that embedders can implemented pause on start and exit (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 10 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 unified diff | Download patch
« no previous file with comments | « runtime/vm/message_handler.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "vm/service.h" 5 #include "vm/service.h"
6 6
7 #include "include/dart_api.h" 7 #include "include/dart_api.h"
8 #include "include/dart_native_api.h" 8 #include "include/dart_native_api.h"
9 #include "platform/globals.h" 9 #include "platform/globals.h"
10 10
(...skipping 2940 matching lines...) Expand 10 before | Expand all | Expand 10 after
2951 2951
2952 static const MethodParameter* resume_params[] = { 2952 static const MethodParameter* resume_params[] = {
2953 RUNNABLE_ISOLATE_PARAMETER, 2953 RUNNABLE_ISOLATE_PARAMETER,
2954 NULL, 2954 NULL,
2955 }; 2955 };
2956 2956
2957 2957
2958 static bool Resume(Thread* thread, JSONStream* js) { 2958 static bool Resume(Thread* thread, JSONStream* js) {
2959 const char* step_param = js->LookupParam("step"); 2959 const char* step_param = js->LookupParam("step");
2960 Isolate* isolate = thread->isolate(); 2960 Isolate* isolate = thread->isolate();
2961 if (isolate->message_handler()->paused_on_start()) { 2961 if (isolate->message_handler()->is_paused_on_start()) {
2962 // If the user is issuing a 'Over' or an 'Out' step, that is the 2962 // If the user is issuing a 'Over' or an 'Out' step, that is the
2963 // same as a regular resume request. 2963 // same as a regular resume request.
2964 if ((step_param != NULL) && (strcmp(step_param, "Into") == 0)) { 2964 if ((step_param != NULL) && (strcmp(step_param, "Into") == 0)) {
2965 isolate->debugger()->EnterSingleStepMode(); 2965 isolate->debugger()->EnterSingleStepMode();
2966 } 2966 }
2967 isolate->message_handler()->set_pause_on_start(false); 2967 isolate->message_handler()->set_should_pause_on_start(false);
2968 isolate->set_last_resume_timestamp(); 2968 isolate->SetResumeRequest();
2969 if (Service::debug_stream.enabled()) { 2969 if (Service::debug_stream.enabled()) {
2970 ServiceEvent event(isolate, ServiceEvent::kResume); 2970 ServiceEvent event(isolate, ServiceEvent::kResume);
2971 Service::HandleEvent(&event); 2971 Service::HandleEvent(&event);
2972 } 2972 }
2973 PrintSuccess(js); 2973 PrintSuccess(js);
2974 return true; 2974 return true;
2975 } 2975 }
2976 if (isolate->message_handler()->paused_on_exit()) { 2976 if (isolate->message_handler()->is_paused_on_exit()) {
2977 isolate->message_handler()->set_pause_on_exit(false); 2977 isolate->message_handler()->set_should_pause_on_exit(false);
2978 isolate->SetResumeRequest();
2978 // We don't send a resume event because we will be exiting. 2979 // We don't send a resume event because we will be exiting.
2979 PrintSuccess(js); 2980 PrintSuccess(js);
2980 return true; 2981 return true;
2981 } 2982 }
2982 if (isolate->debugger()->PauseEvent() != NULL) { 2983 if (isolate->debugger()->PauseEvent() != NULL) {
2983 if (step_param != NULL) { 2984 if (step_param != NULL) {
2984 if (strcmp(step_param, "Into") == 0) { 2985 if (strcmp(step_param, "Into") == 0) {
2985 isolate->debugger()->SetSingleStep(); 2986 isolate->debugger()->SetSingleStep();
2986 } else if (strcmp(step_param, "Over") == 0) { 2987 } else if (strcmp(step_param, "Over") == 0) {
2987 isolate->debugger()->SetStepOver(); 2988 isolate->debugger()->SetStepOver();
2988 } else if (strcmp(step_param, "Out") == 0) { 2989 } else if (strcmp(step_param, "Out") == 0) {
2989 isolate->debugger()->SetStepOut(); 2990 isolate->debugger()->SetStepOut();
2990 } else { 2991 } else {
2991 PrintInvalidParamError(js, "step"); 2992 PrintInvalidParamError(js, "step");
2992 return true; 2993 return true;
2993 } 2994 }
2994 } 2995 }
2995 isolate->Resume(); 2996 isolate->SetResumeRequest();
2996 PrintSuccess(js); 2997 PrintSuccess(js);
2997 return true; 2998 return true;
2998 } 2999 }
2999 3000
3000 js->PrintError(kVMMustBePaused, NULL); 3001 js->PrintError(kVMMustBePaused, NULL);
3001 return true; 3002 return true;
3002 } 3003 }
3003 3004
3004 3005
3005 static const MethodParameter* pause_params[] = { 3006 static const MethodParameter* pause_params[] = {
(...skipping 946 matching lines...) Expand 10 before | Expand all | Expand 10 after
3952 const ServiceMethodDescriptor& method = service_methods_[i]; 3953 const ServiceMethodDescriptor& method = service_methods_[i];
3953 if (strcmp(method_name, method.name) == 0) { 3954 if (strcmp(method_name, method.name) == 0) {
3954 return &method; 3955 return &method;
3955 } 3956 }
3956 } 3957 }
3957 return NULL; 3958 return NULL;
3958 } 3959 }
3959 3960
3960 3961
3961 } // namespace dart 3962 } // namespace dart
OLDNEW
« 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