| 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 596 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 607 MonitorLocker ml(monitor_); | 607 MonitorLocker ml(monitor_); |
| 608 initializing_ = false; | 608 initializing_ = false; |
| 609 ml.NotifyAll(); | 609 ml.NotifyAll(); |
| 610 } | 610 } |
| 611 | 611 |
| 612 | 612 |
| 613 class RunServiceTask : public ThreadPool::Task { | 613 class RunServiceTask : public ThreadPool::Task { |
| 614 public: | 614 public: |
| 615 virtual void Run() { | 615 virtual void Run() { |
| 616 ASSERT(Isolate::Current() == NULL); | 616 ASSERT(Isolate::Current() == NULL); |
| 617 TimelineDurationScope tds(Timeline::GetVMStream(), |
| 618 "ServiceIsolateStartup"); |
| 617 char* error = NULL; | 619 char* error = NULL; |
| 618 Isolate* isolate = NULL; | 620 Isolate* isolate = NULL; |
| 619 | 621 |
| 620 Dart_IsolateCreateCallback create_callback = | 622 Dart_IsolateCreateCallback create_callback = |
| 621 ServiceIsolate::create_callback(); | 623 ServiceIsolate::create_callback(); |
| 622 // TODO(johnmccutchan): Support starting up service isolate without embedder | 624 // TODO(johnmccutchan): Support starting up service isolate without embedder |
| 623 // provided isolate creation callback. | 625 // provided isolate creation callback. |
| 624 if (create_callback == NULL) { | 626 if (create_callback == NULL) { |
| 625 ServiceIsolate::FinishedInitializing(); | 627 ServiceIsolate::FinishedInitializing(); |
| 626 return; | 628 return; |
| 627 } | 629 } |
| 628 | 630 |
| 629 Isolate::Flags default_flags; | 631 Isolate::Flags default_flags; |
| 630 Dart_IsolateFlags api_flags; | 632 Dart_IsolateFlags api_flags; |
| 631 default_flags.CopyTo(&api_flags); | 633 default_flags.CopyTo(&api_flags); |
| 632 | 634 |
| 633 isolate = | 635 isolate = |
| 634 reinterpret_cast<Isolate*>(create_callback(ServiceIsolate::kName, | 636 reinterpret_cast<Isolate*>(create_callback(ServiceIsolate::kName, |
| 635 NULL, | 637 NULL, |
| 636 NULL, | 638 NULL, |
| 637 &api_flags, | 639 &api_flags, |
| 638 NULL, | 640 NULL, |
| 639 &error)); | 641 &error)); |
| 640 if (isolate == NULL) { | 642 if (isolate == NULL) { |
| 641 OS::PrintErr("vm-service: Isolate creation error: %s\n", error); | 643 OS::PrintErr("vm-service: Isolate creation error: %s\n", error); |
| 642 ServiceIsolate::FinishedInitializing(); | 644 ServiceIsolate::FinishedInitializing(); |
| 643 return; | 645 return; |
| 644 } | 646 } |
| 645 | 647 |
| 646 isolate->RemoveTimelineEventRecorder(); | |
| 647 | 648 |
| 648 Thread::ExitIsolate(); | 649 Thread::ExitIsolate(); |
| 649 | 650 |
| 650 ServiceIsolate::ConstructExitMessageAndCache(isolate); | 651 ServiceIsolate::ConstructExitMessageAndCache(isolate); |
| 651 | 652 |
| 652 RunMain(isolate); | 653 RunMain(isolate); |
| 653 | 654 |
| 654 ServiceIsolate::FinishedInitializing(); | 655 ServiceIsolate::FinishedInitializing(); |
| 655 | 656 |
| 656 isolate->message_handler()->Run(Dart::thread_pool(), | 657 isolate->message_handler()->Run(Dart::thread_pool(), |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 807 return result; | 808 return result; |
| 808 } | 809 } |
| 809 Dart_Handle source = GetSource(url_string); | 810 Dart_Handle source = GetSource(url_string); |
| 810 if (Dart_IsError(source)) { | 811 if (Dart_IsError(source)) { |
| 811 return source; | 812 return source; |
| 812 } | 813 } |
| 813 return Dart_LoadSource(library, url, source, 0, 0); | 814 return Dart_LoadSource(library, url, source, 0, 0); |
| 814 } | 815 } |
| 815 | 816 |
| 816 } // namespace dart | 817 } // namespace dart |
| OLD | NEW |