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, Dart_CObject* message) { | 1022 DART_EXPORT bool Dart_PostCObject(Dart_Port port_id, |
1023 Dart_CObject* message) { | |
Ivan Posva
2012/11/14 19:07:15
No need to wrap the line.
Søren Gjesse
2012/11/15 08:16:53
https://codereview.chromium.org//11308031.
| |
1023 uint8_t* buffer = NULL; | 1024 uint8_t* buffer = NULL; |
1024 ApiMessageWriter writer(&buffer, allocator); | 1025 ApiMessageWriter writer(&buffer, allocator); |
1025 writer.WriteCMessage(message); | 1026 bool success = writer.WriteCMessage(message); |
1027 | |
1028 if (!success) return success; | |
1026 | 1029 |
1027 // Post the message at the given port. | 1030 // Post the message at the given port. |
1028 return PortMap::PostMessage(new Message( | 1031 return PortMap::PostMessage(new Message( |
1029 port_id, Message::kIllegalPort, buffer, writer.BytesWritten(), | 1032 port_id, Message::kIllegalPort, buffer, writer.BytesWritten(), |
1030 Message::kNormalPriority)); | 1033 Message::kNormalPriority)); |
1031 } | 1034 } |
1032 | 1035 |
1033 | 1036 |
1034 DART_EXPORT bool Dart_Post(Dart_Port port_id, Dart_Handle handle) { | 1037 DART_EXPORT bool Dart_Post(Dart_Port port_id, Dart_Handle handle) { |
1035 Isolate* isolate = Isolate::Current(); | 1038 Isolate* isolate = Isolate::Current(); |
(...skipping 3427 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4463 } | 4466 } |
4464 { | 4467 { |
4465 NoGCScope no_gc; | 4468 NoGCScope no_gc; |
4466 RawObject* raw_obj = obj.raw(); | 4469 RawObject* raw_obj = obj.raw(); |
4467 isolate->heap()->SetPeer(raw_obj, peer); | 4470 isolate->heap()->SetPeer(raw_obj, peer); |
4468 } | 4471 } |
4469 return Api::Success(isolate); | 4472 return Api::Success(isolate); |
4470 } | 4473 } |
4471 | 4474 |
4472 } // namespace dart | 4475 } // namespace dart |
OLD | NEW |