Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 199 void InspectorWorkerAgent::setAutoconnectToWorkers(ErrorString*, bool value) | 199 void InspectorWorkerAgent::setAutoconnectToWorkers(ErrorString*, bool value) |
| 200 { | 200 { |
| 201 m_state->setBoolean(WorkerAgentState::autoconnectToWorkers, value); | 201 m_state->setBoolean(WorkerAgentState::autoconnectToWorkers, value); |
| 202 } | 202 } |
| 203 | 203 |
| 204 void InspectorWorkerAgent::setTracingSessionId(const String& sessionId) | 204 void InspectorWorkerAgent::setTracingSessionId(const String& sessionId) |
| 205 { | 205 { |
| 206 m_tracingSessionId = sessionId; | 206 m_tracingSessionId = sessionId; |
| 207 if (sessionId.isEmpty()) | 207 if (sessionId.isEmpty()) |
| 208 return; | 208 return; |
| 209 for (WorkerIds::iterator it = m_workerIds.begin(); it != m_workerIds.end(); ++it) | 209 for (WorkerChannels::iterator it = m_idToChannel.begin(); it != m_idToChanne l.end(); ++it) |
| 210 it->key->writeTimelineStartedEvent(sessionId); | 210 it->value->proxy()->writeTimelineStartedEvent(it->key, sessionId); |
|
yurys
2014/11/14 13:25:26
This will not write events for workers without con
alph
2014/11/14 15:01:59
Done.
| |
| 211 } | 211 } |
| 212 | 212 |
| 213 bool InspectorWorkerAgent::shouldPauseDedicatedWorkerOnStart() | 213 bool InspectorWorkerAgent::shouldPauseDedicatedWorkerOnStart() |
| 214 { | 214 { |
| 215 return m_state->getBoolean(WorkerAgentState::autoconnectToWorkers); | 215 return m_state->getBoolean(WorkerAgentState::autoconnectToWorkers); |
| 216 } | 216 } |
| 217 | 217 |
| 218 void InspectorWorkerAgent::didStartWorker(WorkerInspectorProxy* workerInspectorP roxy, const KURL& url) | 218 void InspectorWorkerAgent::didStartWorker(WorkerInspectorProxy* workerInspectorP roxy, const KURL& url) |
| 219 { | 219 { |
| 220 m_workerIds.set(workerInspectorProxy, url.string()); | 220 m_workerIds.set(workerInspectorProxy, url.string()); |
| 221 if (m_frontend && m_state->getBoolean(WorkerAgentState::workerInspectionEnab led)) | 221 if (m_frontend && m_state->getBoolean(WorkerAgentState::workerInspectionEnab led)) |
| 222 createWorkerFrontendChannel(workerInspectorProxy, url.string()); | 222 createWorkerFrontendChannel(workerInspectorProxy, url.string()); |
| 223 if (!m_tracingSessionId.isEmpty()) | |
| 224 workerInspectorProxy->writeTimelineStartedEvent(m_tracingSessionId); | |
| 225 } | 223 } |
| 226 | 224 |
| 227 void InspectorWorkerAgent::workerTerminated(WorkerInspectorProxy* proxy) | 225 void InspectorWorkerAgent::workerTerminated(WorkerInspectorProxy* proxy) |
| 228 { | 226 { |
| 229 m_workerIds.remove(proxy); | 227 m_workerIds.remove(proxy); |
| 230 for (WorkerChannels::iterator it = m_idToChannel.begin(); it != m_idToChanne l.end(); ++it) { | 228 for (WorkerChannels::iterator it = m_idToChannel.begin(); it != m_idToChanne l.end(); ++it) { |
| 231 if (proxy == it->value->proxy()) { | 229 if (proxy == it->value->proxy()) { |
| 232 m_frontend->workerTerminated(it->key); | 230 m_frontend->workerTerminated(it->key); |
| 233 delete it->value; | 231 delete it->value; |
| 234 m_idToChannel.remove(it); | 232 m_idToChannel.remove(it); |
| (...skipping 20 matching lines...) Expand all Loading... | |
| 255 void InspectorWorkerAgent::createWorkerFrontendChannel(WorkerInspectorProxy* wor kerInspectorProxy, const String& url) | 253 void InspectorWorkerAgent::createWorkerFrontendChannel(WorkerInspectorProxy* wor kerInspectorProxy, const String& url) |
| 256 { | 254 { |
| 257 WorkerFrontendChannel* channel = new WorkerFrontendChannel(m_frontend, worke rInspectorProxy); | 255 WorkerFrontendChannel* channel = new WorkerFrontendChannel(m_frontend, worke rInspectorProxy); |
| 258 m_idToChannel.set(channel->id(), channel); | 256 m_idToChannel.set(channel->id(), channel); |
| 259 | 257 |
| 260 ASSERT(m_frontend); | 258 ASSERT(m_frontend); |
| 261 bool autoconnectToWorkers = m_state->getBoolean(WorkerAgentState::autoconnec tToWorkers); | 259 bool autoconnectToWorkers = m_state->getBoolean(WorkerAgentState::autoconnec tToWorkers); |
| 262 if (autoconnectToWorkers) | 260 if (autoconnectToWorkers) |
| 263 channel->connectToWorker(); | 261 channel->connectToWorker(); |
| 264 m_frontend->workerCreated(channel->id(), url, autoconnectToWorkers); | 262 m_frontend->workerCreated(channel->id(), url, autoconnectToWorkers); |
| 263 if (!m_tracingSessionId.isEmpty()) | |
| 264 workerInspectorProxy->writeTimelineStartedEvent(channel->id(), m_tracing SessionId); | |
| 265 } | 265 } |
| 266 | 266 |
| 267 } // namespace blink | 267 } // namespace blink |
| OLD | NEW |