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 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
159 static void WorkerDestroyed(WorkerId id) { | 159 static void WorkerDestroyed(WorkerId id) { |
160 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 160 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
161 AgentHosts::iterator it = g_agent_map.Get().find(id); | 161 AgentHosts::iterator it = g_agent_map.Get().find(id); |
162 if (it == g_agent_map.Get().end()) { | 162 if (it == g_agent_map.Get().end()) { |
163 RemovePendingWorkerData(id); | 163 RemovePendingWorkerData(id); |
164 return; | 164 return; |
165 } | 165 } |
166 | 166 |
167 WorkerDevToolsAgentHost* agent = it->second; | 167 WorkerDevToolsAgentHost* agent = it->second; |
168 DevToolsManagerImpl* devtools_manager = DevToolsManagerImpl::GetInstance(); | 168 DevToolsManagerImpl* devtools_manager = DevToolsManagerImpl::GetInstance(); |
169 DevToolsClientHost* client_host = | 169 if (!agent->IsAttached()) { |
170 devtools_manager->GetDevToolsClientHostFor(agent); | |
171 | |
172 if (!client_host) { | |
173 // Agent has no client hosts -> delete it. | 170 // Agent has no client hosts -> delete it. |
174 RemovePendingWorkerData(id); | 171 RemovePendingWorkerData(id); |
175 return; | 172 return; |
176 } | 173 } |
177 | 174 |
178 // Client host is debugging this worker agent host. | 175 // Client host is debugging this worker agent host. |
179 devtools_manager->DispatchOnInspectorFrontend( | 176 devtools_manager->DispatchOnInspectorFrontend( |
180 agent, | 177 agent, |
181 WebDevToolsAgent::workerDisconnectedFromWorkerEvent().utf8()); | 178 WebDevToolsAgent::workerDisconnectedFromWorkerEvent().utf8()); |
182 g_orphan_map.Get()[id] = agent; | 179 g_orphan_map.Get()[id] = agent; |
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
438 it->second->ConnectionFailed(); | 435 it->second->ConnectionFailed(); |
439 } | 436 } |
440 | 437 |
441 // static | 438 // static |
442 void WorkerDevToolsManager::SendResumeToWorker(const WorkerId& id) { | 439 void WorkerDevToolsManager::SendResumeToWorker(const WorkerId& id) { |
443 if (WorkerProcessHost* process = FindWorkerProcess(id.first)) | 440 if (WorkerProcessHost* process = FindWorkerProcess(id.first)) |
444 process->Send(new DevToolsAgentMsg_ResumeWorkerContext(id.second)); | 441 process->Send(new DevToolsAgentMsg_ResumeWorkerContext(id.second)); |
445 } | 442 } |
446 | 443 |
447 } // namespace content | 444 } // namespace content |
OLD | NEW |