Chromium Code Reviews| 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 "bin/builtin.h" | 5 #include "bin/builtin.h" |
| 6 #include "vm/compiler.h" | 6 #include "vm/compiler.h" |
| 7 #include "include/dart_api.h" | 7 #include "include/dart_api.h" |
| 8 #include "include/dart_mirrors_api.h" | 8 #include "include/dart_mirrors_api.h" |
| 9 #include "include/dart_native_api.h" | 9 #include "include/dart_native_api.h" |
| 10 #include "include/dart_tools_api.h" | 10 #include "include/dart_tools_api.h" |
| (...skipping 7142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 7153 void NewNativePort_send123(Dart_Port dest_port_id, | 7153 void NewNativePort_send123(Dart_Port dest_port_id, |
| 7154 Dart_CObject* message, | 7154 Dart_CObject* message, |
| 7155 void* peer) { | 7155 void* peer) { |
| 7156 // Gets a send port message. | 7156 // Gets a send port message. |
| 7157 EXPECT_NOTNULL(message); | 7157 EXPECT_NOTNULL(message); |
| 7158 EXPECT_EQ(Dart_CObject_kArray, message->type); | 7158 EXPECT_EQ(Dart_CObject_kArray, message->type); |
| 7159 EXPECT_EQ(Dart_CObject_kSendPort, message->value.as_array.values[0]->type); | 7159 EXPECT_EQ(Dart_CObject_kSendPort, message->value.as_array.values[0]->type); |
| 7160 | 7160 |
| 7161 // Check peer validity. | 7161 // Check peer validity. |
| 7162 EXPECT_NOTNULL(peer); | 7162 EXPECT_NOTNULL(peer); |
| 7163 EXPECT_EQ(0xDEADBEEF, *static_cast<intptr_t*>(peer)); | 7163 EXPECT_EQ(static_cast<intptr_t>(0xDEADBEEF), *static_cast<intptr_t*>(peer)); |
|
Florian Schneider
2017/01/30 22:13:23
I think the l-suffix should work, but have not con
| |
| 7164 *static_cast<intptr_t*>(peer) = 123; | 7164 *static_cast<intptr_t*>(peer) = 123; |
| 7165 | 7165 |
| 7166 // Post integer value. | 7166 // Post integer value. |
| 7167 Dart_CObject* response = | 7167 Dart_CObject* response = |
| 7168 reinterpret_cast<Dart_CObject*>(Dart_ScopeAllocate(sizeof(Dart_CObject))); | 7168 reinterpret_cast<Dart_CObject*>(Dart_ScopeAllocate(sizeof(Dart_CObject))); |
| 7169 response->type = Dart_CObject_kInt32; | 7169 response->type = Dart_CObject_kInt32; |
| 7170 response->value.as_int32 = 123; | 7170 response->value.as_int32 = 123; |
| 7171 Dart_PostCObject(message->value.as_array.values[0]->value.as_send_port.id, | 7171 Dart_PostCObject(message->value.as_array.values[0]->value.as_send_port.id, |
| 7172 response); | 7172 response); |
| 7173 } | 7173 } |
| 7174 | 7174 |
| 7175 | 7175 |
| 7176 void NewNativePort_send321(Dart_Port dest_port_id, | 7176 void NewNativePort_send321(Dart_Port dest_port_id, |
| 7177 Dart_CObject* message, | 7177 Dart_CObject* message, |
| 7178 void* peer) { | 7178 void* peer) { |
| 7179 // Gets a null message. | 7179 // Gets a null message. |
| 7180 EXPECT_NOTNULL(message); | 7180 EXPECT_NOTNULL(message); |
| 7181 EXPECT_EQ(Dart_CObject_kArray, message->type); | 7181 EXPECT_EQ(Dart_CObject_kArray, message->type); |
| 7182 EXPECT_EQ(Dart_CObject_kSendPort, message->value.as_array.values[0]->type); | 7182 EXPECT_EQ(Dart_CObject_kSendPort, message->value.as_array.values[0]->type); |
| 7183 | 7183 |
| 7184 // Check peer validity. | 7184 // Check peer validity. |
| 7185 EXPECT_NOTNULL(peer); | 7185 EXPECT_NOTNULL(peer); |
| 7186 EXPECT_EQ(0xDEADBEEF, *static_cast<intptr_t*>(peer)); | 7186 EXPECT_EQ(static_cast<intptr_t>(0xDEADBEEF), *static_cast<intptr_t*>(peer)); |
| 7187 *static_cast<intptr_t*>(peer) = 321; | 7187 *static_cast<intptr_t*>(peer) = 321; |
| 7188 | 7188 |
| 7189 // Post integer value. | 7189 // Post integer value. |
| 7190 Dart_CObject* response = | 7190 Dart_CObject* response = |
| 7191 reinterpret_cast<Dart_CObject*>(Dart_ScopeAllocate(sizeof(Dart_CObject))); | 7191 reinterpret_cast<Dart_CObject*>(Dart_ScopeAllocate(sizeof(Dart_CObject))); |
| 7192 response->type = Dart_CObject_kInt32; | 7192 response->type = Dart_CObject_kInt32; |
| 7193 response->value.as_int32 = 321; | 7193 response->value.as_int32 = 321; |
| 7194 Dart_PostCObject(message->value.as_array.values[0]->value.as_send_port.id, | 7194 Dart_PostCObject(message->value.as_array.values[0]->value.as_send_port.id, |
| 7195 response); | 7195 response); |
| 7196 } | 7196 } |
| (...skipping 2739 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 9936 EXPECT_VALID(result); | 9936 EXPECT_VALID(result); |
| 9937 result = Dart_FinalizeLoading(false); | 9937 result = Dart_FinalizeLoading(false); |
| 9938 EXPECT_VALID(result); | 9938 EXPECT_VALID(result); |
| 9939 result = Dart_Invoke(lib, NewString("foozoo"), 0, NULL); | 9939 result = Dart_Invoke(lib, NewString("foozoo"), 0, NULL); |
| 9940 EXPECT(Dart_IsError(result)); | 9940 EXPECT(Dart_IsError(result)); |
| 9941 } | 9941 } |
| 9942 | 9942 |
| 9943 #endif // !PRODUCT | 9943 #endif // !PRODUCT |
| 9944 | 9944 |
| 9945 } // namespace dart | 9945 } // namespace dart |
| OLD | NEW |