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" |
11 #include "vm/flags.h" | 11 #include "vm/flags.h" |
12 #include "vm/native_entry.h" | 12 #include "vm/native_entry.h" |
13 #include "vm/object.h" | 13 #include "vm/object.h" |
14 #include "vm/object_store.h" | 14 #include "vm/object_store.h" |
15 #include "vm/service.h" | 15 #include "vm/service.h" |
| 16 #include "vm/service_isolate.h" |
16 | 17 |
17 namespace dart { | 18 namespace dart { |
18 | 19 |
19 // Native implementations for the dart:developer library. | 20 // Native implementations for the dart:developer library. |
20 | 21 |
21 DEFINE_NATIVE_ENTRY(Developer_debugger, 2) { | 22 DEFINE_NATIVE_ENTRY(Developer_debugger, 2) { |
22 GET_NON_NULL_NATIVE_ARGUMENT(Bool, when, arguments->NativeArgAt(0)); | 23 GET_NON_NULL_NATIVE_ARGUMENT(Bool, when, arguments->NativeArgAt(0)); |
23 GET_NATIVE_ARGUMENT(String, msg, arguments->NativeArgAt(1)); | 24 GET_NATIVE_ARGUMENT(String, msg, arguments->NativeArgAt(1)); |
24 Debugger* debugger = isolate->debugger(); | 25 Debugger* debugger = isolate->debugger(); |
25 if (!FLAG_support_debugger || !debugger) { | 26 if (!FLAG_support_debugger || !debugger) { |
26 return when.raw(); | 27 return when.raw(); |
27 } | 28 } |
28 if (when.value()) { | 29 if (when.value()) { |
29 debugger->BreakHere(msg); | 30 debugger->PauseDeveloper(msg); |
30 } | 31 } |
31 return when.raw(); | 32 return when.raw(); |
32 } | 33 } |
33 | 34 |
34 | 35 |
35 DEFINE_NATIVE_ENTRY(Developer_inspect, 1) { | 36 DEFINE_NATIVE_ENTRY(Developer_inspect, 1) { |
36 GET_NATIVE_ARGUMENT(Instance, inspectee, arguments->NativeArgAt(0)); | 37 GET_NATIVE_ARGUMENT(Instance, inspectee, arguments->NativeArgAt(0)); |
37 if (FLAG_support_service) { | 38 if (FLAG_support_service) { |
38 Service::SendInspectEvent(isolate, inspectee); | 39 Service::SendInspectEvent(isolate, inspectee); |
39 } | 40 } |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 return isolate->LookupServiceExtensionHandler(name); | 86 return isolate->LookupServiceExtensionHandler(name); |
86 } | 87 } |
87 | 88 |
88 | 89 |
89 DEFINE_NATIVE_ENTRY(Developer_registerExtension, 2) { | 90 DEFINE_NATIVE_ENTRY(Developer_registerExtension, 2) { |
90 if (!FLAG_support_service) { | 91 if (!FLAG_support_service) { |
91 return Object::null(); | 92 return Object::null(); |
92 } | 93 } |
93 GET_NON_NULL_NATIVE_ARGUMENT(String, name, arguments->NativeArgAt(0)); | 94 GET_NON_NULL_NATIVE_ARGUMENT(String, name, arguments->NativeArgAt(0)); |
94 GET_NON_NULL_NATIVE_ARGUMENT(Instance, handler, arguments->NativeArgAt(1)); | 95 GET_NON_NULL_NATIVE_ARGUMENT(Instance, handler, arguments->NativeArgAt(1)); |
95 isolate->RegisterServiceExtensionHandler(name, handler); | 96 // We don't allow service extensions to be registered for the |
| 97 // service isolate. This can happen, for example, because the |
| 98 // service isolate uses dart:io. If we decide that we want to start |
| 99 // supporting this in the future, it will take some work. |
| 100 if (!ServiceIsolate::IsServiceIsolateDescendant(isolate)) { |
| 101 isolate->RegisterServiceExtensionHandler(name, handler); |
| 102 } |
96 return Object::null(); | 103 return Object::null(); |
97 } | 104 } |
98 | 105 |
99 } // namespace dart | 106 } // namespace dart |
OLD | NEW |