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

Unified Diff: Source/core/inspector/InspectorProfilerAgent.cpp

Issue 116273003: Stop recording CPU profiles when Profiler agent is disabled (Closed) Base URL: svn://svn.chromium.org/blink/trunk
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 | « LayoutTests/inspector-protocol/cpu-profiler/record-cpu-profile.html ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/inspector/InspectorProfilerAgent.cpp
diff --git a/Source/core/inspector/InspectorProfilerAgent.cpp b/Source/core/inspector/InspectorProfilerAgent.cpp
index f7083a9cbf51ce659fe6310363bdc397348f60f5..e63c98da79c8a9c2de13123cfa2573b0694b424c 100644
--- a/Source/core/inspector/InspectorProfilerAgent.cpp
+++ b/Source/core/inspector/InspectorProfilerAgent.cpp
@@ -157,6 +157,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);
@@ -185,10 +190,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()
@@ -208,8 +212,8 @@ void InspectorProfilerAgent::start(ErrorString* error)
if (m_recordingCPUProfile)
return;
if (!enabled()) {
- ErrorString error;
- enable(&error);
+ *error = "Profiler is not enabled";
+ return;
}
m_recordingCPUProfile = true;
if (m_overlay)
« no previous file with comments | « LayoutTests/inspector-protocol/cpu-profiler/record-cpu-profile.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698