| 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 745 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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", "Event"); | 765 event.AddProperty("type", "Event"); |
| 766 event.AddProperty("eventType", "_Echo"); | 766 event.AddProperty("kind", "_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)); |
| 776 } | 776 } |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 844 } | 844 } |
| 845 const Integer& obj = | 845 const Integer& obj = |
| 846 Integer::Handle(isolate, Smi::New(static_cast<intptr_t>(value))); | 846 Integer::Handle(isolate, Smi::New(static_cast<intptr_t>(value))); |
| 847 return obj.raw(); | 847 return obj.raw(); |
| 848 } else if (strcmp(arg, "bool-true") == 0) { | 848 } else if (strcmp(arg, "bool-true") == 0) { |
| 849 return Bool::True().raw(); | 849 return Bool::True().raw(); |
| 850 } else if (strcmp(arg, "bool-false") == 0) { | 850 } else if (strcmp(arg, "bool-false") == 0) { |
| 851 return Bool::False().raw(); | 851 return Bool::False().raw(); |
| 852 } else if (strcmp(arg, "null") == 0) { | 852 } else if (strcmp(arg, "null") == 0) { |
| 853 return Object::null(); | 853 return Object::null(); |
| 854 } else if (strcmp(arg, "not-initialized") == 0) { | |
| 855 return Object::sentinel().raw(); | |
| 856 } else if (strcmp(arg, "being-initialized") == 0) { | |
| 857 return Object::transition_sentinel().raw(); | |
| 858 } | 854 } |
| 859 | 855 |
| 860 ObjectIdRing* ring = isolate->object_id_ring(); | 856 ObjectIdRing* ring = isolate->object_id_ring(); |
| 861 ASSERT(ring != NULL); | 857 ASSERT(ring != NULL); |
| 862 intptr_t id = -1; | 858 intptr_t id = -1; |
| 863 if (!GetIntegerId(arg, &id)) { | 859 if (!GetIntegerId(arg, &id)) { |
| 864 *kind = ObjectIdRing::kInvalid; | 860 *kind = ObjectIdRing::kInvalid; |
| 865 return Object::null(); | 861 return Object::null(); |
| 866 } | 862 } |
| 867 return ring->GetObjectForId(id, kind); | 863 return ring->GetObjectForId(id, kind); |
| (...skipping 1008 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1876 | 1872 |
| 1877 | 1873 |
| 1878 static bool RemoveBreakpoint(Isolate* isolate, JSONStream* js) { | 1874 static bool RemoveBreakpoint(Isolate* isolate, JSONStream* js) { |
| 1879 if (!js->HasParam("breakpointId")) { | 1875 if (!js->HasParam("breakpointId")) { |
| 1880 PrintMissingParamError(js, "breakpointId"); | 1876 PrintMissingParamError(js, "breakpointId"); |
| 1881 return true; | 1877 return true; |
| 1882 } | 1878 } |
| 1883 const char* bpt_id = js->LookupParam("breakpointId"); | 1879 const char* bpt_id = js->LookupParam("breakpointId"); |
| 1884 Breakpoint* bpt = LookupBreakpoint(isolate, bpt_id); | 1880 Breakpoint* bpt = LookupBreakpoint(isolate, bpt_id); |
| 1885 if (bpt == NULL) { | 1881 if (bpt == NULL) { |
| 1886 fprintf(stderr, "ERROR1"); | |
| 1887 PrintInvalidParamError(js, "breakpointId"); | 1882 PrintInvalidParamError(js, "breakpointId"); |
| 1888 return true; | 1883 return true; |
| 1889 } | 1884 } |
| 1890 isolate->debugger()->RemoveBreakpoint(bpt->id()); | 1885 isolate->debugger()->RemoveBreakpoint(bpt->id()); |
| 1891 | 1886 |
| 1892 // TODO(turnidge): Consider whether the 'Success' type is proper. | 1887 // TODO(turnidge): Consider whether the 'Success' type is proper. |
| 1893 JSONObject jsobj(js); | 1888 JSONObject jsobj(js); |
| 1894 jsobj.AddProperty("type", "Success"); | 1889 jsobj.AddProperty("type", "Success"); |
| 1895 return true; | 1890 return true; |
| 1896 } | 1891 } |
| (...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2281 const intptr_t kChunkSize = 1 * MB; | 2276 const intptr_t kChunkSize = 1 * MB; |
| 2282 intptr_t num_chunks = | 2277 intptr_t num_chunks = |
| 2283 (stream.bytes_written() + (kChunkSize - 1)) / kChunkSize; | 2278 (stream.bytes_written() + (kChunkSize - 1)) / kChunkSize; |
| 2284 for (intptr_t i = 0; i < num_chunks; i++) { | 2279 for (intptr_t i = 0; i < num_chunks; i++) { |
| 2285 JSONStream js; | 2280 JSONStream js; |
| 2286 { | 2281 { |
| 2287 JSONObject jsobj(&js); | 2282 JSONObject jsobj(&js); |
| 2288 { | 2283 { |
| 2289 JSONObject event(&jsobj, "event"); | 2284 JSONObject event(&jsobj, "event"); |
| 2290 event.AddProperty("type", "Event"); | 2285 event.AddProperty("type", "Event"); |
| 2291 event.AddProperty("eventType", "_Graph"); | 2286 event.AddProperty("kind", "_Graph"); |
| 2292 event.AddProperty("isolate", isolate); | 2287 event.AddProperty("isolate", isolate); |
| 2293 | 2288 |
| 2294 event.AddProperty("chunkIndex", i); | 2289 event.AddProperty("chunkIndex", i); |
| 2295 event.AddProperty("chunkCount", num_chunks); | 2290 event.AddProperty("chunkCount", num_chunks); |
| 2296 event.AddProperty("nodeCount", node_count); | 2291 event.AddProperty("nodeCount", node_count); |
| 2297 } | 2292 } |
| 2298 jsobj.AddProperty("streamId", "_Graph"); | 2293 jsobj.AddProperty("streamId", "_Graph"); |
| 2299 } | 2294 } |
| 2300 | 2295 |
| 2301 const String& message = String::Handle(String::New(js.ToCString())); | 2296 const String& message = String::Handle(String::New(js.ToCString())); |
| (...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2690 ServiceMethodDescriptor& method = service_methods_[i]; | 2685 ServiceMethodDescriptor& method = service_methods_[i]; |
| 2691 if (strcmp(method_name, method.name) == 0) { | 2686 if (strcmp(method_name, method.name) == 0) { |
| 2692 return &method; | 2687 return &method; |
| 2693 } | 2688 } |
| 2694 } | 2689 } |
| 2695 return NULL; | 2690 return NULL; |
| 2696 } | 2691 } |
| 2697 | 2692 |
| 2698 | 2693 |
| 2699 } // namespace dart | 2694 } // namespace dart |
| OLD | NEW |