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 2934 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2945 }; | 2945 }; |
2946 | 2946 |
2947 | 2947 |
2948 static bool GetVM(Isolate* isolate, JSONStream* js) { | 2948 static bool GetVM(Isolate* isolate, JSONStream* js) { |
2949 JSONObject jsobj(js); | 2949 JSONObject jsobj(js); |
2950 jsobj.AddProperty("type", "VM"); | 2950 jsobj.AddProperty("type", "VM"); |
2951 jsobj.AddProperty("architectureBits", static_cast<intptr_t>(kBitsPerWord)); | 2951 jsobj.AddProperty("architectureBits", static_cast<intptr_t>(kBitsPerWord)); |
2952 jsobj.AddProperty("targetCPU", CPU::Id()); | 2952 jsobj.AddProperty("targetCPU", CPU::Id()); |
2953 jsobj.AddProperty("hostCPU", HostCPUFeatures::hardware()); | 2953 jsobj.AddProperty("hostCPU", HostCPUFeatures::hardware()); |
2954 jsobj.AddProperty("version", Version::String()); | 2954 jsobj.AddProperty("version", Version::String()); |
2955 // Send pid as a string because it allows us to avoid any issues with | 2955 jsobj.AddProperty("pid", OS::ProcessId()); |
2956 // pids > 53-bits (when consumed by JavaScript). | |
2957 // TODO(johnmccutchan): Codify how integers are sent across the service. | |
2958 jsobj.AddPropertyF("pid", "%" Pd "", OS::ProcessId()); | |
2959 jsobj.AddProperty("_assertsEnabled", isolate->flags().asserts()); | 2956 jsobj.AddProperty("_assertsEnabled", isolate->flags().asserts()); |
2960 jsobj.AddProperty("_typeChecksEnabled", isolate->flags().type_checks()); | 2957 jsobj.AddProperty("_typeChecksEnabled", isolate->flags().type_checks()); |
2961 int64_t start_time_millis = (Dart::vm_isolate()->start_time() / | 2958 int64_t start_time_millis = (Dart::vm_isolate()->start_time() / |
2962 kMicrosecondsPerMillisecond); | 2959 kMicrosecondsPerMillisecond); |
2963 jsobj.AddPropertyTimeMillis("startTime", start_time_millis); | 2960 jsobj.AddPropertyTimeMillis("startTime", start_time_millis); |
2964 // Construct the isolate list. | 2961 // Construct the isolate list. |
2965 { | 2962 { |
2966 JSONArray jsarr(&jsobj, "isolates"); | 2963 JSONArray jsarr(&jsobj, "isolates"); |
2967 ServiceIsolateVisitor visitor(&jsarr); | 2964 ServiceIsolateVisitor visitor(&jsarr); |
2968 Isolate::VisitIsolates(&visitor); | 2965 Isolate::VisitIsolates(&visitor); |
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3221 ServiceMethodDescriptor& method = service_methods_[i]; | 3218 ServiceMethodDescriptor& method = service_methods_[i]; |
3222 if (strcmp(method_name, method.name) == 0) { | 3219 if (strcmp(method_name, method.name) == 0) { |
3223 return &method; | 3220 return &method; |
3224 } | 3221 } |
3225 } | 3222 } |
3226 return NULL; | 3223 return NULL; |
3227 } | 3224 } |
3228 | 3225 |
3229 | 3226 |
3230 } // namespace dart | 3227 } // namespace dart |
OLD | NEW |