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

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

Issue 12033011: Add Isolate parameter to Persistent class. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Added explicit Created 7 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 | « test/cctest/test-heap.cc ('k') | test/cctest/test-lockers.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/cctest/test-heap-profiler.cc
diff --git a/test/cctest/test-heap-profiler.cc b/test/cctest/test-heap-profiler.cc
index 29fb1c11af73580c82c0447d70170a70159a30ba..a8a45b7b69e6c5ab458123dc0fa71946c8c772ba 100644
--- a/test/cctest/test-heap-profiler.cc
+++ b/test/cctest/test-heap-profiler.cc
@@ -1045,20 +1045,21 @@ static const v8::HeapGraphNode* GetNode(const v8::HeapGraphNode* parent,
TEST(HeapSnapshotRetainedObjectInfo) {
v8::HandleScope scope;
LocalContext env;
+ v8::Isolate* isolate = env->GetIsolate();
v8::HeapProfiler::DefineWrapperClass(
1, TestRetainedObjectInfo::WrapperInfoCallback);
v8::HeapProfiler::DefineWrapperClass(
2, TestRetainedObjectInfo::WrapperInfoCallback);
v8::Persistent<v8::String> p_AAA =
- v8::Persistent<v8::String>::New(v8_str("AAA"));
- p_AAA.SetWrapperClassId(1);
+ v8::Persistent<v8::String>::New(isolate, v8_str("AAA"));
+ p_AAA.SetWrapperClassId(isolate, 1);
v8::Persistent<v8::String> p_BBB =
- v8::Persistent<v8::String>::New(v8_str("BBB"));
- p_BBB.SetWrapperClassId(1);
+ v8::Persistent<v8::String>::New(isolate, v8_str("BBB"));
+ p_BBB.SetWrapperClassId(isolate, 1);
v8::Persistent<v8::String> p_CCC =
- v8::Persistent<v8::String>::New(v8_str("CCC"));
- p_CCC.SetWrapperClassId(2);
+ v8::Persistent<v8::String>::New(isolate, v8_str("CCC"));
+ p_CCC.SetWrapperClassId(isolate, 2);
CHECK_EQ(0, TestRetainedObjectInfo::instances.length());
const v8::HeapSnapshot* snapshot =
v8::HeapProfiler::TakeSnapshot(v8_str("retained"));
@@ -1107,8 +1108,9 @@ class GraphWithImplicitRefs {
explicit GraphWithImplicitRefs(LocalContext* env) {
CHECK_EQ(NULL, instance_);
instance_ = this;
+ v8::Isolate* isolate = (*env)->GetIsolate();
for (int i = 0; i < kObjectsCount; i++) {
- objects_[i] = v8::Persistent<v8::Object>::New(v8::Object::New());
+ objects_[i] = v8::Persistent<v8::Object>::New(isolate, v8::Object::New());
}
(*env)->Global()->Set(v8_str("root_object"), objects_[0]);
}
@@ -1478,8 +1480,10 @@ bool HasWeakGlobalHandle() {
}
-static void PersistentHandleCallback(v8::Persistent<v8::Value> handle, void*) {
- handle.Dispose();
+static void PersistentHandleCallback(v8::Isolate* isolate,
+ v8::Persistent<v8::Value> handle,
+ void*) {
+ handle.Dispose(isolate);
}
@@ -1490,8 +1494,8 @@ TEST(WeakGlobalHandle) {
CHECK(!HasWeakGlobalHandle());
v8::Persistent<v8::Object> handle =
- v8::Persistent<v8::Object>::New(v8::Object::New());
- handle.MakeWeak(NULL, PersistentHandleCallback);
+ v8::Persistent<v8::Object>::New(env->GetIsolate(), v8::Object::New());
+ handle.MakeWeak(env->GetIsolate(), NULL, PersistentHandleCallback);
CHECK(HasWeakGlobalHandle());
}
@@ -1564,6 +1568,7 @@ TEST(NoDebugObjectInSnapshot) {
TEST(PersistentHandleCount) {
v8::HandleScope scope;
LocalContext env;
+ v8::Isolate* isolate = env->GetIsolate();
// V8 also uses global handles internally, so we can't test for an absolute
// number.
@@ -1571,26 +1576,26 @@ TEST(PersistentHandleCount) {
// Create some persistent handles.
v8::Persistent<v8::String> p_AAA =
- v8::Persistent<v8::String>::New(v8_str("AAA"));
+ v8::Persistent<v8::String>::New(isolate, v8_str("AAA"));
CHECK_EQ(global_handle_count + 1,
v8::HeapProfiler::GetPersistentHandleCount());
v8::Persistent<v8::String> p_BBB =
- v8::Persistent<v8::String>::New(v8_str("BBB"));
+ v8::Persistent<v8::String>::New(isolate, v8_str("BBB"));
CHECK_EQ(global_handle_count + 2,
v8::HeapProfiler::GetPersistentHandleCount());
v8::Persistent<v8::String> p_CCC =
- v8::Persistent<v8::String>::New(v8_str("CCC"));
+ v8::Persistent<v8::String>::New(isolate, v8_str("CCC"));
CHECK_EQ(global_handle_count + 3,
v8::HeapProfiler::GetPersistentHandleCount());
// Dipose the persistent handles in a different order.
- p_AAA.Dispose();
+ p_AAA.Dispose(env->GetIsolate());
CHECK_EQ(global_handle_count + 2,
v8::HeapProfiler::GetPersistentHandleCount());
- p_CCC.Dispose();
+ p_CCC.Dispose(env->GetIsolate());
CHECK_EQ(global_handle_count + 1,
v8::HeapProfiler::GetPersistentHandleCount());
- p_BBB.Dispose();
+ p_BBB.Dispose(env->GetIsolate());
CHECK_EQ(global_handle_count, v8::HeapProfiler::GetPersistentHandleCount());
}
« no previous file with comments | « test/cctest/test-heap.cc ('k') | test/cctest/test-lockers.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698