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 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 } | 88 } |
89 | 89 |
90 | 90 |
91 DEFINE_NATIVE_ENTRY(RawReceivePortImpl_closeInternal, 1) { | 91 DEFINE_NATIVE_ENTRY(RawReceivePortImpl_closeInternal, 1) { |
92 GET_NON_NULL_NATIVE_ARGUMENT(Smi, id, arguments->NativeArgAt(0)); | 92 GET_NON_NULL_NATIVE_ARGUMENT(Smi, id, arguments->NativeArgAt(0)); |
93 PortMap::ClosePort(id.Value()); | 93 PortMap::ClosePort(id.Value()); |
94 return Object::null(); | 94 return Object::null(); |
95 } | 95 } |
96 | 96 |
97 | 97 |
98 DEFINE_NATIVE_ENTRY(SendPortImpl_sendInternal_, 3) { | 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 GET_NON_NULL_NATIVE_ARGUMENT(Smi, reply_id, arguments->NativeArgAt(1)); | |
101 // TODO(iposva): Allow for arbitrary messages to be sent. | 100 // TODO(iposva): Allow for arbitrary messages to be sent. |
102 GET_NON_NULL_NATIVE_ARGUMENT(Instance, obj, arguments->NativeArgAt(2)); | 101 GET_NON_NULL_NATIVE_ARGUMENT(Instance, obj, arguments->NativeArgAt(1)); |
103 | 102 |
104 uint8_t* data = NULL; | 103 uint8_t* data = NULL; |
105 MessageWriter writer(&data, &allocator); | 104 MessageWriter writer(&data, &allocator); |
106 writer.WriteMessage(obj); | 105 writer.WriteMessage(obj); |
107 | 106 |
108 // TODO(turnidge): Throw an exception when the return value is false? | 107 // TODO(turnidge): Throw an exception when the return value is false? |
109 PortMap::PostMessage(new Message(send_id.Value(), reply_id.Value(), | 108 PortMap::PostMessage(new Message(send_id.Value(), Message::kIllegalPort, |
110 data, writer.BytesWritten(), | 109 data, writer.BytesWritten(), |
111 Message::kNormalPriority)); | 110 Message::kNormalPriority)); |
112 return Object::null(); | 111 return Object::null(); |
113 } | 112 } |
114 | 113 |
115 | 114 |
116 static void ThrowIsolateSpawnException(const String& message) { | 115 static void ThrowIsolateSpawnException(const String& message) { |
117 const Array& args = Array::Handle(Array::New(1)); | 116 const Array& args = Array::Handle(Array::New(1)); |
118 args.SetAt(0, message); | 117 args.SetAt(0, message); |
119 Exceptions::ThrowByType(Exceptions::kIsolateSpawn, args); | 118 Exceptions::ThrowByType(Exceptions::kIsolateSpawn, args); |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
269 | 268 |
270 // The control port is being accessed as a regular port from Dart code. This | 269 // The control port is being accessed as a regular port from Dart code. This |
271 // is most likely due to the _startIsolate code in dart:isolate. Account for | 270 // is most likely due to the _startIsolate code in dart:isolate. Account for |
272 // this by increasing the number of open control ports. | 271 // this by increasing the number of open control ports. |
273 isolate->message_handler()->increment_control_ports(); | 272 isolate->message_handler()->increment_control_ports(); |
274 | 273 |
275 return port.raw(); | 274 return port.raw(); |
276 } | 275 } |
277 | 276 |
278 } // namespace dart | 277 } // namespace dart |
OLD | NEW |