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

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

Issue 9398014: Ignore deleted handles when processing weak roots. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: final revision Created 8 years, 10 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/utils.h" 7 #include "platform/utils.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_state.h" 10 #include "vm/dart_api_state.h"
(...skipping 1319 matching lines...) Expand 10 before | Expand all | Expand 10 after
1330 Isolate::Current()->heap()->CollectGarbage(Heap::kOld); 1330 Isolate::Current()->heap()->CollectGarbage(Heap::kOld);
1331 1331
1332 // weak ref to old space object should now be cleared 1332 // weak ref to old space object should now be cleared
1333 EXPECT_VALID(weak_new_ref); 1333 EXPECT_VALID(weak_new_ref);
1334 EXPECT(Dart_IsNull(weak_new_ref)); 1334 EXPECT(Dart_IsNull(weak_new_ref));
1335 EXPECT_VALID(weak_old_ref); 1335 EXPECT_VALID(weak_old_ref);
1336 EXPECT(Dart_IsNull(weak_old_ref)); 1336 EXPECT(Dart_IsNull(weak_old_ref));
1337 1337
1338 Dart_DeletePersistentHandle(weak_new_ref); 1338 Dart_DeletePersistentHandle(weak_new_ref);
1339 Dart_DeletePersistentHandle(weak_old_ref); 1339 Dart_DeletePersistentHandle(weak_old_ref);
1340
1341 // garbage collect one last time to revisit deleted handles
1342 Isolate::Current()->heap()->CollectGarbage(Heap::kNew);
1343 Isolate::Current()->heap()->CollectGarbage(Heap::kOld);
1340 } 1344 }
1341 1345
1342 1346
1343 static void WeakPersistentHandlePeerFinalizer(Dart_Handle handle, void* peer) { 1347 static void WeakPersistentHandlePeerFinalizer(Dart_Handle handle, void* peer) {
1344 *static_cast<int*>(peer) = 42; 1348 *static_cast<int*>(peer) = 42;
1345 } 1349 }
1346 1350
1347 1351
1348 TEST_CASE(WeakPersistentHandleCallback) { 1352 TEST_CASE(WeakPersistentHandleCallback) {
1349 Dart_Handle weak_ref = Dart_Null(); 1353 Dart_Handle weak_ref = Dart_Null();
(...skipping 2377 matching lines...) Expand 10 before | Expand all | Expand 10 after
3727 // We should have received the expected number of interrupts. 3731 // We should have received the expected number of interrupts.
3728 EXPECT_EQ(kInterruptCount, interrupt_count); 3732 EXPECT_EQ(kInterruptCount, interrupt_count);
3729 3733
3730 // Give the spawned thread enough time to properly exit. 3734 // Give the spawned thread enough time to properly exit.
3731 Isolate::SetInterruptCallback(saved); 3735 Isolate::SetInterruptCallback(saved);
3732 } 3736 }
3733 3737
3734 #endif // defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64). 3738 #endif // defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64).
3735 3739
3736 } // namespace dart 3740 } // 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