| OLD | NEW |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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 | 6 |
| 7 #include "vm/assert.h" | 7 #include "vm/assert.h" |
| 8 #include "vm/class_finalizer.h" | 8 #include "vm/class_finalizer.h" |
| 9 #include "vm/dart.h" | 9 #include "vm/dart.h" |
| 10 #include "vm/dart_api_impl.h" | 10 #include "vm/dart_api_impl.h" |
| (...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 315 ThrowErrorException(Exceptions::kInternalError, | 315 ThrowErrorException(Exceptions::kInternalError, |
| 316 "Unable to create send port to isolate", | 316 "Unable to create send port to isolate", |
| 317 library_url, | 317 library_url, |
| 318 class_name); | 318 class_name); |
| 319 } | 319 } |
| 320 arguments->SetReturn(port); | 320 arguments->SetReturn(port); |
| 321 } | 321 } |
| 322 | 322 |
| 323 | 323 |
| 324 DEFINE_NATIVE_ENTRY(ReceivePortImpl_factory, 1) { | 324 DEFINE_NATIVE_ENTRY(ReceivePortImpl_factory, 1) { |
| 325 ASSERT(TypeArguments::CheckedHandle(arguments->At(0)).IsNull()); | 325 ASSERT(AbstractTypeArguments::CheckedHandle(arguments->At(0)).IsNull()); |
| 326 intptr_t port_id = PortMap::CreatePort(); | 326 intptr_t port_id = PortMap::CreatePort(); |
| 327 const Instance& port = Instance::Handle(ReceivePortCreate(port_id)); | 327 const Instance& port = Instance::Handle(ReceivePortCreate(port_id)); |
| 328 arguments->SetReturn(port); | 328 arguments->SetReturn(port); |
| 329 } | 329 } |
| 330 | 330 |
| 331 | 331 |
| 332 DEFINE_NATIVE_ENTRY(ReceivePortImpl_closeInternal, 1) { | 332 DEFINE_NATIVE_ENTRY(ReceivePortImpl_closeInternal, 1) { |
| 333 intptr_t id = Smi::CheckedHandle(arguments->At(0)).Value(); | 333 intptr_t id = Smi::CheckedHandle(arguments->At(0)).Value(); |
| 334 PortMap::ClosePort(id); | 334 PortMap::ClosePort(id); |
| 335 } | 335 } |
| 336 | 336 |
| 337 | 337 |
| 338 DEFINE_NATIVE_ENTRY(SendPortImpl_sendInternal_, 3) { | 338 DEFINE_NATIVE_ENTRY(SendPortImpl_sendInternal_, 3) { |
| 339 intptr_t send_id = Smi::CheckedHandle(arguments->At(0)).Value(); | 339 intptr_t send_id = Smi::CheckedHandle(arguments->At(0)).Value(); |
| 340 intptr_t reply_id = Smi::CheckedHandle(arguments->At(1)).Value(); | 340 intptr_t reply_id = Smi::CheckedHandle(arguments->At(1)).Value(); |
| 341 // TODO(iposva): Allow for arbitrary messages to be sent. | 341 // TODO(iposva): Allow for arbitrary messages to be sent. |
| 342 uint8_t* data = SerializeObject(Instance::CheckedHandle(arguments->At(2))); | 342 uint8_t* data = SerializeObject(Instance::CheckedHandle(arguments->At(2))); |
| 343 | 343 |
| 344 // TODO(turnidge): Throw an exception when the return value is false? | 344 // TODO(turnidge): Throw an exception when the return value is false? |
| 345 PortMap::PostMessage(send_id, reply_id, Api::CastMessage(data)); | 345 PortMap::PostMessage(send_id, reply_id, Api::CastMessage(data)); |
| 346 } | 346 } |
| 347 | 347 |
| 348 } // namespace dart | 348 } // namespace dart |
| OLD | NEW |