Index: Source/core/inspector/InspectorProfilerAgent.cpp |
diff --git a/Source/core/inspector/InspectorProfilerAgent.cpp b/Source/core/inspector/InspectorProfilerAgent.cpp |
index 9908fd9d536e353e537e5fb69ac80165b11ee247..d3580834e8d783124687e093e6ccae98cc6d1cfc 100644 |
--- a/Source/core/inspector/InspectorProfilerAgent.cpp |
+++ b/Source/core/inspector/InspectorProfilerAgent.cpp |
@@ -160,6 +160,11 @@ void InspectorProfilerAgent::doEnable() |
void InspectorProfilerAgent::disable(ErrorString*) |
{ |
+ for (Vector<ProfileDescriptor>::const_reverse_iterator it = m_startedProfiles.rbegin(); it != m_startedProfiles.rend(); ++it) |
+ m_keepAliveProfile = ScriptProfiler::stop(it->m_id); |
+ m_startedProfiles.clear(); |
+ stop(0, 0); |
+ |
m_keepAliveProfile.clear(); |
m_instrumentingAgents->setInspectorProfilerAgent(0); |
m_state->setBoolean(ProfilerAgentState::profilerEnabled, false); |
@@ -188,10 +193,9 @@ void InspectorProfilerAgent::setFrontend(InspectorFrontend* frontend) |
void InspectorProfilerAgent::clearFrontend() |
{ |
m_frontend = 0; |
- stop(0, 0); |
- m_injectedScriptManager->injectedScriptHost()->clearInspectedObjects(); |
ErrorString error; |
disable(&error); |
+ m_injectedScriptManager->injectedScriptHost()->clearInspectedObjects(); |
} |
void InspectorProfilerAgent::restore() |
@@ -211,8 +215,8 @@ void InspectorProfilerAgent::start(ErrorString* error) |
if (m_recordingCPUProfile) |
return; |
if (!enabled()) { |
- ErrorString error; |
- enable(&error); |
+ *error = "Profiler is no enabled"; |
+ return; |
} |
m_recordingCPUProfile = true; |
if (m_overlay) |