| 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 "include/dart_api.h" | 5 #include "include/dart_api.h" |
| 6 #include "include/dart_mirrors_api.h" | 6 #include "include/dart_mirrors_api.h" |
| 7 #include "include/dart_native_api.h" | 7 #include "include/dart_native_api.h" |
| 8 | 8 |
| 9 #include "platform/assert.h" | 9 #include "platform/assert.h" |
| 10 #include "vm/bigint_operations.h" | 10 #include "vm/bigint_operations.h" |
| (...skipping 1039 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1050 const Object& object = Object::Handle(isolate, Api::UnwrapHandle(handle)); | 1050 const Object& object = Object::Handle(isolate, Api::UnwrapHandle(handle)); |
| 1051 uint8_t* data = NULL; | 1051 uint8_t* data = NULL; |
| 1052 MessageWriter writer(&data, &allocator); | 1052 MessageWriter writer(&data, &allocator); |
| 1053 writer.WriteMessage(object); | 1053 writer.WriteMessage(object); |
| 1054 intptr_t len = writer.BytesWritten(); | 1054 intptr_t len = writer.BytesWritten(); |
| 1055 return PortMap::PostMessage(new Message( | 1055 return PortMap::PostMessage(new Message( |
| 1056 port_id, Message::kIllegalPort, data, len, Message::kNormalPriority)); | 1056 port_id, Message::kIllegalPort, data, len, Message::kNormalPriority)); |
| 1057 } | 1057 } |
| 1058 | 1058 |
| 1059 | 1059 |
| 1060 DART_EXPORT bool Dart_PostPriority(Dart_Port port_id, Dart_Handle handle) { |
| 1061 Isolate* isolate = Isolate::Current(); |
| 1062 DARTSCOPE(isolate); |
| 1063 const Object& object = Object::Handle(isolate, Api::UnwrapHandle(handle)); |
| 1064 uint8_t* data = NULL; |
| 1065 MessageWriter writer(&data, &allocator); |
| 1066 writer.WriteMessage(object); |
| 1067 intptr_t len = writer.BytesWritten(); |
| 1068 return PortMap::PostMessage(new Message( |
| 1069 port_id, Message::kIllegalPort, data, len, Message::kFirstPriority)); |
| 1070 } |
| 1071 |
| 1072 |
| 1060 DART_EXPORT Dart_Handle Dart_NewSendPort(Dart_Port port_id) { | 1073 DART_EXPORT Dart_Handle Dart_NewSendPort(Dart_Port port_id) { |
| 1061 Isolate* isolate = Isolate::Current(); | 1074 Isolate* isolate = Isolate::Current(); |
| 1062 DARTSCOPE(isolate); | 1075 DARTSCOPE(isolate); |
| 1063 CHECK_CALLBACK_STATE(isolate); | 1076 CHECK_CALLBACK_STATE(isolate); |
| 1064 return Api::NewHandle(isolate, DartLibraryCalls::NewSendPort(port_id)); | 1077 return Api::NewHandle(isolate, DartLibraryCalls::NewSendPort(port_id)); |
| 1065 } | 1078 } |
| 1066 | 1079 |
| 1067 | 1080 |
| 1068 DART_EXPORT Dart_Handle Dart_GetReceivePort(Dart_Port port_id) { | 1081 DART_EXPORT Dart_Handle Dart_GetReceivePort(Dart_Port port_id) { |
| 1069 Isolate* isolate = Isolate::Current(); | 1082 Isolate* isolate = Isolate::Current(); |
| (...skipping 3231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4301 } | 4314 } |
| 4302 { | 4315 { |
| 4303 NoGCScope no_gc; | 4316 NoGCScope no_gc; |
| 4304 RawObject* raw_obj = obj.raw(); | 4317 RawObject* raw_obj = obj.raw(); |
| 4305 isolate->heap()->SetPeer(raw_obj, peer); | 4318 isolate->heap()->SetPeer(raw_obj, peer); |
| 4306 } | 4319 } |
| 4307 return Api::Success(); | 4320 return Api::Success(); |
| 4308 } | 4321 } |
| 4309 | 4322 |
| 4310 } // namespace dart | 4323 } // namespace dart |
| OLD | NEW |