| 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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 namespace { | 45 namespace { |
| 46 | 46 |
| 47 typedef std::map<WorkerDevToolsManager::WorkerId, | 47 typedef std::map<WorkerDevToolsManager::WorkerId, |
| 48 WorkerDevToolsManager::WorkerDevToolsAgentHost*> AgentHosts; | 48 WorkerDevToolsManager::WorkerDevToolsAgentHost*> AgentHosts; |
| 49 base::LazyInstance<AgentHosts>::Leaky g_agent_map = LAZY_INSTANCE_INITIALIZER; | 49 base::LazyInstance<AgentHosts>::Leaky g_agent_map = LAZY_INSTANCE_INITIALIZER; |
| 50 base::LazyInstance<AgentHosts>::Leaky g_orphan_map = LAZY_INSTANCE_INITIALIZER; | 50 base::LazyInstance<AgentHosts>::Leaky g_orphan_map = LAZY_INSTANCE_INITIALIZER; |
| 51 | 51 |
| 52 } // namespace | 52 } // namespace |
| 53 | 53 |
| 54 struct WorkerDevToolsManager::TerminatedInspectedWorker { | 54 struct WorkerDevToolsManager::TerminatedInspectedWorker { |
| 55 TerminatedInspectedWorker(WorkerId id, const GURL& url, const string16& name) | 55 TerminatedInspectedWorker(WorkerId id, |
| 56 const GURL& url, |
| 57 const base::string16& name) |
| 56 : old_worker_id(id), | 58 : old_worker_id(id), |
| 57 worker_url(url), | 59 worker_url(url), |
| 58 worker_name(name) {} | 60 worker_name(name) {} |
| 59 WorkerId old_worker_id; | 61 WorkerId old_worker_id; |
| 60 GURL worker_url; | 62 GURL worker_url; |
| 61 string16 worker_name; | 63 base::string16 worker_name; |
| 62 }; | 64 }; |
| 63 | 65 |
| 64 | 66 |
| 65 class WorkerDevToolsManager::WorkerDevToolsAgentHost | 67 class WorkerDevToolsManager::WorkerDevToolsAgentHost |
| 66 : public IPCDevToolsAgentHost { | 68 : public IPCDevToolsAgentHost { |
| 67 public: | 69 public: |
| 68 explicit WorkerDevToolsAgentHost(WorkerId worker_id) | 70 explicit WorkerDevToolsAgentHost(WorkerId worker_id) |
| 69 : has_worker_id_(false) { | 71 : has_worker_id_(false) { |
| 70 SetWorkerId(worker_id, false); | 72 SetWorkerId(worker_id, false); |
| 71 } | 73 } |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 195 DetachedClientHosts() {} | 197 DetachedClientHosts() {} |
| 196 ~DetachedClientHosts() {} | 198 ~DetachedClientHosts() {} |
| 197 | 199 |
| 198 static void RemoveInspectedWorkerDataOnIOThread(WorkerId id) { | 200 static void RemoveInspectedWorkerDataOnIOThread(WorkerId id) { |
| 199 WorkerDevToolsManager::GetInstance()->RemoveInspectedWorkerData(id); | 201 WorkerDevToolsManager::GetInstance()->RemoveInspectedWorkerData(id); |
| 200 } | 202 } |
| 201 }; | 203 }; |
| 202 | 204 |
| 203 struct WorkerDevToolsManager::InspectedWorker { | 205 struct WorkerDevToolsManager::InspectedWorker { |
| 204 InspectedWorker(WorkerProcessHost* host, int route_id, const GURL& url, | 206 InspectedWorker(WorkerProcessHost* host, int route_id, const GURL& url, |
| 205 const string16& name) | 207 const base::string16& name) |
| 206 : host(host), | 208 : host(host), |
| 207 route_id(route_id), | 209 route_id(route_id), |
| 208 worker_url(url), | 210 worker_url(url), |
| 209 worker_name(name) {} | 211 worker_name(name) {} |
| 210 WorkerProcessHost* const host; | 212 WorkerProcessHost* const host; |
| 211 int const route_id; | 213 int const route_id; |
| 212 GURL worker_url; | 214 GURL worker_url; |
| 213 string16 worker_name; | 215 base::string16 worker_name; |
| 214 }; | 216 }; |
| 215 | 217 |
| 216 // static | 218 // static |
| 217 WorkerDevToolsManager* WorkerDevToolsManager::GetInstance() { | 219 WorkerDevToolsManager* WorkerDevToolsManager::GetInstance() { |
| 218 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 220 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 219 return Singleton<WorkerDevToolsManager>::get(); | 221 return Singleton<WorkerDevToolsManager>::get(); |
| 220 } | 222 } |
| 221 | 223 |
| 222 // static | 224 // static |
| 223 DevToolsAgentHost* WorkerDevToolsManager::GetDevToolsAgentHostForWorker( | 225 DevToolsAgentHost* WorkerDevToolsManager::GetDevToolsAgentHostForWorker( |
| (...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 454 process->Send(new DevToolsAgentMsg_ResumeWorkerContext(id.second)); | 456 process->Send(new DevToolsAgentMsg_ResumeWorkerContext(id.second)); |
| 455 } | 457 } |
| 456 | 458 |
| 457 WorkerDevToolsManager::WorkerDevToolsAgentHost::~WorkerDevToolsAgentHost() { | 459 WorkerDevToolsManager::WorkerDevToolsAgentHost::~WorkerDevToolsAgentHost() { |
| 458 DetachedClientHosts::RemovePendingWorkerData(worker_id_); | 460 DetachedClientHosts::RemovePendingWorkerData(worker_id_); |
| 459 g_agent_map.Get().erase(worker_id_); | 461 g_agent_map.Get().erase(worker_id_); |
| 460 g_orphan_map.Get().erase(worker_id_); | 462 g_orphan_map.Get().erase(worker_id_); |
| 461 } | 463 } |
| 462 | 464 |
| 463 } // namespace content | 465 } // namespace content |
| OLD | NEW |