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

Unified Diff: Source/core/inspector/InspectorTimelineAgent.cpp

Issue 247513002: Timeline: produce session cookie when timeline is started (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: use IndetifiersFactory instead of directly getting processId 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/inspector/InspectorTimelineAgent.h ('k') | Source/devtools/front_end/TimelineManager.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/inspector/InspectorTimelineAgent.cpp
diff --git a/Source/core/inspector/InspectorTimelineAgent.cpp b/Source/core/inspector/InspectorTimelineAgent.cpp
index 08c88721f1402ae30bf78ca011d3a2525798eaa5..c901add66c37fe076d73a236d36242c74318dd24 100644
--- a/Source/core/inspector/InspectorTimelineAgent.cpp
+++ b/Source/core/inspector/InspectorTimelineAgent.cpp
@@ -73,6 +73,7 @@ static const char includeCounters[] = "includeCounters";
static const char includeGPUEvents[] = "includeGPUEvents";
static const char bufferEvents[] = "bufferEvents";
static const char liveEvents[] = "liveEvents";
+static const char sessionId[] = "sessionId";
static const char traceEventCategoryFilter[] = "traceEventCategoryFilter";
}
@@ -341,10 +342,11 @@ void InspectorTimelineAgent::start(ErrorString* errorString, const int* maxCallS
m_state->setBoolean(TimelineAgentState::includeGPUEvents, includeGPUEvents && *includeGPUEvents);
m_state->setBoolean(TimelineAgentState::bufferEvents, bufferEvents && *bufferEvents);
m_state->setString(TimelineAgentState::liveEvents, liveEvents ? *liveEvents : "");
+ initializeSessionId();
innerStart();
bool fromConsole = false;
- m_frontend->started(&fromConsole);
+ m_frontend->started(sessionId(), &fromConsole);
}
bool InspectorTimelineAgent::isStarted()
@@ -366,6 +368,10 @@ void InspectorTimelineAgent::innerStart()
}
m_instrumentingAgents->setInspectorTimelineAgent(this);
ScriptGCEvent::addEventListener(this);
+ TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "TimelineStarted", "sessionId", sessionId().utf8());
+ if (m_layerTreeId) {
+ TRACE_EVENT_INSTANT2(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "SetLayerTreeId", "sessionId", sessionId().utf8(), "layerTreeId", m_layerTreeId);
+ }
if (m_client) {
TraceEventDispatcher* dispatcher = TraceEventDispatcher::instance();
dispatcher->addListener(InstrumentationEvents::BeginFrame, TRACE_EVENT_PHASE_INSTANT, this, &InspectorTimelineAgent::onBeginImplSideFrame, m_client);
@@ -398,6 +404,7 @@ void InspectorTimelineAgent::stop(ErrorString* errorString, RefPtr<TypeBuilder::
m_state->setBoolean(TimelineAgentState::startedFromProtocol, false);
m_state->setBoolean(TimelineAgentState::bufferEvents, false);
m_state->setString(TimelineAgentState::liveEvents, "");
+ m_state->setString(TimelineAgentState::sessionId, "");
if (!isStarted()) {
*errorString = "Timeline was not started";
@@ -446,6 +453,24 @@ void InspectorTimelineAgent::innerStop(bool fromConsole)
m_overlay->finishedRecordingProfile();
}
+String InspectorTimelineAgent::sessionId() const
+{
+ return m_state->getString(TimelineAgentState::sessionId);
+}
+
+void InspectorTimelineAgent::initializeSessionId()
+{
+ static unsigned lastTimelineSessionId;
+ String sessionId = IdentifiersFactory::createIdentifier();
+ m_state->setString(TimelineAgentState::sessionId, sessionId);
+}
+
+void InspectorTimelineAgent::setLayerTreeId(int layerTreeId)
+{
+ m_layerTreeId = layerTreeId;
+ TRACE_EVENT_INSTANT2(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "setLayerTreeId", "sessionId", sessionId().utf8(), "layerTreeId", m_layerTreeId);
+}
+
void InspectorTimelineAgent::didBeginFrame(int frameId)
{
TraceEventDispatcher::instance()->processBackgroundEvents();
@@ -830,9 +855,10 @@ void InspectorTimelineAgent::consoleTimeline(ExecutionContext* context, const St
mainFrame()->console().addMessage(ConsoleAPIMessageSource, DebugMessageLevel, message, String(), 0, 0, nullptr, state);
m_consoleTimelines.append(title);
if (!isStarted()) {
+ initializeSessionId();
innerStart();
bool fromConsole = true;
- m_frontend->started(&fromConsole);
+ m_frontend->started(sessionId(), &fromConsole);
}
appendRecord(TimelineRecordFactory::createTimeStampData(message), TimelineRecordType::TimeStamp, true, frameForExecutionContext(context));
}
« no previous file with comments | « Source/core/inspector/InspectorTimelineAgent.h ('k') | Source/devtools/front_end/TimelineManager.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698