| 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 #include "vm/dart_api_impl.h" | 6 #include "vm/dart_api_impl.h" |
| 7 #include "vm/datastream.h" | 7 #include "vm/datastream.h" |
| 8 #include "vm/exceptions.h" | 8 #include "vm/exceptions.h" |
| 9 #include "vm/flags.h" | 9 #include "vm/flags.h" |
| 10 #include "vm/growable_array.h" | 10 #include "vm/growable_array.h" |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 const String& name = String::Handle(String::New(isolate->name())); | 76 const String& name = String::Handle(String::New(isolate->name())); |
| 77 ASSERT(!name.IsNull()); | 77 ASSERT(!name.IsNull()); |
| 78 const Array& args = Array::Handle(Array::New(3)); | 78 const Array& args = Array::Handle(Array::New(3)); |
| 79 ASSERT(!args.IsNull()); | 79 ASSERT(!args.IsNull()); |
| 80 args.SetAt(0, port_int); | 80 args.SetAt(0, port_int); |
| 81 args.SetAt(1, send_port); | 81 args.SetAt(1, send_port); |
| 82 args.SetAt(2, name); | 82 args.SetAt(2, name); |
| 83 const Object& r = | 83 const Object& r = |
| 84 Object::Handle(DartEntry::InvokeFunction(register_function_, args)); | 84 Object::Handle(DartEntry::InvokeFunction(register_function_, args)); |
| 85 if (FLAG_trace_service) { | 85 if (FLAG_trace_service) { |
| 86 OS::Print("vm-service: Isolate %s %" Pd64 " registered.\n", | 86 OS::PrintErr("vm-service: Isolate %s %" Pd64 " registered.\n", |
| 87 name.ToCString(), port_id); | 87 name.ToCString(), port_id); |
| 88 } | 88 } |
| 89 ASSERT(!r.IsError()); | 89 ASSERT(!r.IsError()); |
| 90 } | 90 } |
| 91 | 91 |
| 92 private: | 92 private: |
| 93 Function& register_function_; | 93 Function& register_function_; |
| 94 Isolate* service_isolate_; | 94 Isolate* service_isolate_; |
| 95 }; | 95 }; |
| 96 #endif // !PRODUCT | 96 #endif // !PRODUCT |
| 97 | 97 |
| (...skipping 30 matching lines...) Expand all Loading... |
| 128 DEFINE_NATIVE_ENTRY(VMService_SendObjectRootServiceMessage, 1) { | 128 DEFINE_NATIVE_ENTRY(VMService_SendObjectRootServiceMessage, 1) { |
| 129 GET_NON_NULL_NATIVE_ARGUMENT(Array, message, arguments->NativeArgAt(0)); | 129 GET_NON_NULL_NATIVE_ARGUMENT(Array, message, arguments->NativeArgAt(0)); |
| 130 if (FLAG_support_service) { | 130 if (FLAG_support_service) { |
| 131 return Service::HandleObjectRootMessage(message); | 131 return Service::HandleObjectRootMessage(message); |
| 132 } | 132 } |
| 133 return Object::null(); | 133 return Object::null(); |
| 134 } | 134 } |
| 135 | 135 |
| 136 DEFINE_NATIVE_ENTRY(VMService_OnStart, 0) { | 136 DEFINE_NATIVE_ENTRY(VMService_OnStart, 0) { |
| 137 if (FLAG_trace_service) { | 137 if (FLAG_trace_service) { |
| 138 OS::Print("vm-service: Booting dart:vmservice library.\n"); | 138 OS::PrintErr("vm-service: Booting dart:vmservice library.\n"); |
| 139 } | 139 } |
| 140 // Boot the dart:vmservice library. | 140 // Boot the dart:vmservice library. |
| 141 ServiceIsolate::BootVmServiceLibrary(); | 141 ServiceIsolate::BootVmServiceLibrary(); |
| 142 if (!FLAG_support_service) { | 142 if (!FLAG_support_service) { |
| 143 return Object::null(); | 143 return Object::null(); |
| 144 } | 144 } |
| 145 #ifndef PRODUCT | 145 #ifndef PRODUCT |
| 146 // Register running isolates with service. | 146 // Register running isolates with service. |
| 147 RegisterRunningIsolatesVisitor register_isolates(thread); | 147 RegisterRunningIsolatesVisitor register_isolates(thread); |
| 148 if (FLAG_trace_service) { | 148 if (FLAG_trace_service) { |
| 149 OS::Print("vm-service: Registering running isolates.\n"); | 149 OS::PrintErr("vm-service: Registering running isolates.\n"); |
| 150 } | 150 } |
| 151 Isolate::VisitIsolates(®ister_isolates); | 151 Isolate::VisitIsolates(®ister_isolates); |
| 152 #endif | 152 #endif |
| 153 return Object::null(); | 153 return Object::null(); |
| 154 } | 154 } |
| 155 | 155 |
| 156 DEFINE_NATIVE_ENTRY(VMService_OnExit, 0) { | 156 DEFINE_NATIVE_ENTRY(VMService_OnExit, 0) { |
| 157 if (FLAG_trace_service) { | 157 if (FLAG_trace_service) { |
| 158 OS::Print("vm-service: processed exit message.\n"); | 158 OS::PrintErr("vm-service: processed exit message.\n"); |
| 159 MessageHandler* message_handler = isolate->message_handler(); | 159 MessageHandler* message_handler = isolate->message_handler(); |
| 160 OS::Print("vm-service: live ports = %" Pd "\n", | 160 OS::PrintErr("vm-service: live ports = %" Pd "\n", |
| 161 message_handler->live_ports()); | 161 message_handler->live_ports()); |
| 162 } | 162 } |
| 163 return Object::null(); | 163 return Object::null(); |
| 164 } | 164 } |
| 165 | 165 |
| 166 DEFINE_NATIVE_ENTRY(VMService_OnServerAddressChange, 1) { | 166 DEFINE_NATIVE_ENTRY(VMService_OnServerAddressChange, 1) { |
| 167 if (!FLAG_support_service) { | 167 if (!FLAG_support_service) { |
| 168 return Object::null(); | 168 return Object::null(); |
| 169 } | 169 } |
| 170 GET_NATIVE_ARGUMENT(String, address, arguments->NativeArgAt(0)); | 170 GET_NATIVE_ARGUMENT(String, address, arguments->NativeArgAt(0)); |
| 171 if (address.IsNull()) { | 171 if (address.IsNull()) { |
| (...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 464 ServiceEvent spawn_event(NULL, ServiceEvent::kIsolateSpawn); | 464 ServiceEvent spawn_event(NULL, ServiceEvent::kIsolateSpawn); |
| 465 spawn_event.set_spawn_token(&token); | 465 spawn_event.set_spawn_token(&token); |
| 466 spawn_event.set_spawn_error(&String::Cast(result)); | 466 spawn_event.set_spawn_error(&String::Cast(result)); |
| 467 Service::HandleEvent(&spawn_event); | 467 Service::HandleEvent(&spawn_event); |
| 468 } | 468 } |
| 469 #endif // PRODUCT | 469 #endif // PRODUCT |
| 470 return Object::null(); | 470 return Object::null(); |
| 471 } | 471 } |
| 472 | 472 |
| 473 } // namespace dart | 473 } // namespace dart |
| OLD | NEW |