| OLD | NEW |
| 1 // | 1 // |
| 2 // Copyright 2014 The Chromium Authors. All rights reserved. | 2 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 3 // Use of this source code is governed by a BSD-style license that can be | 3 // Use of this source code is governed by a BSD-style license that can be |
| 4 // found in the LICENSE file. | 4 // found in the LICENSE file. |
| 5 // | 5 // |
| 6 | 6 |
| 7 #include "config.h" | 7 #include "config.h" |
| 8 | 8 |
| 9 #include "core/inspector/InspectorTracingAgent.h" | 9 #include "core/inspector/InspectorTracingAgent.h" |
| 10 | 10 |
| 11 #include "core/inspector/IdentifiersFactory.h" | 11 #include "core/inspector/IdentifiersFactory.h" |
| 12 #include "core/inspector/InspectorClient.h" | 12 #include "core/inspector/InspectorClient.h" |
| 13 #include "core/inspector/InspectorState.h" | 13 #include "core/inspector/InspectorState.h" |
| 14 #include "core/inspector/InspectorTraceEvents.h" | 14 #include "core/inspector/InspectorTraceEvents.h" |
| 15 #include "core/inspector/InspectorWorkerAgent.h" | 15 #include "core/inspector/InspectorWorkerAgent.h" |
| 16 #include "core/page/Page.h" |
| 16 #include "platform/TraceEvent.h" | 17 #include "platform/TraceEvent.h" |
| 17 | 18 |
| 18 namespace blink { | 19 namespace blink { |
| 19 | 20 |
| 20 namespace TracingAgentState { | 21 namespace TracingAgentState { |
| 21 const char sessionId[] = "sessionId"; | 22 const char sessionId[] = "sessionId"; |
| 22 } | 23 } |
| 23 | 24 |
| 24 namespace { | 25 namespace { |
| 25 const char devtoolsMetadataEventCategory[] = TRACE_DISABLED_BY_DEFAULT("devtools
.timeline"); | 26 const char devtoolsMetadataEventCategory[] = TRACE_DISABLED_BY_DEFAULT("devtools
.timeline"); |
| 26 } | 27 } |
| 27 | 28 |
| 28 InspectorTracingAgent::InspectorTracingAgent(InspectorClient* client, InspectorW
orkerAgent* workerAgent, Page* page) | 29 InspectorTracingAgent::InspectorTracingAgent(InspectorClient* client, InspectorW
orkerAgent* workerAgent, Page* page) |
| 29 : InspectorBaseAgent<InspectorTracingAgent>("Tracing") | 30 : InspectorBaseAgent<InspectorTracingAgent>("Tracing") |
| 30 , m_layerTreeId(0) | 31 , m_layerTreeId(0) |
| 31 , m_client(client) | 32 , m_client(client) |
| 32 , m_frontend(0) | 33 , m_frontend(0) |
| 33 , m_workerAgent(workerAgent) | 34 , m_workerAgent(workerAgent) |
| 34 , m_page(page) | 35 , m_page(page) |
| 35 { | 36 { |
| 36 } | 37 } |
| 37 | 38 |
| 39 void InspectorTracingAgent::trace(Visitor* visitor) |
| 40 { |
| 41 visitor->trace(m_workerAgent); |
| 42 visitor->trace(m_page); |
| 43 InspectorBaseAgent<InspectorTracingAgent>::trace(visitor); |
| 44 } |
| 45 |
| 38 void InspectorTracingAgent::restore() | 46 void InspectorTracingAgent::restore() |
| 39 { | 47 { |
| 40 emitMetadataEvents(); | 48 emitMetadataEvents(); |
| 41 } | 49 } |
| 42 | 50 |
| 43 void InspectorTracingAgent::start(ErrorString*, const String* categoryFilter, co
nst String*, const double*, PassRefPtrWillBeRawPtr<StartCallback> callback) | 51 void InspectorTracingAgent::start(ErrorString*, const String* categoryFilter, co
nst String*, const double*, PassRefPtrWillBeRawPtr<StartCallback> callback) |
| 44 { | 52 { |
| 45 ASSERT(m_state->getString(TracingAgentState::sessionId).isEmpty()); | 53 ASSERT(m_state->getString(TracingAgentState::sessionId).isEmpty()); |
| 46 m_state->setString(TracingAgentState::sessionId, IdentifiersFactory::createI
dentifier()); | 54 m_state->setString(TracingAgentState::sessionId, IdentifiersFactory::createI
dentifier()); |
| 47 m_client->enableTracing(categoryFilter ? *categoryFilter : String()); | 55 m_client->enableTracing(categoryFilter ? *categoryFilter : String()); |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 resetSessionId(); | 93 resetSessionId(); |
| 86 } | 94 } |
| 87 | 95 |
| 88 void InspectorTracingAgent::resetSessionId() | 96 void InspectorTracingAgent::resetSessionId() |
| 89 { | 97 { |
| 90 m_state->remove(TracingAgentState::sessionId); | 98 m_state->remove(TracingAgentState::sessionId); |
| 91 m_workerAgent->setTracingSessionId(sessionId()); | 99 m_workerAgent->setTracingSessionId(sessionId()); |
| 92 } | 100 } |
| 93 | 101 |
| 94 } | 102 } |
| OLD | NEW |