| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 "platform/assert.h" | 5 #include "platform/assert.h" |
| 6 #include "vm/bootstrap_natives.h" | 6 #include "vm/bootstrap_natives.h" |
| 7 #include "vm/class_finalizer.h" | 7 #include "vm/class_finalizer.h" |
| 8 #include "vm/dart.h" | 8 #include "vm/dart.h" |
| 9 #include "vm/dart_api_impl.h" | 9 #include "vm/dart_api_impl.h" |
| 10 #include "vm/dart_entry.h" | 10 #include "vm/dart_entry.h" |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 Isolate* isolate = Isolate::Current(); | 55 Isolate* isolate = Isolate::Current(); |
| 56 Function& func = | 56 Function& func = |
| 57 Function::Handle(isolate, | 57 Function::Handle(isolate, |
| 58 isolate->object_store()->receive_port_create_function()); | 58 isolate->object_store()->receive_port_create_function()); |
| 59 const int kNumArguments = 1; | 59 const int kNumArguments = 1; |
| 60 if (func.IsNull()) { | 60 if (func.IsNull()) { |
| 61 Library& isolate_lib = Library::Handle(Library::IsolateLibrary()); | 61 Library& isolate_lib = Library::Handle(Library::IsolateLibrary()); |
| 62 ASSERT(!isolate_lib.IsNull()); | 62 ASSERT(!isolate_lib.IsNull()); |
| 63 const String& class_name = | 63 const String& class_name = |
| 64 String::Handle(isolate_lib.PrivateName(Symbols::_ReceivePortImpl())); | 64 String::Handle(isolate_lib.PrivateName(Symbols::_ReceivePortImpl())); |
| 65 const String& function_name = |
| 66 String::Handle(isolate_lib.PrivateName(Symbols::_get_or_create())); |
| 65 func = Resolver::ResolveStatic(isolate_lib, | 67 func = Resolver::ResolveStatic(isolate_lib, |
| 66 class_name, | 68 class_name, |
| 67 Symbols::_get_or_create(), | 69 function_name, |
| 68 kNumArguments, | 70 kNumArguments, |
| 69 Object::empty_array(), | 71 Object::empty_array(), |
| 70 Resolver::kIsQualified); | 72 Resolver::kIsQualified); |
| 73 ASSERT(!func.IsNull()); |
| 71 isolate->object_store()->set_receive_port_create_function(func); | 74 isolate->object_store()->set_receive_port_create_function(func); |
| 72 } | 75 } |
| 73 const Array& args = Array::Handle(isolate, Array::New(kNumArguments)); | 76 const Array& args = Array::Handle(isolate, Array::New(kNumArguments)); |
| 74 args.SetAt(0, Integer::Handle(isolate, Integer::New(port_id))); | 77 args.SetAt(0, Integer::Handle(isolate, Integer::New(port_id))); |
| 75 const Object& result = | 78 const Object& result = |
| 76 Object::Handle(isolate, DartEntry::InvokeStatic(func, args)); | 79 Object::Handle(isolate, DartEntry::InvokeStatic(func, args)); |
| 77 if (!result.IsError()) { | 80 if (!result.IsError()) { |
| 78 PortMap::SetLive(port_id); | 81 PortMap::SetLive(port_id); |
| 79 } | 82 } |
| 80 return result.raw(); | 83 return result.raw(); |
| (...skipping 407 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 488 | 491 |
| 489 DEFINE_NATIVE_ENTRY(isolate_getPortInternal, 0) { | 492 DEFINE_NATIVE_ENTRY(isolate_getPortInternal, 0) { |
| 490 const Object& port = Object::Handle(ReceivePortCreate(isolate->main_port())); | 493 const Object& port = Object::Handle(ReceivePortCreate(isolate->main_port())); |
| 491 if (port.IsError()) { | 494 if (port.IsError()) { |
| 492 Exceptions::PropagateError(Error::Cast(port)); | 495 Exceptions::PropagateError(Error::Cast(port)); |
| 493 } | 496 } |
| 494 return port.raw(); | 497 return port.raw(); |
| 495 } | 498 } |
| 496 | 499 |
| 497 } // namespace dart | 500 } // namespace dart |
| OLD | NEW |