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 1037 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1048 | 1048 |
1049 DART_EXPORT bool Dart_Post(Dart_Port port_id, Dart_Handle handle) { | 1049 DART_EXPORT bool Dart_Post(Dart_Port port_id, Dart_Handle handle) { |
1050 Isolate* isolate = Isolate::Current(); | 1050 Isolate* isolate = Isolate::Current(); |
1051 DARTSCOPE(isolate); | 1051 DARTSCOPE(isolate); |
1052 const Object& object = Object::Handle(isolate, Api::UnwrapHandle(handle)); | 1052 const Object& object = Object::Handle(isolate, Api::UnwrapHandle(handle)); |
1053 uint8_t* data = NULL; | 1053 uint8_t* data = NULL; |
1054 MessageWriter writer(&data, &allocator); | 1054 MessageWriter writer(&data, &allocator); |
1055 writer.WriteMessage(object); | 1055 writer.WriteMessage(object); |
1056 intptr_t len = writer.BytesWritten(); | 1056 intptr_t len = writer.BytesWritten(); |
1057 return PortMap::PostMessage(new Message( | 1057 return PortMap::PostMessage(new Message( |
1058 port_id, Message::kIllegalPort, data, len, Message::kNormalPriority)); | 1058 port_id, data, len, Message::kNormalPriority)); |
1059 } | 1059 } |
1060 | 1060 |
1061 | 1061 |
1062 DART_EXPORT Dart_Handle Dart_NewSendPort(Dart_Port port_id) { | 1062 DART_EXPORT Dart_Handle Dart_NewSendPort(Dart_Port port_id) { |
1063 Isolate* isolate = Isolate::Current(); | 1063 Isolate* isolate = Isolate::Current(); |
1064 DARTSCOPE(isolate); | 1064 DARTSCOPE(isolate); |
1065 CHECK_CALLBACK_STATE(isolate); | 1065 CHECK_CALLBACK_STATE(isolate); |
1066 return Api::NewHandle(isolate, DartLibraryCalls::NewSendPort(port_id)); | 1066 return Api::NewHandle(isolate, DartLibraryCalls::NewSendPort(port_id)); |
1067 } | 1067 } |
1068 | 1068 |
(...skipping 3374 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4443 } | 4443 } |
4444 { | 4444 { |
4445 NoGCScope no_gc; | 4445 NoGCScope no_gc; |
4446 RawObject* raw_obj = obj.raw(); | 4446 RawObject* raw_obj = obj.raw(); |
4447 isolate->heap()->SetPeer(raw_obj, peer); | 4447 isolate->heap()->SetPeer(raw_obj, peer); |
4448 } | 4448 } |
4449 return Api::Success(); | 4449 return Api::Success(); |
4450 } | 4450 } |
4451 | 4451 |
4452 } // namespace dart | 4452 } // namespace dart |
OLD | NEW |