| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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/isolate.h" | 5 #include "vm/isolate.h" |
| 6 | 6 |
| 7 #include "include/dart_api.h" | 7 #include "include/dart_api.h" |
| 8 #include "platform/assert.h" | 8 #include "platform/assert.h" |
| 9 #include "platform/json.h" | 9 #include "platform/json.h" |
| 10 #include "lib/mirrors.h" | 10 #include "lib/mirrors.h" |
| (...skipping 516 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 527 // communicate with the spawner to receive the initial message before it | 527 // communicate with the spawner to receive the initial message before it |
| 528 // executes the real entry point. | 528 // executes the real entry point. |
| 529 // Since this function ("RunIsolate") is used for both Isolate.spawn and | 529 // Since this function ("RunIsolate") is used for both Isolate.spawn and |
| 530 // Isolate.spawnUri we also send a boolean flag as argument so that the | 530 // Isolate.spawnUri we also send a boolean flag as argument so that the |
| 531 // "_startIsolate" function can act corresponding to how the isolate was | 531 // "_startIsolate" function can act corresponding to how the isolate was |
| 532 // created. | 532 // created. |
| 533 const Array& args = Array::Handle(Array::New(2)); | 533 const Array& args = Array::Handle(Array::New(2)); |
| 534 args.SetAt(0, Instance::Handle(func.ImplicitStaticClosure())); | 534 args.SetAt(0, Instance::Handle(func.ImplicitStaticClosure())); |
| 535 args.SetAt(1, is_spawn_uri ? Bool::True() : Bool::False()); | 535 args.SetAt(1, is_spawn_uri ? Bool::True() : Bool::False()); |
| 536 | 536 |
| 537 // Dispatching through _startIsolate will open a control port as a live |
| 538 // port. Account for this by increasing the number of open control ports. |
| 539 isolate->message_handler()->increment_control_ports(); |
| 540 |
| 537 const Library& lib = Library::Handle(Library::IsolateLibrary()); | 541 const Library& lib = Library::Handle(Library::IsolateLibrary()); |
| 538 const String& entry_name = String::Handle(String::New("_startIsolate")); | 542 const String& entry_name = String::Handle(String::New("_startIsolate")); |
| 539 const Function& entry_point = | 543 const Function& entry_point = |
| 540 Function::Handle(lib.LookupLocalFunction(entry_name)); | 544 Function::Handle(lib.LookupLocalFunction(entry_name)); |
| 541 ASSERT(entry_point.IsFunction() && !entry_point.IsNull()); | 545 ASSERT(entry_point.IsFunction() && !entry_point.IsNull()); |
| 542 | 546 |
| 543 result = DartEntry::InvokeFunction(entry_point, args); | 547 result = DartEntry::InvokeFunction(entry_point, args); |
| 544 if (result.IsError()) { | 548 if (result.IsError()) { |
| 545 StoreError(isolate, result); | 549 StoreError(isolate, result); |
| 546 return false; | 550 return false; |
| (...skipping 510 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1057 return func.raw(); | 1061 return func.raw(); |
| 1058 } | 1062 } |
| 1059 | 1063 |
| 1060 | 1064 |
| 1061 void IsolateSpawnState::Cleanup() { | 1065 void IsolateSpawnState::Cleanup() { |
| 1062 SwitchIsolateScope switch_scope(isolate()); | 1066 SwitchIsolateScope switch_scope(isolate()); |
| 1063 Dart::ShutdownIsolate(); | 1067 Dart::ShutdownIsolate(); |
| 1064 } | 1068 } |
| 1065 | 1069 |
| 1066 } // namespace dart | 1070 } // namespace dart |
| OLD | NEW |