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 #include "platform/assert.h" | 6 #include "platform/assert.h" |
7 #include "platform/json.h" | 7 #include "platform/json.h" |
8 #include "platform/utils.h" | 8 #include "platform/utils.h" |
9 #include "vm/class_finalizer.h" | 9 #include "vm/class_finalizer.h" |
10 #include "vm/dart_api_impl.h" | 10 #include "vm/dart_api_impl.h" |
(...skipping 1261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1272 | 1272 |
1273 // Test that we are able to create a persistent handle from a | 1273 // Test that we are able to create a persistent handle from a |
1274 // persistent handle. | 1274 // persistent handle. |
1275 UNIT_TEST_CASE(NewPersistentHandle_FromPersistentHandle) { | 1275 UNIT_TEST_CASE(NewPersistentHandle_FromPersistentHandle) { |
1276 TestIsolateScope __test_isolate__; | 1276 TestIsolateScope __test_isolate__; |
1277 | 1277 |
1278 Isolate* isolate = Isolate::Current(); | 1278 Isolate* isolate = Isolate::Current(); |
1279 EXPECT(isolate != NULL); | 1279 EXPECT(isolate != NULL); |
1280 ApiState* state = isolate->api_state(); | 1280 ApiState* state = isolate->api_state(); |
1281 EXPECT(state != NULL); | 1281 EXPECT(state != NULL); |
| 1282 DARTSCOPE(isolate); |
1282 | 1283 |
1283 // Start with a known persistent handle. | 1284 // Start with a known persistent handle. |
1284 Dart_Handle obj1 = Dart_True(); | 1285 Dart_Handle obj1 = Dart_True(); |
1285 EXPECT(state->IsValidPersistentHandle(obj1)); | 1286 EXPECT(state->IsValidPersistentHandle(obj1)); |
1286 | 1287 |
1287 // And use it to allocate a second persistent handle. | 1288 // And use it to allocate a second persistent handle. |
1288 Dart_Handle obj2 = Dart_NewPersistentHandle(obj1); | 1289 Dart_Handle obj2 = Dart_NewPersistentHandle(obj1); |
1289 EXPECT(state->IsValidPersistentHandle(obj2)); | 1290 EXPECT(state->IsValidPersistentHandle(obj2)); |
1290 | 1291 |
1291 // Make sure that the value transferred. | 1292 // Make sure that the value transferred. |
(...skipping 5851 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7143 EXPECT(o2 == reinterpret_cast<void*>(&p2)); | 7144 EXPECT(o2 == reinterpret_cast<void*>(&p2)); |
7144 } | 7145 } |
7145 Dart_ExitScope(); | 7146 Dart_ExitScope(); |
7146 isolate->heap()->CollectGarbage(Heap::kOld); | 7147 isolate->heap()->CollectGarbage(Heap::kOld); |
7147 EXPECT_EQ(0, isolate->heap()->PeerCount()); | 7148 EXPECT_EQ(0, isolate->heap()->PeerCount()); |
7148 } | 7149 } |
7149 | 7150 |
7150 #endif // defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64). | 7151 #endif // defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64). |
7151 | 7152 |
7152 } // namespace dart | 7153 } // namespace dart |
OLD | NEW |