Commit b0a73998 authored by loislo@chromium.org's avatar loislo@chromium.org

Revert of DevTools: notify backend agents about profiler started/stopped...

Revert of DevTools: notify backend agents about profiler started/stopped events (https://codereview.chromium.org/321173002/)

Reason for revert:
We came to the conclusion that this patch
moves us in a wrong direction. 
With this approach we would have to manage 4 pairs of states. Disabled+stopped, disabled+started, enabled+stopped, etc up to enabled+started :)
in the each agent. So we would like to try the simplest one, just use enable/disable states and fix the problems related to them.

Original issue's description:
> DevTools: notify backend agents about profiler started/stopped events
> 
> This patch provides a way to notify backend agents about starting a profiler.
> Each agent should switch to a mode which doesn't affect the performance.
> As example DebuggerAgent needs to disable breakpoints, allow v8 optimizations, etc.
> DOM and Network agents may simple disable themselves.
> 
> BUG=381115
> R=pfeldman@chromium.org
> 
> Committed: https://src.chromium.org/viewvc/blink?view=rev&revision=175946

TBR=pfeldman@chromium.org,vsevik@chromium.org
NOTREECHECKS=true
NOTRY=true
BUG=381115

Review URL: https://codereview.chromium.org/327203002

git-svn-id: svn://svn.chromium.org/blink/trunk@175954 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent a6b02c7d
...@@ -58,18 +58,6 @@ InspectorAgentRegistry::InspectorAgentRegistry(InstrumentingAgents* instrumentin ...@@ -58,18 +58,6 @@ InspectorAgentRegistry::InspectorAgentRegistry(InstrumentingAgents* instrumentin
{ {
} }
void InspectorAgentRegistry::profilerStarted()
{
for (size_t i = 0; i < m_agents.size(); i++)
m_agents[i]->profilerStarted();
}
void InspectorAgentRegistry::profilerStopped()
{
for (size_t i = 0; i < m_agents.size(); i++)
m_agents[i]->profilerStopped();
}
void InspectorAgentRegistry::append(PassOwnPtr<InspectorAgent> agent) void InspectorAgentRegistry::append(PassOwnPtr<InspectorAgent> agent)
{ {
agent->appended(m_instrumentingAgents, m_inspectorState->createAgentState(agent->name())); agent->appended(m_instrumentingAgents, m_inspectorState->createAgentState(agent->name()));
......
...@@ -56,9 +56,6 @@ public: ...@@ -56,9 +56,6 @@ public:
virtual void discardAgent() { } virtual void discardAgent() { }
virtual void didCommitLoadForMainFrame() { } virtual void didCommitLoadForMainFrame() { }
virtual void flushPendingFrontendMessages() { } virtual void flushPendingFrontendMessages() { }
virtual void profilerStarted() { }
virtual void profilerStopped() { }
String name() { return m_name; } String name() { return m_name; }
void appended(InstrumentingAgents*, InspectorState*); void appended(InstrumentingAgents*, InspectorState*);
...@@ -82,8 +79,6 @@ public: ...@@ -82,8 +79,6 @@ public:
void registerInDispatcher(InspectorBackendDispatcher*); void registerInDispatcher(InspectorBackendDispatcher*);
void discardAgents(); void discardAgents();
void flushPendingFrontendMessages(); void flushPendingFrontendMessages();
void profilerStarted();
void profilerStopped();
private: private:
InstrumentingAgents* m_instrumentingAgents; InstrumentingAgents* m_instrumentingAgents;
......
...@@ -105,7 +105,7 @@ InspectorController::InspectorController(Page* page, InspectorClient* inspectorC ...@@ -105,7 +105,7 @@ InspectorController::InspectorController(Page* page, InspectorClient* inspectorC
m_agents.append(tracingAgentPtr.release()); m_agents.append(tracingAgentPtr.release());
OwnPtr<InspectorTimelineAgent> timelineAgentPtr(InspectorTimelineAgent::create(m_pageAgent, m_layerTreeAgent, OwnPtr<InspectorTimelineAgent> timelineAgentPtr(InspectorTimelineAgent::create(m_pageAgent, m_layerTreeAgent,
overlay, InspectorTimelineAgent::PageInspector, inspectorClient, &m_agents)); overlay, InspectorTimelineAgent::PageInspector, inspectorClient));
m_timelineAgent = timelineAgentPtr.get(); m_timelineAgent = timelineAgentPtr.get();
m_agents.append(timelineAgentPtr.release()); m_agents.append(timelineAgentPtr.release());
...@@ -169,7 +169,7 @@ void InspectorController::initializeDeferredAgents() ...@@ -169,7 +169,7 @@ void InspectorController::initializeDeferredAgents()
m_agents.append(InspectorDOMDebuggerAgent::create(m_domAgent, debuggerAgent)); m_agents.append(InspectorDOMDebuggerAgent::create(m_domAgent, debuggerAgent));
m_agents.append(InspectorProfilerAgent::create(injectedScriptManager, overlay, &m_agents)); m_agents.append(InspectorProfilerAgent::create(injectedScriptManager, overlay));
m_agents.append(InspectorHeapProfilerAgent::create(injectedScriptManager)); m_agents.append(InspectorHeapProfilerAgent::create(injectedScriptManager));
......
...@@ -83,12 +83,12 @@ public: ...@@ -83,12 +83,12 @@ public:
String m_title; String m_title;
}; };
PassOwnPtr<InspectorProfilerAgent> InspectorProfilerAgent::create(InjectedScriptManager* injectedScriptManager, InspectorOverlay* overlay, InspectorAgentRegistry* registry) PassOwnPtr<InspectorProfilerAgent> InspectorProfilerAgent::create(InjectedScriptManager* injectedScriptManager, InspectorOverlay* overlay)
{ {
return adoptPtr(new InspectorProfilerAgent(injectedScriptManager, overlay, registry)); return adoptPtr(new InspectorProfilerAgent(injectedScriptManager, overlay));
} }
InspectorProfilerAgent::InspectorProfilerAgent(InjectedScriptManager* injectedScriptManager, InspectorOverlay* overlay, InspectorAgentRegistry* registry) InspectorProfilerAgent::InspectorProfilerAgent(InjectedScriptManager* injectedScriptManager, InspectorOverlay* overlay)
: InspectorBaseAgent<InspectorProfilerAgent>("Profiler") : InspectorBaseAgent<InspectorProfilerAgent>("Profiler")
, m_injectedScriptManager(injectedScriptManager) , m_injectedScriptManager(injectedScriptManager)
, m_frontend(0) , m_frontend(0)
...@@ -96,7 +96,6 @@ InspectorProfilerAgent::InspectorProfilerAgent(InjectedScriptManager* injectedSc ...@@ -96,7 +96,6 @@ InspectorProfilerAgent::InspectorProfilerAgent(InjectedScriptManager* injectedSc
, m_profileNameIdleTimeMap(ScriptProfiler::currentProfileNameIdleTimeMap()) , m_profileNameIdleTimeMap(ScriptProfiler::currentProfileNameIdleTimeMap())
, m_idleStartTime(0.0) , m_idleStartTime(0.0)
, m_overlay(overlay) , m_overlay(overlay)
, m_registry(registry)
{ {
} }
...@@ -218,7 +217,6 @@ void InspectorProfilerAgent::start(ErrorString* error) ...@@ -218,7 +217,6 @@ void InspectorProfilerAgent::start(ErrorString* error)
if (m_overlay) if (m_overlay)
m_overlay->startedRecordingProfile(); m_overlay->startedRecordingProfile();
m_frontendInitiatedProfileId = nextProfileId(); m_frontendInitiatedProfileId = nextProfileId();
m_registry->profilerStarted();
ScriptProfiler::start(m_frontendInitiatedProfileId); ScriptProfiler::start(m_frontendInitiatedProfileId);
m_state->setBoolean(ProfilerAgentState::userInitiatedProfiling, true); m_state->setBoolean(ProfilerAgentState::userInitiatedProfiling, true);
} }
...@@ -239,7 +237,6 @@ void InspectorProfilerAgent::stop(ErrorString* errorString, RefPtr<TypeBuilder:: ...@@ -239,7 +237,6 @@ void InspectorProfilerAgent::stop(ErrorString* errorString, RefPtr<TypeBuilder::
if (m_overlay) if (m_overlay)
m_overlay->finishedRecordingProfile(); m_overlay->finishedRecordingProfile();
RefPtr<ScriptProfile> scriptProfile = ScriptProfiler::stop(m_frontendInitiatedProfileId); RefPtr<ScriptProfile> scriptProfile = ScriptProfiler::stop(m_frontendInitiatedProfileId);
m_registry->profilerStopped();
m_frontendInitiatedProfileId = String(); m_frontendInitiatedProfileId = String();
if (scriptProfile && profile) if (scriptProfile && profile)
*profile = createCPUProfile(*scriptProfile); *profile = createCPUProfile(*scriptProfile);
......
...@@ -54,7 +54,7 @@ typedef String ErrorString; ...@@ -54,7 +54,7 @@ typedef String ErrorString;
class InspectorProfilerAgent FINAL : public InspectorBaseAgent<InspectorProfilerAgent>, public InspectorBackendDispatcher::ProfilerCommandHandler { class InspectorProfilerAgent FINAL : public InspectorBaseAgent<InspectorProfilerAgent>, public InspectorBackendDispatcher::ProfilerCommandHandler {
WTF_MAKE_NONCOPYABLE(InspectorProfilerAgent); WTF_MAKE_FAST_ALLOCATED; WTF_MAKE_NONCOPYABLE(InspectorProfilerAgent); WTF_MAKE_FAST_ALLOCATED;
public: public:
static PassOwnPtr<InspectorProfilerAgent> create(InjectedScriptManager*, InspectorOverlay*, InspectorAgentRegistry*); static PassOwnPtr<InspectorProfilerAgent> create(InjectedScriptManager*, InspectorOverlay*);
virtual ~InspectorProfilerAgent(); virtual ~InspectorProfilerAgent();
void consoleProfile(const String& title, ScriptState*); void consoleProfile(const String& title, ScriptState*);
...@@ -76,7 +76,7 @@ public: ...@@ -76,7 +76,7 @@ public:
void didLeaveNestedRunLoop(); void didLeaveNestedRunLoop();
private: private:
InspectorProfilerAgent(InjectedScriptManager*, InspectorOverlay*, InspectorAgentRegistry*); InspectorProfilerAgent(InjectedScriptManager*, InspectorOverlay*);
bool enabled(); bool enabled();
void doEnable(); void doEnable();
void stop(ErrorString*, RefPtr<TypeBuilder::Profiler::CPUProfile>*); void stop(ErrorString*, RefPtr<TypeBuilder::Profiler::CPUProfile>*);
...@@ -93,7 +93,6 @@ private: ...@@ -93,7 +93,6 @@ private:
ProfileNameIdleTimeMap* m_profileNameIdleTimeMap; ProfileNameIdleTimeMap* m_profileNameIdleTimeMap;
double m_idleStartTime; double m_idleStartTime;
InspectorOverlay* m_overlay; InspectorOverlay* m_overlay;
InspectorAgentRegistry* m_registry;
void idleStarted(); void idleStarted();
void idleFinished(); void idleFinished();
......
...@@ -346,7 +346,6 @@ void InspectorTimelineAgent::innerStart() ...@@ -346,7 +346,6 @@ void InspectorTimelineAgent::innerStart()
{ {
if (m_overlay) if (m_overlay)
m_overlay->startedRecordingProfile(); m_overlay->startedRecordingProfile();
m_registry->profilerStarted();
m_state->setBoolean(TimelineAgentState::started, true); m_state->setBoolean(TimelineAgentState::started, true);
m_instrumentingAgents->setInspectorTimelineAgent(this); m_instrumentingAgents->setInspectorTimelineAgent(this);
ScriptGCEvent::addEventListener(this); ScriptGCEvent::addEventListener(this);
...@@ -403,7 +402,6 @@ void InspectorTimelineAgent::innerStop(bool fromConsole) ...@@ -403,7 +402,6 @@ void InspectorTimelineAgent::innerStop(bool fromConsole)
m_client->stopGPUEventsRecording(); m_client->stopGPUEventsRecording();
} }
m_instrumentingAgents->setInspectorTimelineAgent(0); m_instrumentingAgents->setInspectorTimelineAgent(0);
m_registry->profilerStopped();
ScriptGCEvent::removeEventListener(this); ScriptGCEvent::removeEventListener(this);
clearRecordStack(); clearRecordStack();
...@@ -1149,7 +1147,7 @@ void InspectorTimelineAgent::unwindRecordStack() ...@@ -1149,7 +1147,7 @@ void InspectorTimelineAgent::unwindRecordStack()
} }
InspectorTimelineAgent::InspectorTimelineAgent(InspectorPageAgent* pageAgent, InspectorLayerTreeAgent* layerTreeAgent, InspectorTimelineAgent::InspectorTimelineAgent(InspectorPageAgent* pageAgent, InspectorLayerTreeAgent* layerTreeAgent,
InspectorOverlay* overlay, InspectorType type, InspectorClient* client, InspectorAgentRegistry* registry) InspectorOverlay* overlay, InspectorType type, InspectorClient* client)
: InspectorBaseAgent<InspectorTimelineAgent>("Timeline") : InspectorBaseAgent<InspectorTimelineAgent>("Timeline")
, m_pageAgent(pageAgent) , m_pageAgent(pageAgent)
, m_layerTreeAgent(layerTreeAgent) , m_layerTreeAgent(layerTreeAgent)
...@@ -1165,7 +1163,6 @@ InspectorTimelineAgent::InspectorTimelineAgent(InspectorPageAgent* pageAgent, In ...@@ -1165,7 +1163,6 @@ InspectorTimelineAgent::InspectorTimelineAgent(InspectorPageAgent* pageAgent, In
, m_paintSetupStart(0) , m_paintSetupStart(0)
, m_mayEmitFirstPaint(false) , m_mayEmitFirstPaint(false)
, m_lastProgressTimestamp(0) , m_lastProgressTimestamp(0)
, m_registry(registry)
{ {
} }
......
...@@ -115,9 +115,9 @@ public: ...@@ -115,9 +115,9 @@ public:
}; };
static PassOwnPtr<InspectorTimelineAgent> create(InspectorPageAgent* pageAgent, InspectorLayerTreeAgent* layerTreeAgent, static PassOwnPtr<InspectorTimelineAgent> create(InspectorPageAgent* pageAgent, InspectorLayerTreeAgent* layerTreeAgent,
InspectorOverlay* overlay, InspectorType type, InspectorClient* client, InspectorAgentRegistry* registry) InspectorOverlay* overlay, InspectorType type, InspectorClient* client)
{ {
return adoptPtr(new InspectorTimelineAgent(pageAgent, layerTreeAgent, overlay, type, client, registry)); return adoptPtr(new InspectorTimelineAgent(pageAgent, layerTreeAgent, overlay, type, client));
} }
virtual ~InspectorTimelineAgent(); virtual ~InspectorTimelineAgent();
...@@ -231,7 +231,7 @@ private: ...@@ -231,7 +231,7 @@ private:
friend class TimelineRecordStack; friend class TimelineRecordStack;
InspectorTimelineAgent(InspectorPageAgent*, InspectorLayerTreeAgent*, InspectorOverlay*, InspectorType, InspectorClient*, InspectorAgentRegistry*); InspectorTimelineAgent(InspectorPageAgent*, InspectorLayerTreeAgent*, InspectorOverlay*, InspectorType, InspectorClient*);
// Trace event handlers // Trace event handlers
void onBeginImplSideFrame(const TraceEventDispatcher::TraceEvent&); void onBeginImplSideFrame(const TraceEventDispatcher::TraceEvent&);
...@@ -318,7 +318,6 @@ private: ...@@ -318,7 +318,6 @@ private:
bool m_mayEmitFirstPaint; bool m_mayEmitFirstPaint;
HashSet<String> m_liveEvents; HashSet<String> m_liveEvents;
double m_lastProgressTimestamp; double m_lastProgressTimestamp;
InspectorAgentRegistry* m_registry;
}; };
} // namespace WebCore } // namespace WebCore
......
...@@ -99,10 +99,10 @@ WorkerInspectorController::WorkerInspectorController(WorkerGlobalScope* workerGl ...@@ -99,10 +99,10 @@ WorkerInspectorController::WorkerInspectorController(WorkerGlobalScope* workerGl
{ {
m_agents.append(WorkerRuntimeAgent::create(m_injectedScriptManager.get(), m_debugServer.get(), workerGlobalScope)); m_agents.append(WorkerRuntimeAgent::create(m_injectedScriptManager.get(), m_debugServer.get(), workerGlobalScope));
OwnPtr<InspectorTimelineAgent> timelineAgent = InspectorTimelineAgent::create(0, 0, 0, InspectorTimelineAgent::WorkerInspector, 0, &m_agents); OwnPtr<InspectorTimelineAgent> timelineAgent = InspectorTimelineAgent::create(0, 0, 0, InspectorTimelineAgent::WorkerInspector, 0);
m_agents.append(WorkerDebuggerAgent::create(m_debugServer.get(), workerGlobalScope, m_injectedScriptManager.get())); m_agents.append(WorkerDebuggerAgent::create(m_debugServer.get(), workerGlobalScope, m_injectedScriptManager.get()));
m_agents.append(InspectorProfilerAgent::create(m_injectedScriptManager.get(), 0, &m_agents)); m_agents.append(InspectorProfilerAgent::create(m_injectedScriptManager.get(), 0));
m_agents.append(InspectorHeapProfilerAgent::create(m_injectedScriptManager.get())); m_agents.append(InspectorHeapProfilerAgent::create(m_injectedScriptManager.get()));
m_agents.append(WorkerConsoleAgent::create(timelineAgent.get(), m_injectedScriptManager.get())); m_agents.append(WorkerConsoleAgent::create(timelineAgent.get(), m_injectedScriptManager.get()));
m_agents.append(timelineAgent.release()); m_agents.append(timelineAgent.release());
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment