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 "include/dart_api.h" | 5 #include "include/dart_api.h" |
6 | 6 |
7 #include "vm/bigint_operations.h" | 7 #include "vm/bigint_operations.h" |
8 #include "vm/class_finalizer.h" | 8 #include "vm/class_finalizer.h" |
9 #include "vm/compiler.h" | 9 #include "vm/compiler.h" |
10 #include "vm/dart.h" | 10 #include "vm/dart.h" |
(...skipping 1001 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1012 ApiMessageWriter writer(&buffer, &allocator); | 1012 ApiMessageWriter writer(&buffer, &allocator); |
1013 writer.WriteMessage(len, data); | 1013 writer.WriteMessage(len, data); |
1014 | 1014 |
1015 // Post the message at the given port. | 1015 // Post the message at the given port. |
1016 return PortMap::PostMessage(new Message( | 1016 return PortMap::PostMessage(new Message( |
1017 port_id, Message::kIllegalPort, buffer, writer.BytesWritten(), | 1017 port_id, Message::kIllegalPort, buffer, writer.BytesWritten(), |
1018 Message::kNormalPriority)); | 1018 Message::kNormalPriority)); |
1019 } | 1019 } |
1020 | 1020 |
1021 | 1021 |
1022 DART_EXPORT bool Dart_PostCObject(Dart_Port port_id, | 1022 DART_EXPORT bool Dart_PostCObject(Dart_Port port_id, Dart_CObject* message) { |
1023 Dart_CObject* message) { | |
1024 uint8_t* buffer = NULL; | 1023 uint8_t* buffer = NULL; |
1025 ApiMessageWriter writer(&buffer, allocator); | 1024 ApiMessageWriter writer(&buffer, allocator); |
1026 bool success = writer.WriteCMessage(message); | 1025 bool success = writer.WriteCMessage(message); |
1027 | 1026 |
1028 if (!success) return success; | 1027 if (!success) return success; |
1029 | 1028 |
1030 // Post the message at the given port. | 1029 // Post the message at the given port. |
1031 return PortMap::PostMessage(new Message( | 1030 return PortMap::PostMessage(new Message( |
1032 port_id, Message::kIllegalPort, buffer, writer.BytesWritten(), | 1031 port_id, Message::kIllegalPort, buffer, writer.BytesWritten(), |
1033 Message::kNormalPriority)); | 1032 Message::kNormalPriority)); |
(...skipping 3411 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4445 } | 4444 } |
4446 { | 4445 { |
4447 NoGCScope no_gc; | 4446 NoGCScope no_gc; |
4448 RawObject* raw_obj = obj.raw(); | 4447 RawObject* raw_obj = obj.raw(); |
4449 isolate->heap()->SetPeer(raw_obj, peer); | 4448 isolate->heap()->SetPeer(raw_obj, peer); |
4450 } | 4449 } |
4451 return Api::Success(isolate); | 4450 return Api::Success(isolate); |
4452 } | 4451 } |
4453 | 4452 |
4454 } // namespace dart | 4453 } // namespace dart |
OLD | NEW |