Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(238)

Side by Side Diff: runtime/vm/dart_api_impl_test.cc

Issue 10928065: Revert "Revert "Finalize reachable weak persistent handles at isolate shutdown."" (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | runtime/vm/dart_api_state.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
1441 TEST_CASE(ObjectGroups) { 1454 TEST_CASE(ObjectGroups) {
1442 Dart_Handle strong = Dart_Null(); 1455 Dart_Handle strong = Dart_Null();
1443 EXPECT(Dart_IsNull(strong)); 1456 EXPECT(Dart_IsNull(strong));
1444 1457
1445 Dart_Handle weak1 = Dart_Null(); 1458 Dart_Handle weak1 = Dart_Null();
1446 EXPECT(Dart_IsNull(weak1)); 1459 EXPECT(Dart_IsNull(weak1));
1447 1460
1448 Dart_Handle weak2 = Dart_Null(); 1461 Dart_Handle weak2 = Dart_Null();
1449 EXPECT(Dart_IsNull(weak2)); 1462 EXPECT(Dart_IsNull(weak2));
1450 1463
(...skipping 5041 matching lines...) Expand 10 before | Expand all | Expand 10 after
6492 EXPECT(Dart_IsString(str)); 6505 EXPECT(Dart_IsString(str));
6493 len = -1; 6506 len = -1;
6494 EXPECT_VALID(Dart_StringLength(str, &len)); 6507 EXPECT_VALID(Dart_StringLength(str, &len));
6495 EXPECT_EQ(0, len); 6508 EXPECT_EQ(0, len);
6496 } 6509 }
6497 6510
6498 6511
6499 #endif // defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64). 6512 #endif // defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64).
6500 6513
6501 } // namespace dart 6514 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/dart_api_state.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698