| OLD | NEW |
| 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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/bootstrap_natives.h" | 5 #include "vm/bootstrap_natives.h" |
| 6 | 6 |
| 7 #include "include/dart_api.h" | 7 #include "include/dart_api.h" |
| 8 | 8 |
| 9 #include "vm/debugger.h" | 9 #include "vm/debugger.h" |
| 10 #include "vm/exceptions.h" | 10 #include "vm/exceptions.h" |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 } | 27 } |
| 28 if (when.value()) { | 28 if (when.value()) { |
| 29 debugger->PauseDeveloper(msg); | 29 debugger->PauseDeveloper(msg); |
| 30 } | 30 } |
| 31 return when.raw(); | 31 return when.raw(); |
| 32 } | 32 } |
| 33 | 33 |
| 34 | 34 |
| 35 DEFINE_NATIVE_ENTRY(Developer_inspect, 1) { | 35 DEFINE_NATIVE_ENTRY(Developer_inspect, 1) { |
| 36 GET_NATIVE_ARGUMENT(Instance, inspectee, arguments->NativeArgAt(0)); | 36 GET_NATIVE_ARGUMENT(Instance, inspectee, arguments->NativeArgAt(0)); |
| 37 #ifndef PRODUCT |
| 37 if (FLAG_support_service) { | 38 if (FLAG_support_service) { |
| 38 Service::SendInspectEvent(isolate, inspectee); | 39 Service::SendInspectEvent(isolate, inspectee); |
| 39 } | 40 } |
| 41 #endif // !PRODUCT |
| 40 return inspectee.raw(); | 42 return inspectee.raw(); |
| 41 } | 43 } |
| 42 | 44 |
| 43 | 45 |
| 44 DEFINE_NATIVE_ENTRY(Developer_log, 8) { | 46 DEFINE_NATIVE_ENTRY(Developer_log, 8) { |
| 47 #if defined(PRODUCT) |
| 48 return Object::null(); |
| 49 #else |
| 45 if (!FLAG_support_service) { | 50 if (!FLAG_support_service) { |
| 46 return Object::null(); | 51 return Object::null(); |
| 47 } | 52 } |
| 48 GET_NON_NULL_NATIVE_ARGUMENT(String, message, arguments->NativeArgAt(0)); | 53 GET_NON_NULL_NATIVE_ARGUMENT(String, message, arguments->NativeArgAt(0)); |
| 49 GET_NON_NULL_NATIVE_ARGUMENT(Integer, timestamp, arguments->NativeArgAt(1)); | 54 GET_NON_NULL_NATIVE_ARGUMENT(Integer, timestamp, arguments->NativeArgAt(1)); |
| 50 GET_NON_NULL_NATIVE_ARGUMENT(Integer, sequence, arguments->NativeArgAt(2)); | 55 GET_NON_NULL_NATIVE_ARGUMENT(Integer, sequence, arguments->NativeArgAt(2)); |
| 51 GET_NON_NULL_NATIVE_ARGUMENT(Smi, level, arguments->NativeArgAt(3)); | 56 GET_NON_NULL_NATIVE_ARGUMENT(Smi, level, arguments->NativeArgAt(3)); |
| 52 GET_NON_NULL_NATIVE_ARGUMENT(String, name, arguments->NativeArgAt(4)); | 57 GET_NON_NULL_NATIVE_ARGUMENT(String, name, arguments->NativeArgAt(4)); |
| 53 GET_NATIVE_ARGUMENT(Instance, dart_zone, arguments->NativeArgAt(5)); | 58 GET_NATIVE_ARGUMENT(Instance, dart_zone, arguments->NativeArgAt(5)); |
| 54 GET_NATIVE_ARGUMENT(Instance, error, arguments->NativeArgAt(6)); | 59 GET_NATIVE_ARGUMENT(Instance, error, arguments->NativeArgAt(6)); |
| 55 GET_NATIVE_ARGUMENT(Instance, stack_trace, arguments->NativeArgAt(7)); | 60 GET_NATIVE_ARGUMENT(Instance, stack_trace, arguments->NativeArgAt(7)); |
| 56 Service::SendLogEvent(isolate, | 61 Service::SendLogEvent(isolate, |
| 57 sequence.AsInt64Value(), | 62 sequence.AsInt64Value(), |
| 58 timestamp.AsInt64Value(), | 63 timestamp.AsInt64Value(), |
| 59 level.Value(), | 64 level.Value(), |
| 60 name, | 65 name, |
| 61 message, | 66 message, |
| 62 dart_zone, | 67 dart_zone, |
| 63 error, | 68 error, |
| 64 stack_trace); | 69 stack_trace); |
| 65 return Object::null(); | 70 return Object::null(); |
| 71 #endif // PRODUCT |
| 66 } | 72 } |
| 67 | 73 |
| 68 | 74 |
| 69 DEFINE_NATIVE_ENTRY(Developer_postEvent, 2) { | 75 DEFINE_NATIVE_ENTRY(Developer_postEvent, 2) { |
| 76 #if defined(PRODUCT) |
| 77 return Object::null(); |
| 78 #else |
| 70 if (!FLAG_support_service) { | 79 if (!FLAG_support_service) { |
| 71 return Object::null(); | 80 return Object::null(); |
| 72 } | 81 } |
| 73 GET_NON_NULL_NATIVE_ARGUMENT(String, event_kind, arguments->NativeArgAt(0)); | 82 GET_NON_NULL_NATIVE_ARGUMENT(String, event_kind, arguments->NativeArgAt(0)); |
| 74 GET_NON_NULL_NATIVE_ARGUMENT(String, event_data, arguments->NativeArgAt(1)); | 83 GET_NON_NULL_NATIVE_ARGUMENT(String, event_data, arguments->NativeArgAt(1)); |
| 75 Service::SendExtensionEvent(isolate, event_kind, event_data); | 84 Service::SendExtensionEvent(isolate, event_kind, event_data); |
| 76 return Object::null(); | 85 return Object::null(); |
| 86 #endif // PRODUCT |
| 77 } | 87 } |
| 78 | 88 |
| 79 | 89 |
| 80 DEFINE_NATIVE_ENTRY(Developer_lookupExtension, 1) { | 90 DEFINE_NATIVE_ENTRY(Developer_lookupExtension, 1) { |
| 91 #if defined(PRODUCT) |
| 92 return Object::null(); |
| 93 #else |
| 81 if (!FLAG_support_service) { | 94 if (!FLAG_support_service) { |
| 82 return Object::null(); | 95 return Object::null(); |
| 83 } | 96 } |
| 84 GET_NON_NULL_NATIVE_ARGUMENT(String, name, arguments->NativeArgAt(0)); | 97 GET_NON_NULL_NATIVE_ARGUMENT(String, name, arguments->NativeArgAt(0)); |
| 85 return isolate->LookupServiceExtensionHandler(name); | 98 return isolate->LookupServiceExtensionHandler(name); |
| 99 #endif // PRODUCT |
| 86 } | 100 } |
| 87 | 101 |
| 88 | 102 |
| 89 DEFINE_NATIVE_ENTRY(Developer_registerExtension, 2) { | 103 DEFINE_NATIVE_ENTRY(Developer_registerExtension, 2) { |
| 104 #if defined(PRODUCT) |
| 105 return Object::null(); |
| 106 #else |
| 90 if (!FLAG_support_service) { | 107 if (!FLAG_support_service) { |
| 91 return Object::null(); | 108 return Object::null(); |
| 92 } | 109 } |
| 93 GET_NON_NULL_NATIVE_ARGUMENT(String, name, arguments->NativeArgAt(0)); | 110 GET_NON_NULL_NATIVE_ARGUMENT(String, name, arguments->NativeArgAt(0)); |
| 94 GET_NON_NULL_NATIVE_ARGUMENT(Instance, handler, arguments->NativeArgAt(1)); | 111 GET_NON_NULL_NATIVE_ARGUMENT(Instance, handler, arguments->NativeArgAt(1)); |
| 95 // We don't allow service extensions to be registered for the | 112 // We don't allow service extensions to be registered for the |
| 96 // service isolate. This can happen, for example, because the | 113 // service isolate. This can happen, for example, because the |
| 97 // service isolate uses dart:io. If we decide that we want to start | 114 // service isolate uses dart:io. If we decide that we want to start |
| 98 // supporting this in the future, it will take some work. | 115 // supporting this in the future, it will take some work. |
| 99 if (!ServiceIsolate::IsServiceIsolateDescendant(isolate)) { | 116 if (!ServiceIsolate::IsServiceIsolateDescendant(isolate)) { |
| 100 isolate->RegisterServiceExtensionHandler(name, handler); | 117 isolate->RegisterServiceExtensionHandler(name, handler); |
| 101 } | 118 } |
| 102 return Object::null(); | 119 return Object::null(); |
| 120 #endif // PRODUCT |
| 103 } | 121 } |
| 104 | 122 |
| 105 } // namespace dart | 123 } // namespace dart |
| OLD | NEW |