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_native_api.h" | 5 #include "include/dart_native_api.h" |
6 | 6 |
7 #include "platform/assert.h" | 7 #include "platform/assert.h" |
8 #include "vm/dart_api_impl.h" | 8 #include "vm/dart_api_impl.h" |
9 #include "vm/dart_api_message.h" | 9 #include "vm/dart_api_message.h" |
10 #include "vm/dart_api_state.h" | 10 #include "vm/dart_api_state.h" |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
49 bool success = writer.WriteCMessage(message); | 49 bool success = writer.WriteCMessage(message); |
50 | 50 |
51 if (!success) return success; | 51 if (!success) return success; |
52 | 52 |
53 // Post the message at the given port. | 53 // Post the message at the given port. |
54 return PortMap::PostMessage(new Message( | 54 return PortMap::PostMessage(new Message( |
55 port_id, buffer, writer.BytesWritten(), Message::kNormalPriority)); | 55 port_id, buffer, writer.BytesWritten(), Message::kNormalPriority)); |
56 } | 56 } |
57 | 57 |
58 | 58 |
59 DART_EXPORT bool Dart_PostInteger(Dart_Port port_id, int64_t message) { | |
60 if (Smi::IsValid(message)) { | |
61 return PortMap::PostMessage(new Message( | |
62 port_id, Smi::New(message), Message::kNormalPriority)); | |
63 } | |
64 Dart_CObject cobj; | |
65 cobj.type = Dart_CObject_kInt64; | |
66 cobj.value.as_int64 = message; | |
67 return Dart_PostCObject(port_id, &cobj); | |
Ivan Posva
2015/12/12 01:10:55
I noticed that you are calling Dart_PostCObject he
zra
2015/12/12 01:50:50
I won't be able to submit a fix for a couple hours
| |
68 } | |
69 | |
70 | |
59 DART_EXPORT Dart_Port Dart_NewNativePort(const char* name, | 71 DART_EXPORT Dart_Port Dart_NewNativePort(const char* name, |
60 Dart_NativeMessageHandler handler, | 72 Dart_NativeMessageHandler handler, |
61 bool handle_concurrently) { | 73 bool handle_concurrently) { |
62 if (name == NULL) { | 74 if (name == NULL) { |
63 name = "<UnnamedNativePort>"; | 75 name = "<UnnamedNativePort>"; |
64 } | 76 } |
65 if (handler == NULL) { | 77 if (handler == NULL) { |
66 OS::PrintErr("%s expects argument 'handler' to be non-null.\n", | 78 OS::PrintErr("%s expects argument 'handler' to be non-null.\n", |
67 CURRENT_FUNC); | 79 CURRENT_FUNC); |
68 return ILLEGAL_PORT; | 80 return ILLEGAL_PORT; |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
104 Dart_Handle result = Api::CheckAndFinalizePendingClasses(T); | 116 Dart_Handle result = Api::CheckAndFinalizePendingClasses(T); |
105 if (::Dart_IsError(result)) { | 117 if (::Dart_IsError(result)) { |
106 return result; | 118 return result; |
107 } | 119 } |
108 CHECK_CALLBACK_STATE(T); | 120 CHECK_CALLBACK_STATE(T); |
109 CompileAll(T, &result); | 121 CompileAll(T, &result); |
110 return result; | 122 return result; |
111 } | 123 } |
112 | 124 |
113 } // namespace dart | 125 } // namespace dart |
OLD | NEW |