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

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

Issue 460363002: Record DevTools metadata events on worker threads when starting recoring tracing based Timeline (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 4 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
1 /* 1 /*
2 * Copyright (C) 2011 Google Inc. All rights reserved. 2 * Copyright (C) 2011 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
192 channel->proxy()->sendMessageToInspector(message->toJSONString()); 192 channel->proxy()->sendMessageToInspector(message->toJSONString());
193 else 193 else
194 *error = "Worker is gone"; 194 *error = "Worker is gone";
195 } 195 }
196 196
197 void InspectorWorkerAgent::setAutoconnectToWorkers(ErrorString*, bool value) 197 void InspectorWorkerAgent::setAutoconnectToWorkers(ErrorString*, bool value)
198 { 198 {
199 m_state->setBoolean(WorkerAgentState::autoconnectToWorkers, value); 199 m_state->setBoolean(WorkerAgentState::autoconnectToWorkers, value);
200 } 200 }
201 201
202 void InspectorWorkerAgent::setTracingSessionId(const String& sessionId)
203 {
204 m_tracingSessionId = sessionId;
205 if (sessionId.isEmpty())
206 return;
207 for (DedicatedWorkers::iterator it = m_dedicatedWorkers.begin(); it != m_ded icatedWorkers.end(); ++it) {
alph 2014/08/12 12:54:32 style: no need for {}
yurys 2014/08/12 13:15:20 Done.
208 it->key->writeTimelineStartedEvent(sessionId);
209 }
210 }
211
202 bool InspectorWorkerAgent::shouldPauseDedicatedWorkerOnStart() 212 bool InspectorWorkerAgent::shouldPauseDedicatedWorkerOnStart()
203 { 213 {
204 return m_state->getBoolean(WorkerAgentState::autoconnectToWorkers); 214 return m_state->getBoolean(WorkerAgentState::autoconnectToWorkers);
205 } 215 }
206 216
207 void InspectorWorkerAgent::didStartWorkerGlobalScope(WorkerGlobalScopeProxy* wor kerGlobalScopeProxy, const KURL& url) 217 void InspectorWorkerAgent::didStartWorkerGlobalScope(WorkerGlobalScopeProxy* wor kerGlobalScopeProxy, const KURL& url)
208 { 218 {
209 m_dedicatedWorkers.set(workerGlobalScopeProxy, url.string()); 219 m_dedicatedWorkers.set(workerGlobalScopeProxy, url.string());
210 if (m_inspectorFrontend && m_state->getBoolean(WorkerAgentState::workerInspe ctionEnabled)) 220 if (m_inspectorFrontend && m_state->getBoolean(WorkerAgentState::workerInspe ctionEnabled))
211 createWorkerFrontendChannel(workerGlobalScopeProxy, url.string()); 221 createWorkerFrontendChannel(workerGlobalScopeProxy, url.string());
222 if (!m_tracingSessionId.isEmpty())
223 workerGlobalScopeProxy->writeTimelineStartedEvent(m_tracingSessionId);
212 } 224 }
213 225
214 void InspectorWorkerAgent::workerGlobalScopeTerminated(WorkerGlobalScopeProxy* p roxy) 226 void InspectorWorkerAgent::workerGlobalScopeTerminated(WorkerGlobalScopeProxy* p roxy)
215 { 227 {
216 m_dedicatedWorkers.remove(proxy); 228 m_dedicatedWorkers.remove(proxy);
217 for (WorkerChannels::iterator it = m_idToChannel.begin(); it != m_idToChanne l.end(); ++it) { 229 for (WorkerChannels::iterator it = m_idToChannel.begin(); it != m_idToChanne l.end(); ++it) {
218 if (proxy == it->value->proxy()) { 230 if (proxy == it->value->proxy()) {
219 m_inspectorFrontend->worker()->workerTerminated(it->key); 231 m_inspectorFrontend->worker()->workerTerminated(it->key);
220 delete it->value; 232 delete it->value;
221 m_idToChannel.remove(it); 233 m_idToChannel.remove(it);
(...skipping 23 matching lines...) Expand all
245 m_idToChannel.set(channel->id(), channel); 257 m_idToChannel.set(channel->id(), channel);
246 258
247 ASSERT(m_inspectorFrontend); 259 ASSERT(m_inspectorFrontend);
248 bool autoconnectToWorkers = m_state->getBoolean(WorkerAgentState::autoconnec tToWorkers); 260 bool autoconnectToWorkers = m_state->getBoolean(WorkerAgentState::autoconnec tToWorkers);
249 if (autoconnectToWorkers) 261 if (autoconnectToWorkers)
250 channel->connectToWorkerGlobalScope(); 262 channel->connectToWorkerGlobalScope();
251 m_inspectorFrontend->worker()->workerCreated(channel->id(), url, autoconnect ToWorkers); 263 m_inspectorFrontend->worker()->workerCreated(channel->id(), url, autoconnect ToWorkers);
252 } 264 }
253 265
254 } // namespace blink 266 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/inspector/InspectorWorkerAgent.h ('k') | Source/core/workers/WorkerGlobalScopeProxy.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698