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

Unified Diff: test/cctest/test-heap.cc

Issue 3011009: Add a check that weak object handle is not in NEAR_DEATH state after weak callback invocation. (Closed)
Patch Set: Addressing Mads' comments Created 10 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « test/cctest/test-api.cc ('k') | test/cctest/test-mark-compact.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/cctest/test-heap.cc
diff --git a/test/cctest/test-heap.cc b/test/cctest/test-heap.cc
index 01f23aa133f7204e75c4ffd5f7b78e9b5a82aeb4..2c286e3f0bf3b4ff5d2e28b7f8d9aaff576c6e86 100644
--- a/test/cctest/test-heap.cc
+++ b/test/cctest/test-heap.cc
@@ -322,8 +322,8 @@ static bool WeakPointerCleared = false;
static void TestWeakGlobalHandleCallback(v8::Persistent<v8::Value> handle,
void* id) {
- USE(handle);
if (1234 == reinterpret_cast<intptr_t>(id)) WeakPointerCleared = true;
+ handle.Dispose();
}
@@ -398,17 +398,8 @@ TEST(WeakGlobalHandlesMark) {
CHECK(WeakPointerCleared);
CHECK(!GlobalHandles::IsNearDeath(h1.location()));
- CHECK(GlobalHandles::IsNearDeath(h2.location()));
GlobalHandles::Destroy(h1.location());
- GlobalHandles::Destroy(h2.location());
-}
-
-static void TestDeleteWeakGlobalHandleCallback(
- v8::Persistent<v8::Value> handle,
- void* id) {
- if (1234 == reinterpret_cast<intptr_t>(id)) WeakPointerCleared = true;
- handle.Dispose();
}
TEST(DeleteWeakGlobalHandle) {
@@ -427,7 +418,7 @@ TEST(DeleteWeakGlobalHandle) {
GlobalHandles::MakeWeak(h.location(),
reinterpret_cast<void*>(1234),
- &TestDeleteWeakGlobalHandleCallback);
+ &TestWeakGlobalHandleCallback);
// Scanvenge does not recognize weak reference.
Heap::PerformScavenge();
« no previous file with comments | « test/cctest/test-api.cc ('k') | test/cctest/test-mark-compact.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698