| 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 1420 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1431 EXPECT(*peer == 0); | 1431 EXPECT(*peer == 0); |
| 1432 Isolate::Current()->heap()->CollectGarbage(Heap::kOld); | 1432 Isolate::Current()->heap()->CollectGarbage(Heap::kOld); |
| 1433 EXPECT(*peer == 0); | 1433 EXPECT(*peer == 0); |
| 1434 GCTestHelper::CollectNewSpace(Heap::kIgnoreApiCallbacks); | 1434 GCTestHelper::CollectNewSpace(Heap::kIgnoreApiCallbacks); |
| 1435 EXPECT(*peer == 42); | 1435 EXPECT(*peer == 42); |
| 1436 delete peer; | 1436 delete peer; |
| 1437 Dart_DeletePersistentHandle(weak_ref); | 1437 Dart_DeletePersistentHandle(weak_ref); |
| 1438 } | 1438 } |
| 1439 | 1439 |
| 1440 | 1440 |
| 1441 UNIT_TEST_CASE(WeakPersistentHandlesCallbackShutdown) { | |
| 1442 TestCase::CreateTestIsolate(); | |
| 1443 Dart_EnterScope(); | |
| 1444 Dart_Handle ref = Dart_True(); | |
| 1445 int peer = 1234; | |
| 1446 Dart_NewWeakPersistentHandle(ref, | |
| 1447 &peer, | |
| 1448 WeakPersistentHandlePeerFinalizer); | |
| 1449 Dart_ShutdownIsolate(); | |
| 1450 EXPECT(peer == 42); | |
| 1451 } | |
| 1452 | |
| 1453 | |
| 1454 TEST_CASE(ObjectGroups) { | 1441 TEST_CASE(ObjectGroups) { |
| 1455 Dart_Handle strong = Dart_Null(); | 1442 Dart_Handle strong = Dart_Null(); |
| 1456 EXPECT(Dart_IsNull(strong)); | 1443 EXPECT(Dart_IsNull(strong)); |
| 1457 | 1444 |
| 1458 Dart_Handle weak1 = Dart_Null(); | 1445 Dart_Handle weak1 = Dart_Null(); |
| 1459 EXPECT(Dart_IsNull(weak1)); | 1446 EXPECT(Dart_IsNull(weak1)); |
| 1460 | 1447 |
| 1461 Dart_Handle weak2 = Dart_Null(); | 1448 Dart_Handle weak2 = Dart_Null(); |
| 1462 EXPECT(Dart_IsNull(weak2)); | 1449 EXPECT(Dart_IsNull(weak2)); |
| 1463 | 1450 |
| (...skipping 5041 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6505 EXPECT(Dart_IsString(str)); | 6492 EXPECT(Dart_IsString(str)); |
| 6506 len = -1; | 6493 len = -1; |
| 6507 EXPECT_VALID(Dart_StringLength(str, &len)); | 6494 EXPECT_VALID(Dart_StringLength(str, &len)); |
| 6508 EXPECT_EQ(0, len); | 6495 EXPECT_EQ(0, len); |
| 6509 } | 6496 } |
| 6510 | 6497 |
| 6511 | 6498 |
| 6512 #endif // defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64). | 6499 #endif // defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64). |
| 6513 | 6500 |
| 6514 } // namespace dart | 6501 } // namespace dart |
| OLD | NEW |