| 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/service_isolate.h" | 5 #include "vm/service_isolate.h" |
| 6 | 6 |
| 7 #include "vm/compiler.h" | 7 #include "vm/compiler.h" |
| 8 #include "vm/dart_api_impl.h" | 8 #include "vm/dart_api_impl.h" |
| 9 #include "vm/dart_entry.h" | 9 #include "vm/dart_entry.h" |
| 10 #include "vm/isolate.h" | 10 #include "vm/isolate.h" |
| (...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 212 Function& register_function_; | 212 Function& register_function_; |
| 213 Isolate* service_isolate_; | 213 Isolate* service_isolate_; |
| 214 }; | 214 }; |
| 215 | 215 |
| 216 | 216 |
| 217 | 217 |
| 218 class ServiceIsolateNatives : public AllStatic { | 218 class ServiceIsolateNatives : public AllStatic { |
| 219 public: | 219 public: |
| 220 static void SendIsolateServiceMessage(Dart_NativeArguments args) { | 220 static void SendIsolateServiceMessage(Dart_NativeArguments args) { |
| 221 NativeArguments* arguments = reinterpret_cast<NativeArguments*>(args); | 221 NativeArguments* arguments = reinterpret_cast<NativeArguments*>(args); |
| 222 Isolate* isolate = arguments->thread()->isolate(); | 222 Thread* thread = arguments->thread(); |
| 223 StackZone stack_zone(isolate); | 223 StackZone stack_zone(thread); |
| 224 Zone* zone = stack_zone.GetZone(); // Used by GET_NON_NULL_NATIVE_ARGUMENT. | 224 Zone* zone = stack_zone.GetZone(); // Used by GET_NON_NULL_NATIVE_ARGUMENT. |
| 225 HANDLESCOPE(isolate); | 225 HANDLESCOPE(thread); |
| 226 GET_NON_NULL_NATIVE_ARGUMENT(SendPort, sp, arguments->NativeArgAt(0)); | 226 GET_NON_NULL_NATIVE_ARGUMENT(SendPort, sp, arguments->NativeArgAt(0)); |
| 227 GET_NON_NULL_NATIVE_ARGUMENT(Array, message, arguments->NativeArgAt(1)); | 227 GET_NON_NULL_NATIVE_ARGUMENT(Array, message, arguments->NativeArgAt(1)); |
| 228 | 228 |
| 229 // Set the type of the OOB message. | 229 // Set the type of the OOB message. |
| 230 message.SetAt(0, Smi::Handle(isolate, Smi::New(Message::kServiceOOBMsg))); | 230 message.SetAt(0, Smi::Handle(thread->zone(), |
| 231 Smi::New(Message::kServiceOOBMsg))); |
| 231 | 232 |
| 232 // Serialize message. | 233 // Serialize message. |
| 233 uint8_t* data = NULL; | 234 uint8_t* data = NULL; |
| 234 MessageWriter writer(&data, &allocator, false); | 235 MessageWriter writer(&data, &allocator, false); |
| 235 writer.WriteMessage(message); | 236 writer.WriteMessage(message); |
| 236 | 237 |
| 237 // TODO(turnidge): Throw an exception when the return value is false? | 238 // TODO(turnidge): Throw an exception when the return value is false? |
| 238 bool result = PortMap::PostMessage( | 239 bool result = PortMap::PostMessage( |
| 239 new Message(sp.Id(), data, writer.BytesWritten(), | 240 new Message(sp.Id(), data, writer.BytesWritten(), |
| 240 Message::kOOBPriority)); | 241 Message::kOOBPriority)); |
| 241 arguments->SetReturn(Bool::Get(result)); | 242 arguments->SetReturn(Bool::Get(result)); |
| 242 } | 243 } |
| 243 | 244 |
| 244 static void SendRootServiceMessage(Dart_NativeArguments args) { | 245 static void SendRootServiceMessage(Dart_NativeArguments args) { |
| 245 NativeArguments* arguments = reinterpret_cast<NativeArguments*>(args); | 246 NativeArguments* arguments = reinterpret_cast<NativeArguments*>(args); |
| 246 Isolate* isolate = arguments->thread()->isolate(); | 247 Thread* thread = arguments->thread(); |
| 247 StackZone stack_zone(isolate); | 248 StackZone stack_zone(thread); |
| 248 Zone* zone = stack_zone.GetZone(); // Used by GET_NON_NULL_NATIVE_ARGUMENT. | 249 Zone* zone = stack_zone.GetZone(); // Used by GET_NON_NULL_NATIVE_ARGUMENT. |
| 249 HANDLESCOPE(isolate); | 250 HANDLESCOPE(thread); |
| 250 GET_NON_NULL_NATIVE_ARGUMENT(Array, message, arguments->NativeArgAt(0)); | 251 GET_NON_NULL_NATIVE_ARGUMENT(Array, message, arguments->NativeArgAt(0)); |
| 251 Service::HandleRootMessage(message); | 252 Service::HandleRootMessage(message); |
| 252 } | 253 } |
| 253 | 254 |
| 254 static void OnStart(Dart_NativeArguments args) { | 255 static void OnStart(Dart_NativeArguments args) { |
| 255 NativeArguments* arguments = reinterpret_cast<NativeArguments*>(args); | 256 NativeArguments* arguments = reinterpret_cast<NativeArguments*>(args); |
| 256 Isolate* isolate = arguments->thread()->isolate(); | 257 Thread* thread = arguments->thread(); |
| 257 StackZone zone(isolate); | 258 Isolate* isolate = thread->isolate(); |
| 258 HANDLESCOPE(isolate); | 259 StackZone zone(thread); |
| 260 HANDLESCOPE(thread); |
| 259 { | 261 { |
| 260 if (FLAG_trace_service) { | 262 if (FLAG_trace_service) { |
| 261 OS::Print("vm-service: Booting dart:vmservice library.\n"); | 263 OS::Print("vm-service: Booting dart:vmservice library.\n"); |
| 262 } | 264 } |
| 263 // Boot the dart:vmservice library. | 265 // Boot the dart:vmservice library. |
| 264 Dart_EnterScope(); | 266 Dart_EnterScope(); |
| 265 Dart_Handle url_str = | 267 Dart_Handle url_str = |
| 266 Dart_NewStringFromCString(Symbols::Name(Symbols::kDartVMServiceId)); | 268 Dart_NewStringFromCString(Symbols::Name(Symbols::kDartVMServiceId)); |
| 267 Dart_Handle library = Dart_LookupLibrary(url_str); | 269 Dart_Handle library = Dart_LookupLibrary(url_str); |
| 268 ASSERT(Dart_IsLibrary(library)); | 270 ASSERT(Dart_IsLibrary(library)); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 280 OS::Print("vm-service: Registering running isolates.\n"); | 282 OS::Print("vm-service: Registering running isolates.\n"); |
| 281 } | 283 } |
| 282 // Register running isolates with service. | 284 // Register running isolates with service. |
| 283 RegisterRunningIsolatesVisitor register_isolates(isolate); | 285 RegisterRunningIsolatesVisitor register_isolates(isolate); |
| 284 Isolate::VisitIsolates(®ister_isolates); | 286 Isolate::VisitIsolates(®ister_isolates); |
| 285 } | 287 } |
| 286 } | 288 } |
| 287 | 289 |
| 288 static void OnExit(Dart_NativeArguments args) { | 290 static void OnExit(Dart_NativeArguments args) { |
| 289 NativeArguments* arguments = reinterpret_cast<NativeArguments*>(args); | 291 NativeArguments* arguments = reinterpret_cast<NativeArguments*>(args); |
| 290 Isolate* isolate = arguments->thread()->isolate(); | 292 Thread* thread = arguments->thread(); |
| 291 StackZone zone(isolate); | 293 StackZone zone(thread); |
| 292 HANDLESCOPE(isolate); | 294 HANDLESCOPE(thread); |
| 293 { | 295 { |
| 294 if (FLAG_trace_service) { | 296 if (FLAG_trace_service) { |
| 295 OS::Print("vm-service: processed exit message.\n"); | 297 OS::Print("vm-service: processed exit message.\n"); |
| 296 } | 298 } |
| 297 } | 299 } |
| 298 } | 300 } |
| 299 | 301 |
| 300 static void ListenStream(Dart_NativeArguments args) { | 302 static void ListenStream(Dart_NativeArguments args) { |
| 301 NativeArguments* arguments = reinterpret_cast<NativeArguments*>(args); | 303 NativeArguments* arguments = reinterpret_cast<NativeArguments*>(args); |
| 302 Isolate* isolate = arguments->thread()->isolate(); | 304 Thread* thread = arguments->thread(); |
| 303 StackZone stack_zone(isolate); | 305 StackZone stack_zone(thread); |
| 304 Zone* zone = stack_zone.GetZone(); // Used by GET_NON_NULL_NATIVE_ARGUMENT. | 306 Zone* zone = stack_zone.GetZone(); // Used by GET_NON_NULL_NATIVE_ARGUMENT. |
| 305 HANDLESCOPE(isolate); | 307 HANDLESCOPE(thread); |
| 306 GET_NON_NULL_NATIVE_ARGUMENT(String, stream_id, arguments->NativeArgAt(0)); | 308 GET_NON_NULL_NATIVE_ARGUMENT(String, stream_id, arguments->NativeArgAt(0)); |
| 307 bool result = Service::ListenStream(stream_id.ToCString()); | 309 bool result = Service::ListenStream(stream_id.ToCString()); |
| 308 arguments->SetReturn(Bool::Get(result)); | 310 arguments->SetReturn(Bool::Get(result)); |
| 309 } | 311 } |
| 310 | 312 |
| 311 static void CancelStream(Dart_NativeArguments args) { | 313 static void CancelStream(Dart_NativeArguments args) { |
| 312 NativeArguments* arguments = reinterpret_cast<NativeArguments*>(args); | 314 NativeArguments* arguments = reinterpret_cast<NativeArguments*>(args); |
| 313 Isolate* isolate = arguments->thread()->isolate(); | 315 Thread* thread = arguments->thread(); |
| 314 StackZone stack_zone(isolate); | 316 StackZone stack_zone(thread); |
| 315 Zone* zone = stack_zone.GetZone(); // Used by GET_NON_NULL_NATIVE_ARGUMENT. | 317 Zone* zone = stack_zone.GetZone(); // Used by GET_NON_NULL_NATIVE_ARGUMENT. |
| 316 HANDLESCOPE(isolate); | 318 HANDLESCOPE(thread); |
| 317 GET_NON_NULL_NATIVE_ARGUMENT(String, stream_id, arguments->NativeArgAt(0)); | 319 GET_NON_NULL_NATIVE_ARGUMENT(String, stream_id, arguments->NativeArgAt(0)); |
| 318 Service::CancelStream(stream_id.ToCString()); | 320 Service::CancelStream(stream_id.ToCString()); |
| 319 } | 321 } |
| 320 }; | 322 }; |
| 321 | 323 |
| 322 | 324 |
| 323 struct ServiceNativeEntry { | 325 struct ServiceNativeEntry { |
| 324 const char* name; | 326 const char* name; |
| 325 int num_arguments; | 327 int num_arguments; |
| 326 Dart_NativeFunction function; | 328 Dart_NativeFunction function; |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 417 Dart_Port ServiceIsolate::LoadPort() { | 419 Dart_Port ServiceIsolate::LoadPort() { |
| 418 MonitorLocker ml(monitor_); | 420 MonitorLocker ml(monitor_); |
| 419 return load_port_; | 421 return load_port_; |
| 420 } | 422 } |
| 421 | 423 |
| 422 | 424 |
| 423 bool ServiceIsolate::SendIsolateStartupMessage() { | 425 bool ServiceIsolate::SendIsolateStartupMessage() { |
| 424 if (!IsRunning()) { | 426 if (!IsRunning()) { |
| 425 return false; | 427 return false; |
| 426 } | 428 } |
| 427 Isolate* isolate = Isolate::Current(); | 429 Thread* thread = Thread::Current(); |
| 430 Isolate* isolate = thread->isolate(); |
| 428 if (IsServiceIsolateDescendant(isolate)) { | 431 if (IsServiceIsolateDescendant(isolate)) { |
| 429 return false; | 432 return false; |
| 430 } | 433 } |
| 431 ASSERT(isolate != NULL); | 434 ASSERT(isolate != NULL); |
| 432 HANDLESCOPE(isolate); | 435 HANDLESCOPE(thread); |
| 433 const String& name = String::Handle(String::New(isolate->name())); | 436 const String& name = String::Handle(String::New(isolate->name())); |
| 434 ASSERT(!name.IsNull()); | 437 ASSERT(!name.IsNull()); |
| 435 const Array& list = Array::Handle( | 438 const Array& list = Array::Handle( |
| 436 MakeServiceControlMessage(Dart_GetMainPortId(), | 439 MakeServiceControlMessage(Dart_GetMainPortId(), |
| 437 VM_SERVICE_ISOLATE_STARTUP_MESSAGE_ID, | 440 VM_SERVICE_ISOLATE_STARTUP_MESSAGE_ID, |
| 438 name)); | 441 name)); |
| 439 ASSERT(!list.IsNull()); | 442 ASSERT(!list.IsNull()); |
| 440 uint8_t* data = NULL; | 443 uint8_t* data = NULL; |
| 441 MessageWriter writer(&data, &allocator, false); | 444 MessageWriter writer(&data, &allocator, false); |
| 442 writer.WriteMessage(list); | 445 writer.WriteMessage(list); |
| 443 intptr_t len = writer.BytesWritten(); | 446 intptr_t len = writer.BytesWritten(); |
| 444 if (FLAG_trace_service) { | 447 if (FLAG_trace_service) { |
| 445 OS::Print("vm-service: Isolate %s %" Pd64 " registered.\n", | 448 OS::Print("vm-service: Isolate %s %" Pd64 " registered.\n", |
| 446 name.ToCString(), | 449 name.ToCString(), |
| 447 Dart_GetMainPortId()); | 450 Dart_GetMainPortId()); |
| 448 } | 451 } |
| 449 return PortMap::PostMessage( | 452 return PortMap::PostMessage( |
| 450 new Message(port_, data, len, Message::kNormalPriority)); | 453 new Message(port_, data, len, Message::kNormalPriority)); |
| 451 } | 454 } |
| 452 | 455 |
| 453 | 456 |
| 454 bool ServiceIsolate::SendIsolateShutdownMessage() { | 457 bool ServiceIsolate::SendIsolateShutdownMessage() { |
| 455 if (!IsRunning()) { | 458 if (!IsRunning()) { |
| 456 return false; | 459 return false; |
| 457 } | 460 } |
| 458 Isolate* isolate = Isolate::Current(); | 461 Thread* thread = Thread::Current(); |
| 462 Isolate* isolate = thread->isolate(); |
| 459 if (IsServiceIsolateDescendant(isolate)) { | 463 if (IsServiceIsolateDescendant(isolate)) { |
| 460 return false; | 464 return false; |
| 461 } | 465 } |
| 462 ASSERT(isolate != NULL); | 466 ASSERT(isolate != NULL); |
| 463 HANDLESCOPE(isolate); | 467 HANDLESCOPE(thread); |
| 464 const String& name = String::Handle(String::New(isolate->name())); | 468 const String& name = String::Handle(String::New(isolate->name())); |
| 465 ASSERT(!name.IsNull()); | 469 ASSERT(!name.IsNull()); |
| 466 const Array& list = Array::Handle( | 470 const Array& list = Array::Handle( |
| 467 MakeServiceControlMessage(Dart_GetMainPortId(), | 471 MakeServiceControlMessage(Dart_GetMainPortId(), |
| 468 VM_SERVICE_ISOLATE_SHUTDOWN_MESSAGE_ID, | 472 VM_SERVICE_ISOLATE_SHUTDOWN_MESSAGE_ID, |
| 469 name)); | 473 name)); |
| 470 ASSERT(!list.IsNull()); | 474 ASSERT(!list.IsNull()); |
| 471 uint8_t* data = NULL; | 475 uint8_t* data = NULL; |
| 472 MessageWriter writer(&data, &allocator, false); | 476 MessageWriter writer(&data, &allocator, false); |
| 473 writer.WriteMessage(list); | 477 writer.WriteMessage(list); |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 516 } | 520 } |
| 517 } | 521 } |
| 518 | 522 |
| 519 void ServiceIsolate::SetLoadPort(Dart_Port port) { | 523 void ServiceIsolate::SetLoadPort(Dart_Port port) { |
| 520 MonitorLocker ml(monitor_); | 524 MonitorLocker ml(monitor_); |
| 521 load_port_ = port; | 525 load_port_ = port; |
| 522 } | 526 } |
| 523 | 527 |
| 524 | 528 |
| 525 void ServiceIsolate::MaybeInjectVMServiceLibrary(Isolate* isolate) { | 529 void ServiceIsolate::MaybeInjectVMServiceLibrary(Isolate* isolate) { |
| 530 Thread* thread = Thread::Current(); |
| 531 ASSERT(isolate == thread->isolate()); |
| 526 ASSERT(isolate != NULL); | 532 ASSERT(isolate != NULL); |
| 527 ASSERT(isolate->name() != NULL); | 533 ASSERT(isolate->name() != NULL); |
| 528 if (!ServiceIsolate::NameEquals(isolate->name())) { | 534 if (!ServiceIsolate::NameEquals(isolate->name())) { |
| 529 // Not service isolate. | 535 // Not service isolate. |
| 530 return; | 536 return; |
| 531 } | 537 } |
| 532 if (Exists()) { | 538 if (Exists()) { |
| 533 // Service isolate already exists. | 539 // Service isolate already exists. |
| 534 return; | 540 return; |
| 535 } | 541 } |
| 536 SetServiceIsolate(isolate); | 542 SetServiceIsolate(isolate); |
| 537 | 543 |
| 538 StackZone zone(isolate); | 544 StackZone zone(isolate); |
| 539 HANDLESCOPE(isolate); | 545 HANDLESCOPE(thread); |
| 540 | 546 |
| 541 // Register dart:vmservice library. | 547 // Register dart:vmservice library. |
| 542 const String& url_str = String::Handle(Symbols::DartVMService().raw()); | 548 const String& url_str = String::Handle(Symbols::DartVMService().raw()); |
| 543 const Library& library = Library::Handle(Library::New(url_str)); | 549 const Library& library = Library::Handle(Library::New(url_str)); |
| 544 library.Register(); | 550 library.Register(); |
| 545 library.set_native_entry_resolver(ServiceNativeResolver); | 551 library.set_native_entry_resolver(ServiceNativeResolver); |
| 546 | 552 |
| 547 // Temporarily install our library tag handler. | 553 // Temporarily install our library tag handler. |
| 548 isolate->set_library_tag_handler(LibraryTagHandler); | 554 isolate->set_library_tag_handler(LibraryTagHandler); |
| 549 | 555 |
| (...skipping 25 matching lines...) Expand all Loading... |
| 575 | 581 |
| 576 // Uninstall our library tag handler. | 582 // Uninstall our library tag handler. |
| 577 isolate->set_library_tag_handler(NULL); | 583 isolate->set_library_tag_handler(NULL); |
| 578 } | 584 } |
| 579 | 585 |
| 580 | 586 |
| 581 void ServiceIsolate::ConstructExitMessageAndCache(Isolate* isolate) { | 587 void ServiceIsolate::ConstructExitMessageAndCache(Isolate* isolate) { |
| 582 // Construct and cache exit message here so we can send it without needing an | 588 // Construct and cache exit message here so we can send it without needing an |
| 583 // isolate. | 589 // isolate. |
| 584 StartIsolateScope iso_scope(isolate); | 590 StartIsolateScope iso_scope(isolate); |
| 591 Thread* thread = Thread::Current(); |
| 592 ASSERT(isolate == thread->isolate()); |
| 593 ASSERT(isolate != NULL); |
| 585 StackZone zone(isolate); | 594 StackZone zone(isolate); |
| 586 HANDLESCOPE(isolate); | 595 HANDLESCOPE(thread); |
| 587 ASSERT(exit_message_ == NULL); | 596 ASSERT(exit_message_ == NULL); |
| 588 ASSERT(exit_message_length_ == 0); | 597 ASSERT(exit_message_length_ == 0); |
| 589 const Array& list = Array::Handle(MakeServiceExitMessage()); | 598 const Array& list = Array::Handle(MakeServiceExitMessage()); |
| 590 ASSERT(!list.IsNull()); | 599 ASSERT(!list.IsNull()); |
| 591 MessageWriter writer(&exit_message_, &allocator, false); | 600 MessageWriter writer(&exit_message_, &allocator, false); |
| 592 writer.WriteMessage(list); | 601 writer.WriteMessage(list); |
| 593 exit_message_length_ = writer.BytesWritten(); | 602 exit_message_length_ = writer.BytesWritten(); |
| 594 ASSERT(exit_message_ != NULL); | 603 ASSERT(exit_message_ != NULL); |
| 595 ASSERT(exit_message_length_ != 0); | 604 ASSERT(exit_message_length_ != 0); |
| 596 } | 605 } |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 661 } | 670 } |
| 662 | 671 |
| 663 protected: | 672 protected: |
| 664 static void ShutdownIsolate(uword parameter) { | 673 static void ShutdownIsolate(uword parameter) { |
| 665 Isolate* isolate = reinterpret_cast<Isolate*>(parameter); | 674 Isolate* isolate = reinterpret_cast<Isolate*>(parameter); |
| 666 ASSERT(ServiceIsolate::IsServiceIsolate(isolate)); | 675 ASSERT(ServiceIsolate::IsServiceIsolate(isolate)); |
| 667 { | 676 { |
| 668 // Print the error if there is one. This may execute dart code to | 677 // Print the error if there is one. This may execute dart code to |
| 669 // print the exception object, so we need to use a StartIsolateScope. | 678 // print the exception object, so we need to use a StartIsolateScope. |
| 670 StartIsolateScope start_scope(isolate); | 679 StartIsolateScope start_scope(isolate); |
| 680 Thread* thread = Thread::Current(); |
| 681 ASSERT(isolate == thread->isolate()); |
| 671 StackZone zone(isolate); | 682 StackZone zone(isolate); |
| 672 HandleScope handle_scope(isolate); | 683 HandleScope handle_scope(thread); |
| 673 Error& error = Error::Handle(); | 684 Error& error = Error::Handle(); |
| 674 error = isolate->object_store()->sticky_error(); | 685 error = isolate->object_store()->sticky_error(); |
| 675 if (!error.IsNull()) { | 686 if (!error.IsNull()) { |
| 676 OS::PrintErr("vm-service: Error: %s\n", error.ToErrorCString()); | 687 OS::PrintErr("vm-service: Error: %s\n", error.ToErrorCString()); |
| 677 } | 688 } |
| 678 Dart::RunShutdownCallback(); | 689 Dart::RunShutdownCallback(); |
| 679 } | 690 } |
| 680 { | 691 { |
| 681 // Shut the isolate down. | 692 // Shut the isolate down. |
| 682 SwitchIsolateScope switch_scope(isolate); | 693 SwitchIsolateScope switch_scope(isolate); |
| 683 Dart::ShutdownIsolate(); | 694 Dart::ShutdownIsolate(); |
| 684 } | 695 } |
| 685 ServiceIsolate::SetServiceIsolate(NULL); | 696 ServiceIsolate::SetServiceIsolate(NULL); |
| 686 ServiceIsolate::SetServicePort(ILLEGAL_PORT); | 697 ServiceIsolate::SetServicePort(ILLEGAL_PORT); |
| 687 if (FLAG_trace_service) { | 698 if (FLAG_trace_service) { |
| 688 OS::Print("vm-service: Shutdown.\n"); | 699 OS::Print("vm-service: Shutdown.\n"); |
| 689 } | 700 } |
| 690 ServiceIsolate::FinishedExiting(); | 701 ServiceIsolate::FinishedExiting(); |
| 691 } | 702 } |
| 692 | 703 |
| 693 void RunMain(Isolate* isolate) { | 704 void RunMain(Isolate* isolate) { |
| 694 StartIsolateScope iso_scope(isolate); | 705 StartIsolateScope iso_scope(isolate); |
| 706 Thread* thread = Thread::Current(); |
| 707 ASSERT(isolate == thread->isolate()); |
| 695 StackZone zone(isolate); | 708 StackZone zone(isolate); |
| 696 HANDLESCOPE(isolate); | 709 HANDLESCOPE(thread); |
| 697 // Invoke main which will return the loadScriptPort. | 710 // Invoke main which will return the loadScriptPort. |
| 698 const Library& root_library = | 711 const Library& root_library = |
| 699 Library::Handle(isolate, isolate->object_store()->root_library()); | 712 Library::Handle(isolate, isolate->object_store()->root_library()); |
| 700 if (root_library.IsNull()) { | 713 if (root_library.IsNull()) { |
| 701 if (FLAG_trace_service) { | 714 if (FLAG_trace_service) { |
| 702 OS::Print("vm-service: Embedder did not install a script."); | 715 OS::Print("vm-service: Embedder did not install a script."); |
| 703 } | 716 } |
| 704 // Service isolate is not supported by embedder. | 717 // Service isolate is not supported by embedder. |
| 705 return; | 718 return; |
| 706 } | 719 } |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 808 return result; | 821 return result; |
| 809 } | 822 } |
| 810 Dart_Handle source = GetSource(url_string); | 823 Dart_Handle source = GetSource(url_string); |
| 811 if (Dart_IsError(source)) { | 824 if (Dart_IsError(source)) { |
| 812 return source; | 825 return source; |
| 813 } | 826 } |
| 814 return Dart_LoadSource(library, url, source, 0, 0); | 827 return Dart_LoadSource(library, url, source, 0, 0); |
| 815 } | 828 } |
| 816 | 829 |
| 817 } // namespace dart | 830 } // namespace dart |
| OLD | NEW |