Revision: 18302
Author: [email protected]
Date: Wed Dec 11 14:39:18 2013 UTC
Log: Do not stop profiling if all finished profiles were deleted
Deleting finished profiles shouldn't interrupt profile recording.
BUG=chromium:327298
LOG=N
[email protected], [email protected]
Review URL: https://codereview.chromium.org/103893003
http://code.google.com/p/v8/source/detail?r=18302
Modified:
/branches/bleeding_edge/include/v8-profiler.h
/branches/bleeding_edge/src/api.cc
/branches/bleeding_edge/src/cpu-profiler.cc
/branches/bleeding_edge/test/cctest/test-cpu-profiler.cc
=======================================
--- /branches/bleeding_edge/include/v8-profiler.h Mon Dec 2 14:27:24 2013
UTC
+++ /branches/bleeding_edge/include/v8-profiler.h Wed Dec 11 14:39:18 2013
UTC
@@ -132,10 +132,6 @@
/**
* 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();
};
=======================================
--- /branches/bleeding_edge/src/api.cc Wed Dec 11 13:51:48 2013 UTC
+++ /branches/bleeding_edge/src/api.cc Wed Dec 11 14:39:18 2013 UTC
@@ -7202,10 +7202,6 @@
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();
- }
}
=======================================
--- /branches/bleeding_edge/src/cpu-profiler.cc Thu Oct 10 13:15:47 2013 UTC
+++ /branches/bleeding_edge/src/cpu-profiler.cc Wed Dec 11 14:39:18 2013 UTC
@@ -176,6 +176,10 @@
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();
+ }
}
=======================================
--- /branches/bleeding_edge/test/cctest/test-cpu-profiler.cc Mon Dec 9
07:41:20 2013 UTC
+++ /branches/bleeding_edge/test/cctest/test-cpu-profiler.cc Wed Dec 11
14:39:18 2013 UTC
@@ -1533,3 +1533,37 @@
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());
+}
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.