Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "content/browser/devtools/worker_devtools_manager.h" | 5 #include "content/browser/devtools/worker_devtools_manager.h" |
| 6 | 6 |
| 7 #include <list> | 7 #include <list> |
| 8 #include <map> | 8 #include <map> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 229 } | 229 } |
| 230 | 230 |
| 231 void WorkerDevToolsManager::WorkerCreated( | 231 void WorkerDevToolsManager::WorkerCreated( |
| 232 WorkerProcessHost* worker, | 232 WorkerProcessHost* worker, |
| 233 const WorkerProcessHost::WorkerInstance& instance) { | 233 const WorkerProcessHost::WorkerInstance& instance) { |
| 234 for (TerminatedInspectedWorkers::iterator it = terminated_workers_.begin(); | 234 for (TerminatedInspectedWorkers::iterator it = terminated_workers_.begin(); |
| 235 it != terminated_workers_.end(); ++it) { | 235 it != terminated_workers_.end(); ++it) { |
| 236 if (instance.Matches(it->worker_url, it->worker_name, | 236 if (instance.Matches(it->worker_url, it->worker_name, |
| 237 instance.partition(), | 237 instance.partition(), |
| 238 instance.resource_context())) { | 238 instance.resource_context())) { |
| 239 worker->Send(new DevToolsAgentMsg_PauseWorkerContextOnStart( | |
| 240 instance.worker_route_id())); | |
| 241 WorkerId new_worker_id(worker->GetData().id, instance.worker_route_id()); | 239 WorkerId new_worker_id(worker->GetData().id, instance.worker_route_id()); |
| 242 paused_workers_[new_worker_id] = it->old_worker_id; | 240 paused_workers_[new_worker_id] = it->old_worker_id; |
| 243 terminated_workers_.erase(it); | 241 terminated_workers_.erase(it); |
| 244 return; | 242 return; |
| 245 } | 243 } |
| 246 } | 244 } |
| 247 } | 245 } |
| 248 | 246 |
| 249 void WorkerDevToolsManager::WorkerDestroyed( | 247 void WorkerDevToolsManager::WorkerDestroyed( |
| 250 WorkerProcessHost* worker, | 248 WorkerProcessHost* worker, |
| (...skipping 24 matching lines...) Expand all Loading... | |
| 275 | 273 |
| 276 BrowserThread::PostTask( | 274 BrowserThread::PostTask( |
| 277 BrowserThread::UI, FROM_HERE, | 275 BrowserThread::UI, FROM_HERE, |
| 278 base::Bind( | 276 base::Bind( |
| 279 &DetachedClientHosts::WorkerReloaded, | 277 &DetachedClientHosts::WorkerReloaded, |
| 280 it->second, | 278 it->second, |
| 281 new_worker_id)); | 279 new_worker_id)); |
| 282 paused_workers_.erase(it); | 280 paused_workers_.erase(it); |
| 283 } | 281 } |
| 284 | 282 |
| 283 bool WorkerDevToolsManager::TerminatedWorkerExist( | |
|
yurys
2014/03/27 08:37:26
We could merge WorkerCreated into this new method
horo
2014/03/27 09:48:10
Done.
| |
| 284 const WorkerProcessHost::WorkerInstance& instance) const { | |
| 285 for (TerminatedInspectedWorkers::const_iterator it = | |
| 286 terminated_workers_.begin(); | |
| 287 it != terminated_workers_.end(); | |
| 288 ++it) { | |
| 289 if (instance.Matches(it->worker_url, | |
| 290 it->worker_name, | |
| 291 instance.partition(), | |
| 292 instance.resource_context())) { | |
| 293 return true; | |
| 294 } | |
| 295 } | |
| 296 return false; | |
| 297 } | |
|
kinuko
2014/03/27 08:04:34
I think adding pause_on_start param in CreateWorke
horo
2014/03/27 09:45:48
Done.
| |
| 298 | |
| 285 void WorkerDevToolsManager::RemoveInspectedWorkerData( | 299 void WorkerDevToolsManager::RemoveInspectedWorkerData( |
| 286 const WorkerId& id) { | 300 const WorkerId& id) { |
| 287 for (TerminatedInspectedWorkers::iterator it = terminated_workers_.begin(); | 301 for (TerminatedInspectedWorkers::iterator it = terminated_workers_.begin(); |
| 288 it != terminated_workers_.end(); ++it) { | 302 it != terminated_workers_.end(); ++it) { |
| 289 if (it->old_worker_id == id) { | 303 if (it->old_worker_id == id) { |
| 290 terminated_workers_.erase(it); | 304 terminated_workers_.erase(it); |
| 291 return; | 305 return; |
| 292 } | 306 } |
| 293 } | 307 } |
| 294 | 308 |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 438 process->Send(new DevToolsAgentMsg_ResumeWorkerContext(id.second)); | 452 process->Send(new DevToolsAgentMsg_ResumeWorkerContext(id.second)); |
| 439 } | 453 } |
| 440 | 454 |
| 441 WorkerDevToolsManager::WorkerDevToolsAgentHost::~WorkerDevToolsAgentHost() { | 455 WorkerDevToolsManager::WorkerDevToolsAgentHost::~WorkerDevToolsAgentHost() { |
| 442 DetachedClientHosts::RemovePendingWorkerData(worker_id_); | 456 DetachedClientHosts::RemovePendingWorkerData(worker_id_); |
| 443 g_agent_map.Get().erase(worker_id_); | 457 g_agent_map.Get().erase(worker_id_); |
| 444 g_orphan_map.Get().erase(worker_id_); | 458 g_orphan_map.Get().erase(worker_id_); |
| 445 } | 459 } |
| 446 | 460 |
| 447 } // namespace content | 461 } // namespace content |
| OLD | NEW |