Chromium Code Reviews| 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..5f6e91647b756734bf813b8bd2e73ee875a95147 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> innter = v8::String::NewFromUtf8(isolate, "inner"); |
|
alph
2013/12/11 14:21:36
typo
Jakob Kummerow
2013/12/11 14:22:58
nit: I think you mean s/innter/inner/
yurys
2013/12/11 14:34:34
Done.
yurys
2013/12/11 14:34:34
Done.
|
| + profiler->StartCpuProfiling(innter); |
| + CHECK_EQ(0, profiler->GetProfileCount()); |
| + |
| + const v8::CpuProfile* inner_profile = profiler->StopCpuProfiling(innter); |
| + 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()); |
| +} |