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

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

Issue 800113002: Use C++11 range-based for loop in Source/core/inspector (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: rebase again and again! Created 6 years 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
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 195 matching lines...) Expand 10 before | Expand all | Expand 10 after
206 void InspectorWorkerAgent::setAutoconnectToWorkers(ErrorString*, bool value) 206 void InspectorWorkerAgent::setAutoconnectToWorkers(ErrorString*, bool value)
207 { 207 {
208 m_state->setBoolean(WorkerAgentState::autoconnectToWorkers, value); 208 m_state->setBoolean(WorkerAgentState::autoconnectToWorkers, value);
209 } 209 }
210 210
211 void InspectorWorkerAgent::setTracingSessionId(const String& sessionId) 211 void InspectorWorkerAgent::setTracingSessionId(const String& sessionId)
212 { 212 {
213 m_tracingSessionId = sessionId; 213 m_tracingSessionId = sessionId;
214 if (sessionId.isEmpty()) 214 if (sessionId.isEmpty())
215 return; 215 return;
216 for (WorkerInfos::iterator it = m_workerInfos.begin(); it != m_workerInfos.e nd(); ++it) 216 for (auto& info : m_workerInfos)
217 it->key->writeTimelineStartedEvent(sessionId, it->value.id); 217 info.key->writeTimelineStartedEvent(sessionId, info.value.id);
218 } 218 }
219 219
220 bool InspectorWorkerAgent::shouldPauseDedicatedWorkerOnStart() 220 bool InspectorWorkerAgent::shouldPauseDedicatedWorkerOnStart()
221 { 221 {
222 return m_state->getBoolean(WorkerAgentState::autoconnectToWorkers); 222 return m_state->getBoolean(WorkerAgentState::autoconnectToWorkers);
223 } 223 }
224 224
225 void InspectorWorkerAgent::didStartWorker(WorkerInspectorProxy* workerInspectorP roxy, const KURL& url) 225 void InspectorWorkerAgent::didStartWorker(WorkerInspectorProxy* workerInspectorP roxy, const KURL& url)
226 { 226 {
227 int id = m_nextId++; 227 int id = m_nextId++;
(...skipping 12 matching lines...) Expand all
240 m_frontend->workerTerminated(it->key); 240 m_frontend->workerTerminated(it->key);
241 delete it->value; 241 delete it->value;
242 m_idToClient.remove(it); 242 m_idToClient.remove(it);
243 return; 243 return;
244 } 244 }
245 } 245 }
246 } 246 }
247 247
248 void InspectorWorkerAgent::createWorkerAgentClientsForExistingWorkers() 248 void InspectorWorkerAgent::createWorkerAgentClientsForExistingWorkers()
249 { 249 {
250 for (WorkerInfos::iterator it = m_workerInfos.begin(); it != m_workerInfos.e nd(); ++it) 250 for (auto& info : m_workerInfos)
251 createWorkerAgentClient(it->key, it->value.url, it->value.id); 251 createWorkerAgentClient(info.key, info.value.url, info.value.id);
252 } 252 }
253 253
254 void InspectorWorkerAgent::destroyWorkerAgentClients() 254 void InspectorWorkerAgent::destroyWorkerAgentClients()
255 { 255 {
256 for (WorkerClients::iterator it = m_idToClient.begin(); it != m_idToClient.e nd(); ++it) { 256 for (auto& client : m_idToClient) {
257 it->value->disconnectFromWorker(); 257 client.value->disconnectFromWorker();
258 delete it->value; 258 delete client.value;
259 } 259 }
260 m_idToClient.clear(); 260 m_idToClient.clear();
261 } 261 }
262 262
263 void InspectorWorkerAgent::createWorkerAgentClient(WorkerInspectorProxy* workerI nspectorProxy, const String& url, int id) 263 void InspectorWorkerAgent::createWorkerAgentClient(WorkerInspectorProxy* workerI nspectorProxy, const String& url, int id)
264 { 264 {
265 WorkerAgentClient* client = new WorkerAgentClient(m_frontend, workerInspecto rProxy, id, m_consoleAgent); 265 WorkerAgentClient* client = new WorkerAgentClient(m_frontend, workerInspecto rProxy, id, m_consoleAgent);
266 m_idToClient.set(id, client); 266 m_idToClient.set(id, client);
267 267
268 ASSERT(m_frontend); 268 ASSERT(m_frontend);
269 bool autoconnectToWorkers = m_state->getBoolean(WorkerAgentState::autoconnec tToWorkers); 269 bool autoconnectToWorkers = m_state->getBoolean(WorkerAgentState::autoconnec tToWorkers);
270 if (autoconnectToWorkers) 270 if (autoconnectToWorkers)
271 client->connectToWorker(); 271 client->connectToWorker();
272 m_frontend->workerCreated(id, url, autoconnectToWorkers); 272 m_frontend->workerCreated(id, url, autoconnectToWorkers);
273 } 273 }
274 274
275 } // namespace blink 275 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/inspector/InspectorTimelineAgent.cpp ('k') | Source/core/inspector/NetworkResourcesData.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698