Do not stop profiling if all finished profiles were deleted
Deleting finished profiles shouldn't interrupt profile recording. BUG=chromium:327298 LOG=N R=alph@chromium.org, jkummerow@chromium.org Review URL: https://codereview.chromium.org/103893003 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@18302 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
parent
d5787278bc
commit
19f29c380e
@ -132,10 +132,6 @@ class V8_EXPORT CpuProfile {
|
||||
/**
|
||||
* Deletes the profile and removes it from CpuProfiler's list.
|
||||
* All pointers to nodes previously returned become invalid.
|
||||
* Profiles with the same uid but obtained using different
|
||||
* security token are not deleted, but become inaccessible
|
||||
* using FindProfile method. It is embedder's responsibility
|
||||
* to call Delete on these profiles.
|
||||
*/
|
||||
void Delete();
|
||||
};
|
||||
|
@ -7202,10 +7202,6 @@ void CpuProfile::Delete() {
|
||||
i::CpuProfiler* profiler = isolate->cpu_profiler();
|
||||
ASSERT(profiler != NULL);
|
||||
profiler->DeleteProfile(reinterpret_cast<i::CpuProfile*>(this));
|
||||
if (profiler->GetProfilesCount() == 0) {
|
||||
// If this was the last profile, clean up all accessory data as well.
|
||||
profiler->DeleteAllProfiles();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -176,6 +176,10 @@ void CpuProfiler::DeleteAllProfiles() {
|
||||
void CpuProfiler::DeleteProfile(CpuProfile* profile) {
|
||||
profiles_->RemoveProfile(profile);
|
||||
delete profile;
|
||||
if (profiles_->profiles()->is_empty() && !is_profiling_) {
|
||||
// If this was the last profile, clean up all accessory data as well.
|
||||
ResetProfiles();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -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());
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user