| OLD | NEW |
| 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 "platform/globals.h" | 8 #include "platform/globals.h" |
| 9 | 9 |
| 10 #include "vm/compiler.h" | 10 #include "vm/compiler.h" |
| (...skipping 744 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 755 return true; | 755 return true; |
| 756 } | 756 } |
| 757 | 757 |
| 758 | 758 |
| 759 void Service::SendEchoEvent(Isolate* isolate, const char* text) { | 759 void Service::SendEchoEvent(Isolate* isolate, const char* text) { |
| 760 JSONStream js; | 760 JSONStream js; |
| 761 { | 761 { |
| 762 JSONObject jsobj(&js); | 762 JSONObject jsobj(&js); |
| 763 { | 763 { |
| 764 JSONObject event(&jsobj, "event"); | 764 JSONObject event(&jsobj, "event"); |
| 765 event.AddProperty("type", "ServiceEvent"); | 765 event.AddProperty("type", "Event"); |
| 766 event.AddProperty("eventType", "_Echo"); | 766 event.AddProperty("eventType", "_Echo"); |
| 767 event.AddProperty("isolate", isolate); | 767 event.AddProperty("isolate", isolate); |
| 768 if (text != NULL) { | 768 if (text != NULL) { |
| 769 event.AddProperty("text", text); | 769 event.AddProperty("text", text); |
| 770 } | 770 } |
| 771 } | 771 } |
| 772 } | 772 } |
| 773 const String& message = String::Handle(String::New(js.ToCString())); | 773 const String& message = String::Handle(String::New(js.ToCString())); |
| 774 uint8_t data[] = {0, 128, 255}; | 774 uint8_t data[] = {0, 128, 255}; |
| 775 SendEvent(message, data, sizeof(data)); | 775 SendEvent(message, data, sizeof(data)); |
| (...skipping 1322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2098 } | 2098 } |
| 2099 if (isolate->message_handler()->paused_on_exit()) { | 2099 if (isolate->message_handler()->paused_on_exit()) { |
| 2100 isolate->message_handler()->set_pause_on_exit(false); | 2100 isolate->message_handler()->set_pause_on_exit(false); |
| 2101 JSONObject jsobj(js); | 2101 JSONObject jsobj(js); |
| 2102 jsobj.AddProperty("type", "Success"); | 2102 jsobj.AddProperty("type", "Success"); |
| 2103 // We don't send a resume event because we will be exiting. | 2103 // We don't send a resume event because we will be exiting. |
| 2104 return true; | 2104 return true; |
| 2105 } | 2105 } |
| 2106 if (isolate->debugger()->PauseEvent() != NULL) { | 2106 if (isolate->debugger()->PauseEvent() != NULL) { |
| 2107 if (step_param != NULL) { | 2107 if (step_param != NULL) { |
| 2108 if (strcmp(step_param, "into") == 0) { | 2108 if (strcmp(step_param, "Into") == 0) { |
| 2109 isolate->debugger()->SetSingleStep(); | 2109 isolate->debugger()->SetSingleStep(); |
| 2110 } else if (strcmp(step_param, "over") == 0) { | 2110 } else if (strcmp(step_param, "Over") == 0) { |
| 2111 isolate->debugger()->SetStepOver(); | 2111 isolate->debugger()->SetStepOver(); |
| 2112 } else if (strcmp(step_param, "out") == 0) { | 2112 } else if (strcmp(step_param, "Out") == 0) { |
| 2113 isolate->debugger()->SetStepOut(); | 2113 isolate->debugger()->SetStepOut(); |
| 2114 } else { | 2114 } else { |
| 2115 PrintInvalidParamError(js, "step"); | 2115 PrintInvalidParamError(js, "step"); |
| 2116 return true; | 2116 return true; |
| 2117 } | 2117 } |
| 2118 } | 2118 } |
| 2119 isolate->Resume(); | 2119 isolate->Resume(); |
| 2120 JSONObject jsobj(js); | 2120 JSONObject jsobj(js); |
| 2121 jsobj.AddProperty("type", "Success"); | 2121 jsobj.AddProperty("type", "Success"); |
| 2122 return true; | 2122 return true; |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2280 // snapshot in megabyte-sized chunks instead. | 2280 // snapshot in megabyte-sized chunks instead. |
| 2281 const intptr_t kChunkSize = 1 * MB; | 2281 const intptr_t kChunkSize = 1 * MB; |
| 2282 intptr_t num_chunks = | 2282 intptr_t num_chunks = |
| 2283 (stream.bytes_written() + (kChunkSize - 1)) / kChunkSize; | 2283 (stream.bytes_written() + (kChunkSize - 1)) / kChunkSize; |
| 2284 for (intptr_t i = 0; i < num_chunks; i++) { | 2284 for (intptr_t i = 0; i < num_chunks; i++) { |
| 2285 JSONStream js; | 2285 JSONStream js; |
| 2286 { | 2286 { |
| 2287 JSONObject jsobj(&js); | 2287 JSONObject jsobj(&js); |
| 2288 { | 2288 { |
| 2289 JSONObject event(&jsobj, "event"); | 2289 JSONObject event(&jsobj, "event"); |
| 2290 event.AddProperty("type", "ServiceEvent"); | 2290 event.AddProperty("type", "Event"); |
| 2291 event.AddProperty("eventType", "_Graph"); | 2291 event.AddProperty("eventType", "_Graph"); |
| 2292 event.AddProperty("isolate", isolate); | 2292 event.AddProperty("isolate", isolate); |
| 2293 | 2293 |
| 2294 event.AddProperty("chunkIndex", i); | 2294 event.AddProperty("chunkIndex", i); |
| 2295 event.AddProperty("chunkCount", num_chunks); | 2295 event.AddProperty("chunkCount", num_chunks); |
| 2296 event.AddProperty("nodeCount", node_count); | 2296 event.AddProperty("nodeCount", node_count); |
| 2297 } | 2297 } |
| 2298 jsobj.AddProperty("streamId", "_Graph"); | 2298 jsobj.AddProperty("streamId", "_Graph"); |
| 2299 } | 2299 } |
| 2300 | 2300 |
| (...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2690 ServiceMethodDescriptor& method = service_methods_[i]; | 2690 ServiceMethodDescriptor& method = service_methods_[i]; |
| 2691 if (strcmp(method_name, method.name) == 0) { | 2691 if (strcmp(method_name, method.name) == 0) { |
| 2692 return &method; | 2692 return &method; |
| 2693 } | 2693 } |
| 2694 } | 2694 } |
| 2695 return NULL; | 2695 return NULL; |
| 2696 } | 2696 } |
| 2697 | 2697 |
| 2698 | 2698 |
| 2699 } // namespace dart | 2699 } // namespace dart |
| OLD | NEW |