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

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

Issue 103893003: Do not stop profiling if all finished profiles were deleted (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Comments addressed Created 7 years 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/cpu-profiler.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/cctest/test-cpu-profiler.cc
diff --git a/test/cctest/test-cpu-profiler.cc b/test/cctest/test-cpu-profiler.cc
index 9ddfde0773a5a60861f3fef902010d7cf3821c8f..6703ada05d3a5242a6d88118bfee5bb7f4d28011 100644
--- a/test/cctest/test-cpu-profiler.cc
+++ b/test/cctest/test-cpu-profiler.cc
@@ -1533,3 +1533,37 @@ TEST(FunctionDetails) {
CheckFunctionDetails(env->GetIsolate(), bar, "bar", "script_a",
script_a->GetId(), 3, 14);
}
+
+
+TEST(DontStopOnFinishedProfileDelete) {
+ const char* extensions[] = { "v8/profiler" };
+ v8::ExtensionConfiguration config(1, extensions);
+ LocalContext env(&config);
+ v8::Isolate* isolate = env->GetIsolate();
+ v8::HandleScope handleScope(isolate);
+
+ v8::CpuProfiler* profiler = env->GetIsolate()->GetCpuProfiler();
+
+ CHECK_EQ(0, profiler->GetProfileCount());
+ v8::Handle<v8::String> outer = v8::String::NewFromUtf8(isolate, "outer");
+ profiler->StartCpuProfiling(outer);
+ CHECK_EQ(0, profiler->GetProfileCount());
+
+ v8::Handle<v8::String> inner = v8::String::NewFromUtf8(isolate, "inner");
+ profiler->StartCpuProfiling(inner);
+ CHECK_EQ(0, profiler->GetProfileCount());
+
+ const v8::CpuProfile* inner_profile = profiler->StopCpuProfiling(inner);
+ CHECK(inner_profile);
+ CHECK_EQ(1, profiler->GetProfileCount());
+ const_cast<v8::CpuProfile*>(inner_profile)->Delete();
+ inner_profile = NULL;
+ CHECK_EQ(0, profiler->GetProfileCount());
+
+ const v8::CpuProfile* outer_profile = profiler->StopCpuProfiling(outer);
+ CHECK(outer_profile);
+ CHECK_EQ(1, profiler->GetProfileCount());
+ const_cast<v8::CpuProfile*>(outer_profile)->Delete();
+ outer_profile = NULL;
+ CHECK_EQ(0, profiler->GetProfileCount());
+}
« no previous file with comments | « src/cpu-profiler.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698