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
{
}
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)
{
agent->appended(m_instrumentingAgents, m_inspectorState->createAgentState(agent->name()));
......
......@@ -56,9 +56,6 @@ public:
virtual void discardAgent() { }
virtual void didCommitLoadForMainFrame() { }
virtual void flushPendingFrontendMessages() { }
virtual void profilerStarted() { }
virtual void profilerStopped() { }
String name() { return m_name; }
void appended(InstrumentingAgents*, InspectorState*);
......@@ -82,8 +79,6 @@ public:
void registerInDispatcher(InspectorBackendDispatcher*);
void discardAgents();
void flushPendingFrontendMessages();
void profilerStarted();
void profilerStopped();
private:
InstrumentingAgents* m_instrumentingAgents;
......
......@@ -105,7 +105,7 @@ InspectorController::InspectorController(Page* page, InspectorClient* inspectorC
m_agents.append(tracingAgentPtr.release());
OwnPtr<InspectorTimelineAgent> timelineAgentPtr(InspectorTimelineAgent::create(m_pageAgent, m_layerTreeAgent,
overlay, InspectorTimelineAgent::PageInspector, inspectorClient, &m_agents));
overlay, InspectorTimelineAgent::PageInspector, inspectorClient));
m_timelineAgent = timelineAgentPtr.get();
m_agents.append(timelineAgentPtr.release());
......@@ -169,7 +169,7 @@ void InspectorController::initializeDeferredAgents()
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));
......
......@@ -83,12 +83,12 @@ public:
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")
, m_injectedScriptManager(injectedScriptManager)
, m_frontend(0)
......@@ -96,7 +96,6 @@ InspectorProfilerAgent::InspectorProfilerAgent(InjectedScriptManager* injectedSc
, m_profileNameIdleTimeMap(ScriptProfiler::currentProfileNameIdleTimeMap())
, m_idleStartTime(0.0)
, m_overlay(overlay)
, m_registry(registry)
{
}
......@@ -218,7 +217,6 @@ void InspectorProfilerAgent::start(ErrorString* error)
if (m_overlay)
m_overlay->startedRecordingProfile();
m_frontendInitiatedProfileId = nextProfileId();
m_registry->profilerStarted();
ScriptProfiler::start(m_frontendInitiatedProfileId);
m_state->setBoolean(ProfilerAgentState::userInitiatedProfiling, true);
}
......@@ -239,7 +237,6 @@ void InspectorProfilerAgent::stop(ErrorString* errorString, RefPtr<TypeBuilder::
if (m_overlay)
m_overlay->finishedRecordingProfile();
RefPtr<ScriptProfile> scriptProfile = ScriptProfiler::stop(m_frontendInitiatedProfileId);
m_registry->profilerStopped();
m_frontendInitiatedProfileId = String();
if (scriptProfile && profile)
*profile = createCPUProfile(*scriptProfile);
......
......@@ -54,7 +54,7 @@ typedef String ErrorString;
class InspectorProfilerAgent FINAL : public InspectorBaseAgent<InspectorProfilerAgent>, public InspectorBackendDispatcher::ProfilerCommandHandler {
WTF_MAKE_NONCOPYABLE(InspectorProfilerAgent); WTF_MAKE_FAST_ALLOCATED;
public:
static PassOwnPtr<InspectorProfilerAgent> create(InjectedScriptManager*, InspectorOverlay*, InspectorAgentRegistry*);
static PassOwnPtr<InspectorProfilerAgent> create(InjectedScriptManager*, InspectorOverlay*);
virtual ~InspectorProfilerAgent();
void consoleProfile(const String& title, ScriptState*);
......@@ -76,7 +76,7 @@ public:
void didLeaveNestedRunLoop();
private:
InspectorProfilerAgent(InjectedScriptManager*, InspectorOverlay*, InspectorAgentRegistry*);
InspectorProfilerAgent(InjectedScriptManager*, InspectorOverlay*);
bool enabled();
void doEnable();
void stop(ErrorString*, RefPtr<TypeBuilder::Profiler::CPUProfile>*);
......@@ -93,7 +93,6 @@ private:
ProfileNameIdleTimeMap* m_profileNameIdleTimeMap;
double m_idleStartTime;
InspectorOverlay* m_overlay;
InspectorAgentRegistry* m_registry;
void idleStarted();
void idleFinished();
......
......@@ -346,7 +346,6 @@ void InspectorTimelineAgent::innerStart()
{
if (m_overlay)
m_overlay->startedRecordingProfile();
m_registry->profilerStarted();
m_state->setBoolean(TimelineAgentState::started, true);
m_instrumentingAgents->setInspectorTimelineAgent(this);
ScriptGCEvent::addEventListener(this);
......@@ -403,7 +402,6 @@ void InspectorTimelineAgent::innerStop(bool fromConsole)
m_client->stopGPUEventsRecording();
}
m_instrumentingAgents->setInspectorTimelineAgent(0);
m_registry->profilerStopped();
ScriptGCEvent::removeEventListener(this);
clearRecordStack();
......@@ -1149,7 +1147,7 @@ void InspectorTimelineAgent::unwindRecordStack()
}
InspectorTimelineAgent::InspectorTimelineAgent(InspectorPageAgent* pageAgent, InspectorLayerTreeAgent* layerTreeAgent,
InspectorOverlay* overlay, InspectorType type, InspectorClient* client, InspectorAgentRegistry* registry)
InspectorOverlay* overlay, InspectorType type, InspectorClient* client)
: InspectorBaseAgent<InspectorTimelineAgent>("Timeline")
, m_pageAgent(pageAgent)
, m_layerTreeAgent(layerTreeAgent)
......@@ -1165,7 +1163,6 @@ InspectorTimelineAgent::InspectorTimelineAgent(InspectorPageAgent* pageAgent, In
, m_paintSetupStart(0)
, m_mayEmitFirstPaint(false)
, m_lastProgressTimestamp(0)
, m_registry(registry)
{
}
......
......@@ -115,9 +115,9 @@ public:
};
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();
......@@ -231,7 +231,7 @@ private:
friend class TimelineRecordStack;
InspectorTimelineAgent(InspectorPageAgent*, InspectorLayerTreeAgent*, InspectorOverlay*, InspectorType, InspectorClient*, InspectorAgentRegistry*);
InspectorTimelineAgent(InspectorPageAgent*, InspectorLayerTreeAgent*, InspectorOverlay*, InspectorType, InspectorClient*);
// Trace event handlers
void onBeginImplSideFrame(const TraceEventDispatcher::TraceEvent&);
......@@ -318,7 +318,6 @@ private:
bool m_mayEmitFirstPaint;
HashSet<String> m_liveEvents;
double m_lastProgressTimestamp;
InspectorAgentRegistry* m_registry;
};
} // namespace WebCore
......
......@@ -99,10 +99,10 @@ WorkerInspectorController::WorkerInspectorController(WorkerGlobalScope* workerGl
{
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(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(WorkerConsoleAgent::create(timelineAgent.get(), m_injectedScriptManager.get()));
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