Web Inspector: do not send profile headers to the front-end until explicitly requested.
authorpfeldman@chromium.org <pfeldman@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 24 Aug 2012 13:30:11 +0000 (13:30 +0000)
committerpfeldman@chromium.org <pfeldman@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 24 Aug 2012 13:30:11 +0000 (13:30 +0000)
https://bugs.webkit.org/show_bug.cgi?id=94928

Reviewed by Vsevolod Vlasov.

Simple flag is added.

* inspector/InspectorProfilerAgent.cpp:
(WebCore::InspectorProfilerAgent::InspectorProfilerAgent):
(WebCore::InspectorProfilerAgent::addProfile):
(WebCore::InspectorProfilerAgent::disable):
(WebCore::InspectorProfilerAgent::getProfileHeaders):
(WebCore):
(WebCore::InspectorProfilerAgent::resetFrontendProfiles):
* inspector/InspectorProfilerAgent.h:
(InspectorProfilerAgent):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@126580 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/inspector/InspectorProfilerAgent.cpp
Source/WebCore/inspector/InspectorProfilerAgent.h

index 8dfd0cf..1ef4ad1 100644 (file)
@@ -1,5 +1,24 @@
 2012-08-24  Pavel Feldman  <pfeldman@chromium.org>
 
+        Web Inspector: do not send profile headers to the front-end until explicitly requested.
+        https://bugs.webkit.org/show_bug.cgi?id=94928
+
+        Reviewed by Vsevolod Vlasov.
+
+        Simple flag is added.
+
+        * inspector/InspectorProfilerAgent.cpp:
+        (WebCore::InspectorProfilerAgent::InspectorProfilerAgent):
+        (WebCore::InspectorProfilerAgent::addProfile):
+        (WebCore::InspectorProfilerAgent::disable):
+        (WebCore::InspectorProfilerAgent::getProfileHeaders):
+        (WebCore):
+        (WebCore::InspectorProfilerAgent::resetFrontendProfiles):
+        * inspector/InspectorProfilerAgent.h:
+        (InspectorProfilerAgent):
+
+2012-08-24  Pavel Feldman  <pfeldman@chromium.org>
+
         Web Inspector: make ui component compile
         https://bugs.webkit.org/show_bug.cgi?id=94827
 
index 997dd4a..42cde85 100644 (file)
@@ -123,6 +123,7 @@ InspectorProfilerAgent::InspectorProfilerAgent(InstrumentingAgents* instrumentin
     , m_frontend(0)
     , m_enabled(false)
     , m_recordingUserInitiatedProfile(false)
+    , m_headersRequested(false)
     , m_currentUserInitiatedProfileNumber(-1)
     , m_nextUserInitiatedProfileNumber(1)
     , m_nextUserInitiatedHeapSnapshotNumber(1)
@@ -139,7 +140,7 @@ void InspectorProfilerAgent::addProfile(PassRefPtr<ScriptProfile> prpProfile, un
 {
     RefPtr<ScriptProfile> profile = prpProfile;
     m_profiles.add(profile->uid(), profile);
-    if (m_frontend)
+    if (m_frontend && m_headersRequested)
         m_frontend->addProfileHeader(createProfileHeader(*profile));
     addProfileFinishedMessageToConsole(profile, lineNumber, sourceURL);
 }
@@ -220,6 +221,7 @@ void InspectorProfilerAgent::disable()
     if (!m_enabled)
         return;
     m_enabled = false;
+    m_headersRequested = false;
     PageScriptDebugServer::shared().recompileAllJSFunctionsSoon();
 }
 
@@ -242,6 +244,7 @@ String InspectorProfilerAgent::getCurrentUserInitiatedProfileName(bool increment
 
 void InspectorProfilerAgent::getProfileHeaders(ErrorString*, RefPtr<TypeBuilder::Array<TypeBuilder::Profiler::ProfileHeader> >& headers)
 {
+    m_headersRequested = true;
     headers = TypeBuilder::Array<TypeBuilder::Profiler::ProfileHeader>::create();
 
     ProfilesMap::iterator profilesEnd = m_profiles.end();
@@ -321,7 +324,7 @@ void InspectorProfilerAgent::resetState()
 
 void InspectorProfilerAgent::resetFrontendProfiles()
 {
-    if (m_frontend && enabled()
+    if (m_headersRequested && m_frontend
         && m_profiles.begin() == m_profiles.end()
         && m_snapshots.begin() == m_snapshots.end())
         m_frontend->resetProfiles();
index 5082666..329909f 100644 (file)
@@ -119,6 +119,7 @@ private:
     InspectorFrontend::Profiler* m_frontend;
     bool m_enabled;
     bool m_recordingUserInitiatedProfile;
+    bool m_headersRequested;
     int m_currentUserInitiatedProfileNumber;
     unsigned m_nextUserInitiatedProfileNumber;
     unsigned m_nextUserInitiatedHeapSnapshotNumber;