Chromium Code Reviews| 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" |
| 11 #include "vm/message.h" | 11 #include "vm/message.h" |
| 12 #include "vm/message_handler.h" | 12 #include "vm/message_handler.h" |
| 13 #include "vm/native_entry.h" | 13 #include "vm/native_entry.h" |
| 14 #include "vm/object.h" | 14 #include "vm/object.h" |
| 15 #include "vm/port.h" | 15 #include "vm/port.h" |
| 16 #include "vm/service_event.h" | 16 #include "vm/service_event.h" |
| 17 #include "vm/service_isolate.h" | 17 #include "vm/service_isolate.h" |
| 18 #include "vm/symbols.h" | 18 #include "vm/symbols.h" |
| 19 #include "vm/kernel_isolate.h" | |
| 19 | 20 |
| 20 namespace dart { | 21 namespace dart { |
| 21 | 22 |
| 22 DECLARE_FLAG(bool, trace_service); | 23 DECLARE_FLAG(bool, trace_service); |
| 23 | 24 |
| 24 static uint8_t* malloc_allocator(uint8_t* ptr, | 25 static uint8_t* malloc_allocator(uint8_t* ptr, |
| 25 intptr_t old_size, | 26 intptr_t old_size, |
| 26 intptr_t new_size) { | 27 intptr_t new_size) { |
| 27 void* new_ptr = realloc(reinterpret_cast<void*>(ptr), new_size); | 28 void* new_ptr = realloc(reinterpret_cast<void*>(ptr), new_size); |
| 28 return reinterpret_cast<uint8_t*>(new_ptr); | 29 return reinterpret_cast<uint8_t*>(new_ptr); |
| (...skipping 21 matching lines...) Expand all Loading... | |
| 50 // Get function. | 51 // Get function. |
| 51 const String& function_name = | 52 const String& function_name = |
| 52 String::Handle(String::New("_registerIsolate")); | 53 String::Handle(String::New("_registerIsolate")); |
| 53 ASSERT(!function_name.IsNull()); | 54 ASSERT(!function_name.IsNull()); |
| 54 register_function_ = library.LookupFunctionAllowPrivate(function_name); | 55 register_function_ = library.LookupFunctionAllowPrivate(function_name); |
| 55 ASSERT(!register_function_.IsNull()); | 56 ASSERT(!register_function_.IsNull()); |
| 56 } | 57 } |
| 57 | 58 |
| 58 virtual void VisitIsolate(Isolate* isolate) { | 59 virtual void VisitIsolate(Isolate* isolate) { |
| 59 ASSERT(ServiceIsolate::IsServiceIsolate(Isolate::Current())); | 60 ASSERT(ServiceIsolate::IsServiceIsolate(Isolate::Current())); |
| 60 if (IsVMInternalIsolate(isolate)) { | 61 bool is_kernel_isolate = false; |
| 61 // We do not register the service (and descendants) or the vm-isolate. | 62 #ifndef DART_PRECOMPILED_RUNTIME |
| 63 is_kernel_isolate = KernelIsolate::IsKernelIsolate(isolate); | |
| 64 #endif | |
| 65 if (IsVMInternalIsolate(isolate) || is_kernel_isolate) { | |
|
Vyacheslav Egorov (Google)
2017/02/14 13:02:25
Maybe this should just move this check into the Is
| |
| 66 // We do not register the service (and descendants), the vm-isolate, or | |
| 67 // the kernel isolate. | |
| 62 return; | 68 return; |
| 63 } | 69 } |
| 64 // Setup arguments for call. | 70 // Setup arguments for call. |
| 65 Dart_Port port_id = isolate->main_port(); | 71 Dart_Port port_id = isolate->main_port(); |
| 66 const Integer& port_int = Integer::Handle(Integer::New(port_id)); | 72 const Integer& port_int = Integer::Handle(Integer::New(port_id)); |
| 67 ASSERT(!port_int.IsNull()); | 73 ASSERT(!port_int.IsNull()); |
| 68 const SendPort& send_port = SendPort::Handle(SendPort::New(port_id)); | 74 const SendPort& send_port = SendPort::Handle(SendPort::New(port_id)); |
| 69 const String& name = String::Handle(String::New(isolate->name())); | 75 const String& name = String::Handle(String::New(isolate->name())); |
| 70 ASSERT(!name.IsNull()); | 76 ASSERT(!name.IsNull()); |
| 71 const Array& args = Array::Handle(Array::New(3)); | 77 const Array& args = Array::Handle(Array::New(3)); |
| (...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 471 ServiceEvent spawn_event(NULL, ServiceEvent::kIsolateSpawn); | 477 ServiceEvent spawn_event(NULL, ServiceEvent::kIsolateSpawn); |
| 472 spawn_event.set_spawn_token(&token); | 478 spawn_event.set_spawn_token(&token); |
| 473 spawn_event.set_spawn_error(&String::Cast(result)); | 479 spawn_event.set_spawn_error(&String::Cast(result)); |
| 474 Service::HandleEvent(&spawn_event); | 480 Service::HandleEvent(&spawn_event); |
| 475 } | 481 } |
| 476 #endif // PRODUCT | 482 #endif // PRODUCT |
| 477 return Object::null(); | 483 return Object::null(); |
| 478 } | 484 } |
| 479 | 485 |
| 480 } // namespace dart | 486 } // namespace dart |
| OLD | NEW |