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

Side by Side Diff: test/cctest/test-heap-profiler.cc

Issue 23707009: Deprecate Persistent functions which were marked to be deprecated. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Code review (svenpanne) Created 7 years, 3 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 | « test/cctest/test-heap.cc ('k') | test/cctest/test-mark-compact.cc » ('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 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 1183 matching lines...) Expand 10 before | Expand all | Expand 10 after
1194 LocalContext env; 1194 LocalContext env;
1195 v8::Isolate* isolate = env->GetIsolate(); 1195 v8::Isolate* isolate = env->GetIsolate();
1196 v8::HandleScope scope(isolate); 1196 v8::HandleScope scope(isolate);
1197 v8::HeapProfiler* heap_profiler = isolate->GetHeapProfiler(); 1197 v8::HeapProfiler* heap_profiler = isolate->GetHeapProfiler();
1198 1198
1199 heap_profiler->SetWrapperClassInfoProvider( 1199 heap_profiler->SetWrapperClassInfoProvider(
1200 1, TestRetainedObjectInfo::WrapperInfoCallback); 1200 1, TestRetainedObjectInfo::WrapperInfoCallback);
1201 heap_profiler->SetWrapperClassInfoProvider( 1201 heap_profiler->SetWrapperClassInfoProvider(
1202 2, TestRetainedObjectInfo::WrapperInfoCallback); 1202 2, TestRetainedObjectInfo::WrapperInfoCallback);
1203 v8::Persistent<v8::String> p_AAA(isolate, v8_str("AAA")); 1203 v8::Persistent<v8::String> p_AAA(isolate, v8_str("AAA"));
1204 p_AAA.SetWrapperClassId(isolate, 1); 1204 p_AAA.SetWrapperClassId(1);
1205 v8::Persistent<v8::String> p_BBB(isolate, v8_str("BBB")); 1205 v8::Persistent<v8::String> p_BBB(isolate, v8_str("BBB"));
1206 p_BBB.SetWrapperClassId(isolate, 1); 1206 p_BBB.SetWrapperClassId(1);
1207 v8::Persistent<v8::String> p_CCC(isolate, v8_str("CCC")); 1207 v8::Persistent<v8::String> p_CCC(isolate, v8_str("CCC"));
1208 p_CCC.SetWrapperClassId(isolate, 2); 1208 p_CCC.SetWrapperClassId(2);
1209 CHECK_EQ(0, TestRetainedObjectInfo::instances.length()); 1209 CHECK_EQ(0, TestRetainedObjectInfo::instances.length());
1210 const v8::HeapSnapshot* snapshot = 1210 const v8::HeapSnapshot* snapshot =
1211 heap_profiler->TakeHeapSnapshot(v8_str("retained")); 1211 heap_profiler->TakeHeapSnapshot(v8_str("retained"));
1212 CHECK(ValidateSnapshot(snapshot)); 1212 CHECK(ValidateSnapshot(snapshot));
1213 1213
1214 CHECK_EQ(3, TestRetainedObjectInfo::instances.length()); 1214 CHECK_EQ(3, TestRetainedObjectInfo::instances.length());
1215 for (int i = 0; i < TestRetainedObjectInfo::instances.length(); ++i) { 1215 for (int i = 0; i < TestRetainedObjectInfo::instances.length(); ++i) {
1216 CHECK(TestRetainedObjectInfo::instances[i]->disposed()); 1216 CHECK(TestRetainedObjectInfo::instances[i]->disposed());
1217 delete TestRetainedObjectInfo::instances[i]; 1217 delete TestRetainedObjectInfo::instances[i];
1218 } 1218 }
(...skipping 485 matching lines...) Expand 10 before | Expand all | Expand 10 after
1704 const v8::HeapGraphNode* global_handles = GetNode( 1704 const v8::HeapGraphNode* global_handles = GetNode(
1705 gc_roots, v8::HeapGraphNode::kSynthetic, "(Global handles)"); 1705 gc_roots, v8::HeapGraphNode::kSynthetic, "(Global handles)");
1706 CHECK_NE(NULL, global_handles); 1706 CHECK_NE(NULL, global_handles);
1707 return HasWeakEdge(global_handles); 1707 return HasWeakEdge(global_handles);
1708 } 1708 }
1709 1709
1710 1710
1711 static void PersistentHandleCallback(v8::Isolate* isolate, 1711 static void PersistentHandleCallback(v8::Isolate* isolate,
1712 v8::Persistent<v8::Value>* handle, 1712 v8::Persistent<v8::Value>* handle,
1713 void*) { 1713 void*) {
1714 handle->Dispose(isolate); 1714 handle->Dispose();
1715 } 1715 }
1716 1716
1717 1717
1718 TEST(WeakGlobalHandle) { 1718 TEST(WeakGlobalHandle) {
1719 LocalContext env; 1719 LocalContext env;
1720 v8::HandleScope scope(env->GetIsolate()); 1720 v8::HandleScope scope(env->GetIsolate());
1721 1721
1722 CHECK(!HasWeakGlobalHandle()); 1722 CHECK(!HasWeakGlobalHandle());
1723 1723
1724 v8::Persistent<v8::Object> handle(env->GetIsolate(), v8::Object::New()); 1724 v8::Persistent<v8::Object> handle(env->GetIsolate(), v8::Object::New());
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after
1953 heap_profiler->TakeHeapSnapshot(v8_str("snapshot")); 1953 heap_profiler->TakeHeapSnapshot(v8_str("snapshot"));
1954 CHECK(ValidateSnapshot(snapshot)); 1954 CHECK(ValidateSnapshot(snapshot));
1955 const v8::HeapGraphNode* global = GetGlobalObject(snapshot); 1955 const v8::HeapGraphNode* global = GetGlobalObject(snapshot);
1956 const v8::HeapGraphNode* foo_func = 1956 const v8::HeapGraphNode* foo_func =
1957 GetProperty(global, v8::HeapGraphEdge::kProperty, "foo"); 1957 GetProperty(global, v8::HeapGraphEdge::kProperty, "foo");
1958 CHECK_NE(NULL, foo_func); 1958 CHECK_NE(NULL, foo_func);
1959 const v8::HeapGraphNode* code = 1959 const v8::HeapGraphNode* code =
1960 GetProperty(foo_func, v8::HeapGraphEdge::kInternal, "code"); 1960 GetProperty(foo_func, v8::HeapGraphEdge::kInternal, "code");
1961 CHECK_NE(NULL, code); 1961 CHECK_NE(NULL, code);
1962 } 1962 }
OLDNEW
« no previous file with comments | « test/cctest/test-heap.cc ('k') | test/cctest/test-mark-compact.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698