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 "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 966 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
977 JSONObject params(&jsobj, "params"); | 977 JSONObject params(&jsobj, "params"); |
978 params.AddProperty("streamId", echo_stream.id()); | 978 params.AddProperty("streamId", echo_stream.id()); |
979 { | 979 { |
980 JSONObject event(¶ms, "event"); | 980 JSONObject event(¶ms, "event"); |
981 event.AddProperty("type", "Event"); | 981 event.AddProperty("type", "Event"); |
982 event.AddProperty("kind", "_Echo"); | 982 event.AddProperty("kind", "_Echo"); |
983 event.AddProperty("isolate", isolate); | 983 event.AddProperty("isolate", isolate); |
984 if (text != NULL) { | 984 if (text != NULL) { |
985 event.AddProperty("text", text); | 985 event.AddProperty("text", text); |
986 } | 986 } |
| 987 event.AddPropertyTimeMillis("timestamp", OS::GetCurrentTimeMillis()); |
987 } | 988 } |
988 } | 989 } |
989 } | 990 } |
990 const String& message = String::Handle(String::New(js.ToCString())); | 991 const String& message = String::Handle(String::New(js.ToCString())); |
991 uint8_t data[] = {0, 128, 255}; | 992 uint8_t data[] = {0, 128, 255}; |
992 SendEventWithData(echo_stream.id(), "_Echo", message, data, sizeof(data)); | 993 SendEventWithData(echo_stream.id(), "_Echo", message, data, sizeof(data)); |
993 } | 994 } |
994 | 995 |
995 | 996 |
996 static bool TriggerEchoEvent(Isolate* isolate, JSONStream* js) { | 997 static bool TriggerEchoEvent(Isolate* isolate, JSONStream* js) { |
(...skipping 1539 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2536 jsobj.AddProperty("jsonrpc", "2.0"); | 2537 jsobj.AddProperty("jsonrpc", "2.0"); |
2537 jsobj.AddProperty("method", "streamNotify"); | 2538 jsobj.AddProperty("method", "streamNotify"); |
2538 { | 2539 { |
2539 JSONObject params(&jsobj, "params"); | 2540 JSONObject params(&jsobj, "params"); |
2540 params.AddProperty("streamId", graph_stream.id()); | 2541 params.AddProperty("streamId", graph_stream.id()); |
2541 { | 2542 { |
2542 JSONObject event(¶ms, "event"); | 2543 JSONObject event(¶ms, "event"); |
2543 event.AddProperty("type", "Event"); | 2544 event.AddProperty("type", "Event"); |
2544 event.AddProperty("kind", "_Graph"); | 2545 event.AddProperty("kind", "_Graph"); |
2545 event.AddProperty("isolate", isolate); | 2546 event.AddProperty("isolate", isolate); |
| 2547 event.AddPropertyTimeMillis("timestamp", OS::GetCurrentTimeMillis()); |
2546 | 2548 |
2547 event.AddProperty("chunkIndex", i); | 2549 event.AddProperty("chunkIndex", i); |
2548 event.AddProperty("chunkCount", num_chunks); | 2550 event.AddProperty("chunkCount", num_chunks); |
2549 event.AddProperty("nodeCount", node_count); | 2551 event.AddProperty("nodeCount", node_count); |
2550 } | 2552 } |
2551 } | 2553 } |
2552 } | 2554 } |
2553 | 2555 |
2554 const String& message = String::Handle(String::New(js.ToCString())); | 2556 const String& message = String::Handle(String::New(js.ToCString())); |
2555 | 2557 |
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2868 jsobj.AddProperty("hostCPU", HostCPUFeatures::hardware()); | 2870 jsobj.AddProperty("hostCPU", HostCPUFeatures::hardware()); |
2869 jsobj.AddProperty("version", Version::String()); | 2871 jsobj.AddProperty("version", Version::String()); |
2870 // Send pid as a string because it allows us to avoid any issues with | 2872 // Send pid as a string because it allows us to avoid any issues with |
2871 // pids > 53-bits (when consumed by JavaScript). | 2873 // pids > 53-bits (when consumed by JavaScript). |
2872 // TODO(johnmccutchan): Codify how integers are sent across the service. | 2874 // TODO(johnmccutchan): Codify how integers are sent across the service. |
2873 jsobj.AddPropertyF("pid", "%" Pd "", OS::ProcessId()); | 2875 jsobj.AddPropertyF("pid", "%" Pd "", OS::ProcessId()); |
2874 jsobj.AddProperty("_assertsEnabled", isolate->flags().asserts()); | 2876 jsobj.AddProperty("_assertsEnabled", isolate->flags().asserts()); |
2875 jsobj.AddProperty("_typeChecksEnabled", isolate->flags().type_checks()); | 2877 jsobj.AddProperty("_typeChecksEnabled", isolate->flags().type_checks()); |
2876 int64_t start_time_millis = (Dart::vm_isolate()->start_time() / | 2878 int64_t start_time_millis = (Dart::vm_isolate()->start_time() / |
2877 kMicrosecondsPerMillisecond); | 2879 kMicrosecondsPerMillisecond); |
2878 jsobj.AddProperty64("startTime", start_time_millis); | 2880 jsobj.AddPropertyTimeMillis("startTime", start_time_millis); |
2879 // Construct the isolate list. | 2881 // Construct the isolate list. |
2880 { | 2882 { |
2881 JSONArray jsarr(&jsobj, "isolates"); | 2883 JSONArray jsarr(&jsobj, "isolates"); |
2882 ServiceIsolateVisitor visitor(&jsarr); | 2884 ServiceIsolateVisitor visitor(&jsarr); |
2883 Isolate::VisitIsolates(&visitor); | 2885 Isolate::VisitIsolates(&visitor); |
2884 } | 2886 } |
2885 return true; | 2887 return true; |
2886 } | 2888 } |
2887 | 2889 |
2888 | 2890 |
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3134 ServiceMethodDescriptor& method = service_methods_[i]; | 3136 ServiceMethodDescriptor& method = service_methods_[i]; |
3135 if (strcmp(method_name, method.name) == 0) { | 3137 if (strcmp(method_name, method.name) == 0) { |
3136 return &method; | 3138 return &method; |
3137 } | 3139 } |
3138 } | 3140 } |
3139 return NULL; | 3141 return NULL; |
3140 } | 3142 } |
3141 | 3143 |
3142 | 3144 |
3143 } // namespace dart | 3145 } // namespace dart |
OLD | NEW |