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

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

Issue 983653002: Revert of rename UniquePersistent to Global (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « include/v8.h ('k') | no next file » | 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 273d0090a6072522306f7d9c5cedc63a75dcaad5..44270382d4e76e9f03e04d629066efd59d72b7d6 100644
--- a/test/cctest/test-api.cc
+++ b/test/cctest/test-api.cc
@@ -2127,7 +2127,7 @@
void* huge = reinterpret_cast<void*>(~static_cast<uintptr_t>(1));
CheckAlignedPointerInInternalField(obj, huge);
- v8::Global<v8::Object> persistent(isolate, obj);
+ v8::UniquePersistent<v8::Object> persistent(isolate, obj);
CHECK_EQ(1, Object::InternalFieldCount(persistent));
CHECK_EQ(huge, Object::GetAlignedPointerFromInternalField(persistent, 0));
}
@@ -3038,20 +3038,20 @@
template <class T>
-static v8::Global<T> PassUnique(v8::Global<T> unique) {
+static v8::UniquePersistent<T> PassUnique(v8::UniquePersistent<T> unique) {
return unique.Pass();
}
template <class T>
-static v8::Global<T> ReturnUnique(v8::Isolate* isolate,
- const v8::Persistent<T>& global) {
- v8::Global<String> unique(isolate, global);
+static v8::UniquePersistent<T> ReturnUnique(v8::Isolate* isolate,
+ const v8::Persistent<T>& global) {
+ v8::UniquePersistent<String> unique(isolate, global);
return unique.Pass();
}
-THREADED_TEST(Global) {
+THREADED_TEST(UniquePersistent) {
v8::Isolate* isolate = CcTest::isolate();
v8::Persistent<String> global;
{
@@ -3062,11 +3062,11 @@
reinterpret_cast<v8::internal::Isolate*>(isolate)->global_handles();
int initial_handle_count = global_handles->global_handles_count();
{
- v8::Global<String> unique(isolate, global);
+ v8::UniquePersistent<String> unique(isolate, global);
CHECK_EQ(initial_handle_count + 1, global_handles->global_handles_count());
// Test assignment via Pass
{
- v8::Global<String> copy = unique.Pass();
+ v8::UniquePersistent<String> copy = unique.Pass();
CHECK(unique.IsEmpty());
CHECK(copy == global);
CHECK_EQ(initial_handle_count + 1,
@@ -3075,7 +3075,7 @@
}
// Test ctor via Pass
{
- v8::Global<String> copy(unique.Pass());
+ v8::UniquePersistent<String> copy(unique.Pass());
CHECK(unique.IsEmpty());
CHECK(copy == global);
CHECK_EQ(initial_handle_count + 1,
@@ -3084,7 +3084,7 @@
}
// Test pass through function call
{
- v8::Global<String> copy = PassUnique(unique.Pass());
+ v8::UniquePersistent<String> copy = PassUnique(unique.Pass());
CHECK(unique.IsEmpty());
CHECK(copy == global);
CHECK_EQ(initial_handle_count + 1,
@@ -3095,7 +3095,7 @@
}
// Test pass from function call
{
- v8::Global<String> unique = ReturnUnique(isolate, global);
+ v8::UniquePersistent<String> unique = ReturnUnique(isolate, global);
CHECK(unique == global);
CHECK_EQ(initial_handle_count + 1, global_handles->global_handles_count());
}
@@ -3129,7 +3129,8 @@
return data.GetParameter()->key;
}
static void DisposeCallbackData(WeakCallbackDataType* data) { delete data; }
- static void Dispose(v8::Isolate* isolate, v8::Global<V> value, K key) {}
+ static void Dispose(v8::Isolate* isolate, v8::UniquePersistent<V> value,
+ K key) {}
};
@@ -3155,7 +3156,7 @@
typename Map::PersistentValueReference ref = map.GetReference(7);
CHECK(expected->Equals(ref.NewLocal(isolate)));
}
- v8::Global<v8::Object> removed = map.Remove(7);
+ v8::UniquePersistent<v8::Object> removed = map.Remove(7);
CHECK_EQ(0, static_cast<int>(map.Size()));
CHECK(expected == removed);
removed = map.Remove(7);
@@ -3167,7 +3168,8 @@
{
typename Map::PersistentValueReference ref;
Local<v8::Object> expected2 = v8::Object::New(isolate);
- removed = map.Set(8, v8::Global<v8::Object>(isolate, expected2), &ref);
+ removed = map.Set(8, v8::UniquePersistent<v8::Object>(isolate, expected2),
+ &ref);
CHECK_EQ(1, static_cast<int>(map.Size()));
CHECK(expected == removed);
CHECK(expected2->Equals(ref.NewLocal(isolate)));
@@ -3210,7 +3212,7 @@
Local<v8::Object> obj1 = v8::Object::New(isolate);
Local<v8::Object> obj2 = v8::Object::New(isolate);
- v8::Global<v8::Object> obj3(isolate, v8::Object::New(isolate));
+ v8::UniquePersistent<v8::Object> obj3(isolate, v8::Object::New(isolate));
CHECK(vector.IsEmpty());
CHECK_EQ(0, static_cast<int>(vector.Size()));
« no previous file with comments | « include/v8.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698