| 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 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 DEFINE_NATIVE_ENTRY(SendPortImpl_sendInternal_, 2) { | 98 DEFINE_NATIVE_ENTRY(SendPortImpl_sendInternal_, 2) { |
| 99 GET_NON_NULL_NATIVE_ARGUMENT(Smi, send_id, arguments->NativeArgAt(0)); | 99 GET_NON_NULL_NATIVE_ARGUMENT(Smi, send_id, arguments->NativeArgAt(0)); |
| 100 // TODO(iposva): Allow for arbitrary messages to be sent. | 100 // TODO(iposva): Allow for arbitrary messages to be sent. |
| 101 GET_NON_NULL_NATIVE_ARGUMENT(Instance, obj, arguments->NativeArgAt(1)); | 101 GET_NON_NULL_NATIVE_ARGUMENT(Instance, obj, arguments->NativeArgAt(1)); |
| 102 | 102 |
| 103 uint8_t* data = NULL; | 103 uint8_t* data = NULL; |
| 104 MessageWriter writer(&data, &allocator); | 104 MessageWriter writer(&data, &allocator); |
| 105 writer.WriteMessage(obj); | 105 writer.WriteMessage(obj); |
| 106 | 106 |
| 107 // TODO(turnidge): Throw an exception when the return value is false? | 107 // TODO(turnidge): Throw an exception when the return value is false? |
| 108 PortMap::PostMessage(new Message(send_id.Value(), Message::kIllegalPort, | 108 PortMap::PostMessage(new Message(send_id.Value(), |
| 109 data, writer.BytesWritten(), | 109 data, writer.BytesWritten(), |
| 110 Message::kNormalPriority)); | 110 Message::kNormalPriority)); |
| 111 return Object::null(); | 111 return Object::null(); |
| 112 } | 112 } |
| 113 | 113 |
| 114 | 114 |
| 115 static void ThrowIsolateSpawnException(const String& message) { | 115 static void ThrowIsolateSpawnException(const String& message) { |
| 116 const Array& args = Array::Handle(Array::New(1)); | 116 const Array& args = Array::Handle(Array::New(1)); |
| 117 args.SetAt(0, message); | 117 args.SetAt(0, message); |
| 118 Exceptions::ThrowByType(Exceptions::kIsolateSpawn, args); | 118 Exceptions::ThrowByType(Exceptions::kIsolateSpawn, args); |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 260 | 260 |
| 261 // The control port is being accessed as a regular port from Dart code. This | 261 // The control port is being accessed as a regular port from Dart code. This |
| 262 // is most likely due to the _startIsolate code in dart:isolate. Account for | 262 // is most likely due to the _startIsolate code in dart:isolate. Account for |
| 263 // this by increasing the number of open control ports. | 263 // this by increasing the number of open control ports. |
| 264 isolate->message_handler()->increment_control_ports(); | 264 isolate->message_handler()->increment_control_ports(); |
| 265 | 265 |
| 266 return port.raw(); | 266 return port.raw(); |
| 267 } | 267 } |
| 268 | 268 |
| 269 } // namespace dart | 269 } // namespace dart |
| OLD | NEW |