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_debugger_api.h" | 5 #include "include/dart_debugger_api.h" |
6 #include "platform/assert.h" | 6 #include "platform/assert.h" |
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/dart_api_impl.h" | 9 #include "vm/dart_api_impl.h" |
10 #include "vm/dart_api_message.h" | 10 #include "vm/dart_api_message.h" |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 break; | 112 break; |
113 default: | 113 default: |
114 EXPECT(false); | 114 EXPECT(false); |
115 } | 115 } |
116 } | 116 } |
117 | 117 |
118 | 118 |
119 static void CheckEncodeDecodeMessage(Dart_CObject* root) { | 119 static void CheckEncodeDecodeMessage(Dart_CObject* root) { |
120 // Encode and decode the message. | 120 // Encode and decode the message. |
121 uint8_t* buffer = NULL; | 121 uint8_t* buffer = NULL; |
122 MessageWriter writer(&buffer, &malloc_allocator); | 122 ApiMessageWriter writer(&buffer, &malloc_allocator); |
123 writer.WriteCMessage(root); | 123 writer.WriteCMessage(root); |
124 | 124 |
125 Dart_CObject* new_root = DecodeMessage(buffer + Snapshot::kHeaderSize, | 125 Dart_CObject* new_root = DecodeMessage(buffer + Snapshot::kHeaderSize, |
126 writer.BytesWritten(), | 126 writer.BytesWritten(), |
127 &zone_allocator); | 127 &zone_allocator); |
128 | 128 |
129 // Check that the two messages are the same. | 129 // Check that the two messages are the same. |
130 CompareDartCObjects(root, new_root); | 130 CompareDartCObjects(root, new_root); |
131 } | 131 } |
132 | 132 |
(...skipping 891 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1024 } | 1024 } |
1025 Dart_ShutdownIsolate(); | 1025 Dart_ShutdownIsolate(); |
1026 free(full_snapshot); | 1026 free(full_snapshot); |
1027 free(script_snapshot); | 1027 free(script_snapshot); |
1028 } | 1028 } |
1029 | 1029 |
1030 | 1030 |
1031 TEST_CASE(IntArrayMessage) { | 1031 TEST_CASE(IntArrayMessage) { |
1032 Zone zone(Isolate::Current()); | 1032 Zone zone(Isolate::Current()); |
1033 uint8_t* buffer = NULL; | 1033 uint8_t* buffer = NULL; |
1034 MessageWriter writer(&buffer, &zone_allocator); | 1034 ApiMessageWriter writer(&buffer, &zone_allocator); |
1035 | 1035 |
1036 static const int kArrayLength = 2; | 1036 static const int kArrayLength = 2; |
1037 intptr_t data[kArrayLength] = {1, 2}; | 1037 intptr_t data[kArrayLength] = {1, 2}; |
1038 int len = kArrayLength; | 1038 int len = kArrayLength; |
1039 writer.WriteMessage(len, data); | 1039 writer.WriteMessage(len, data); |
1040 | 1040 |
1041 // Read object back from the snapshot into a C structure. | 1041 // Read object back from the snapshot into a C structure. |
1042 ApiNativeScope scope; | 1042 ApiNativeScope scope; |
1043 Dart_CObject* root = DecodeMessage(buffer + Snapshot::kHeaderSize, | 1043 Dart_CObject* root = DecodeMessage(buffer + Snapshot::kHeaderSize, |
1044 writer.BytesWritten(), | 1044 writer.BytesWritten(), |
(...skipping 487 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1532 EXPECT(Dart_ErrorHasException(result)); | 1532 EXPECT(Dart_ErrorHasException(result)); |
1533 EXPECT_SUBSTRING("Exception: nulltruefalse1234563.14[]\n", | 1533 EXPECT_SUBSTRING("Exception: nulltruefalse1234563.14[]\n", |
1534 Dart_GetError(result)); | 1534 Dart_GetError(result)); |
1535 | 1535 |
1536 Dart_ExitScope(); | 1536 Dart_ExitScope(); |
1537 } | 1537 } |
1538 | 1538 |
1539 #endif // defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64). | 1539 #endif // defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64). |
1540 | 1540 |
1541 } // namespace dart | 1541 } // namespace dart |
OLD | NEW |