| Index: third_party/WebKit/Source/core/inspector/InspectorTracingAgent.cpp
|
| diff --git a/third_party/WebKit/Source/core/inspector/InspectorTracingAgent.cpp b/third_party/WebKit/Source/core/inspector/InspectorTracingAgent.cpp
|
| index a9c0c98914697c39118142c531fbea0ae7e1ab79..d3123c7754238eb1333b4790a8cbae68ad1a4f4b 100644
|
| --- a/third_party/WebKit/Source/core/inspector/InspectorTracingAgent.cpp
|
| +++ b/third_party/WebKit/Source/core/inspector/InspectorTracingAgent.cpp
|
| @@ -42,6 +42,20 @@ void InspectorTracingAgent::restore()
|
| {
|
| emitMetadataEvents();
|
| }
|
| +
|
| +void InspectorTracingAgent::frameStartedLoading(LocalFrame* frame)
|
| +{
|
| + if (frame != m_inspectedFrames->root() || frame->loader().loadType() != FrameLoadTypeReload)
|
| + return;
|
| + m_client->showReloadingBlanket();
|
| +}
|
| +
|
| +void InspectorTracingAgent::frameStoppedLoading(LocalFrame* frame)
|
| +{
|
| + if (frame != m_inspectedFrames->root())
|
| + m_client->hideReloadingBlanket();
|
| +}
|
| +
|
| void InspectorTracingAgent::start(
|
| const Maybe<String>& categories,
|
| const Maybe<String>& options,
|
| @@ -50,12 +64,13 @@ void InspectorTracingAgent::start(
|
| const Maybe<protocol::Tracing::TraceConfig>& config,
|
| std::unique_ptr<StartCallback> callback)
|
| {
|
| - ASSERT(sessionId().isEmpty());
|
| + DCHECK(!isStarted());
|
| if (config.isJust()) {
|
| callback->sendFailure("Using trace config on renderer targets is not supported yet.");
|
| return;
|
| }
|
|
|
| + m_instrumentingAgents->addInspectorTracingAgent(this);
|
| m_state->setString(TracingAgentState::sessionId, IdentifiersFactory::createIdentifier());
|
| m_client->enableTracing(categories.fromMaybe(String()));
|
| emitMetadataEvents();
|
| @@ -65,11 +80,16 @@ void InspectorTracingAgent::start(
|
| void InspectorTracingAgent::end(std::unique_ptr<EndCallback> callback)
|
| {
|
| m_client->disableTracing();
|
| - resetSessionId();
|
| + innerDisable();
|
| callback->sendSuccess();
|
| }
|
|
|
| -String InspectorTracingAgent::sessionId()
|
| +bool InspectorTracingAgent::isStarted() const
|
| +{
|
| + return !sessionId().isEmpty();
|
| +}
|
| +
|
| +String InspectorTracingAgent::sessionId() const
|
| {
|
| String16 result;
|
| if (m_state)
|
| @@ -91,13 +111,21 @@ void InspectorTracingAgent::setLayerTreeId(int layerTreeId)
|
| TRACE_EVENT_INSTANT1(devtoolsMetadataEventCategory, "SetLayerTreeId", TRACE_EVENT_SCOPE_THREAD, "data", InspectorSetLayerTreeId::data(sessionId(), m_layerTreeId));
|
| }
|
|
|
| +void InspectorTracingAgent::rootLayerCleared()
|
| +{
|
| + if (isStarted())
|
| + m_client->hideReloadingBlanket();
|
| +}
|
| +
|
| void InspectorTracingAgent::disable(ErrorString*)
|
| {
|
| - resetSessionId();
|
| + innerDisable();
|
| }
|
|
|
| -void InspectorTracingAgent::resetSessionId()
|
| +void InspectorTracingAgent::innerDisable()
|
| {
|
| + m_client->hideReloadingBlanket();
|
| + m_instrumentingAgents->removeInspectorTracingAgent(this);
|
| m_state->remove(TracingAgentState::sessionId);
|
| m_workerAgent->setTracingSessionId(String());
|
| }
|
|
|