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

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

Issue 898763002: Revert of Add WeakMap to v8.h (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 11 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 | « src/runtime/runtime-collections.cc ('k') | test/cctest/test-weakmaps.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/cctest/test-api.cc
diff --git a/test/cctest/test-api.cc b/test/cctest/test-api.cc
index 0d2c71eadc5e93b1c2a29be6ec723f1e731835f4..00092539d783d33e3c219ba5cac0c3ffff426cac 100644
--- a/test/cctest/test-api.cc
+++ b/test/cctest/test-api.cc
@@ -46,7 +46,6 @@
#include "src/isolate.h"
#include "src/objects.h"
#include "src/parser.h"
-#include "src/smart-pointers.h"
#include "src/snapshot.h"
#include "src/unicode-inl.h"
#include "src/utils.h"
@@ -4735,78 +4734,6 @@
CHECK(message_received);
// clear out the message listener
v8::V8::RemoveMessageListeners(check_message_5b);
-}
-
-
-TEST(WeakMap) {
- v8::Isolate* isolate = CcTest::isolate();
- i::SmartPointer<v8::WeakMap> weak_map(v8::WeakMap::New(isolate));
- CHECK(!weak_map.is_empty());
-
- LocalContext env;
- HandleScope scope(isolate);
-
- Local<Object> value = v8::Object::New(isolate);
-
- Local<Object> local1 = v8::Object::New(isolate);
- CHECK(!weak_map->Has(local1));
- CHECK(weak_map->Get(local1)->IsUndefined());
- weak_map->Set(local1, value);
- CHECK(weak_map->Has(local1));
- CHECK(value->Equals(weak_map->Get(local1)));
-
- WeakCallCounter counter(1234);
- WeakCallCounterAndPersistent<Value> o1(&counter);
- WeakCallCounterAndPersistent<Value> o2(&counter);
- WeakCallCounterAndPersistent<Value> s1(&counter);
- {
- HandleScope scope(isolate);
- Local<v8::Object> obj1 = v8::Object::New(isolate);
- Local<v8::Object> obj2 = v8::Object::New(isolate);
- Local<v8::Symbol> sym1 = v8::Symbol::New(isolate);
-
- weak_map->Set(obj1, value);
- weak_map->Set(obj2, value);
- weak_map->Set(sym1, value);
-
- o1.handle.Reset(isolate, obj1);
- o2.handle.Reset(isolate, obj2);
- s1.handle.Reset(isolate, sym1);
-
- CHECK(weak_map->Has(local1));
- CHECK(weak_map->Has(obj1));
- CHECK(weak_map->Has(obj2));
- CHECK(weak_map->Has(sym1));
-
- CHECK(value->Equals(weak_map->Get(local1)));
- CHECK(value->Equals(weak_map->Get(obj1)));
- CHECK(value->Equals(weak_map->Get(obj2)));
- CHECK(value->Equals(weak_map->Get(sym1)));
- }
- CcTest::heap()->CollectAllGarbage(TestHeap::Heap::kNoGCFlags);
- {
- HandleScope scope(isolate);
- CHECK(value->Equals(weak_map->Get(local1)));
- CHECK(value->Equals(weak_map->Get(Local<Value>::New(isolate, o1.handle))));
- CHECK(value->Equals(weak_map->Get(Local<Value>::New(isolate, o2.handle))));
- CHECK(value->Equals(weak_map->Get(Local<Value>::New(isolate, s1.handle))));
- }
-
- o1.handle.SetWeak(&o1, &WeakPointerCallback);
- o2.handle.SetWeak(&o2, &WeakPointerCallback);
- s1.handle.SetWeak(&s1, &WeakPointerCallback);
-
- CcTest::heap()->CollectAllGarbage(TestHeap::Heap::kNoGCFlags);
- CHECK_EQ(3, counter.NumberOfWeakCalls());
-
- CHECK(o1.handle.IsEmpty());
- CHECK(o2.handle.IsEmpty());
- CHECK(s1.handle.IsEmpty());
-
- CHECK(value->Equals(weak_map->Get(local1)));
- CHECK(weak_map->Delete(local1));
- CHECK(!weak_map->Has(local1));
- CHECK(weak_map->Get(local1)->IsUndefined());
}
« no previous file with comments | « src/runtime/runtime-collections.cc ('k') | test/cctest/test-weakmaps.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698