Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(7)

Side by Side Diff: Source/core/inspector/InspectorTracingAgent.cpp

Issue 254613002: DevTools: add Tracing agent on back-end (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: removed a stray call to TracingAgent.enable() Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 //
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
4 // found in the LICENSE file.
5 //
6
7 #include "config.h"
8
9 #include "core/inspector/InspectorTracingAgent.h"
10
11 #include "core/inspector/IdentifiersFactory.h"
12 #include "core/inspector/InspectorClient.h"
13 #include "core/inspector/InspectorState.h"
14 #include "platform/TraceEvent.h"
15
16 namespace WebCore {
17
18 namespace TracingAgentState {
19 const char sessionId[] = "sessionId";
20 }
21
22 namespace {
23 const char devtoolsMetadataEventCategory[] = TRACE_DISABLED_BY_DEFAULT("devtools .timeline");
24 }
25
26 InspectorTracingAgent::InspectorTracingAgent()
27 : InspectorBaseAgent<InspectorTracingAgent>("Tracing")
28 , m_layerTreeId(0)
29 {
30 }
31
32 void InspectorTracingAgent::restore()
33 {
34 emitMetadataEvents();
35 }
36
37 void InspectorTracingAgent::start(ErrorString*, const String&, const String&, co nst double*, String* outSessionId)
38 {
39 innerStart();
40 *outSessionId = sessionId();
41 }
42
43 void InspectorTracingAgent::innerStart()
44 {
45 String sessionId = IdentifiersFactory::createIdentifier();
46 m_state->setString(TracingAgentState::sessionId, sessionId);
47 emitMetadataEvents();
48 }
49
50 String InspectorTracingAgent::sessionId()
51 {
52 return m_state->getString(TracingAgentState::sessionId);
53 }
54
55 void InspectorTracingAgent::emitMetadataEvents()
56 {
57 TRACE_EVENT_INSTANT1(devtoolsMetadataEventCategory, "TracingStartedInPage", "sessionId", sessionId().utf8());
58 if (m_layerTreeId)
59 setLayerTreeId(m_layerTreeId);
60 }
61
62 void InspectorTracingAgent::setLayerTreeId(int layerTreeId)
63 {
64 m_layerTreeId = layerTreeId;
65 TRACE_EVENT_INSTANT2(devtoolsMetadataEventCategory, "SetLayerTreeId", "sessi onId", sessionId().utf8(), "layerTreeId", m_layerTreeId);
66 }
67
68 }
OLDNEW
« no previous file with comments | « Source/core/inspector/InspectorTracingAgent.h ('k') | Source/devtools/front_end/sdk/TimelineManager.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698