| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/service_worker_devtools_manager.h" | 5 #include "content/browser/devtools/service_worker_devtools_manager.h" |
| 6 | 6 |
| 7 #include "content/browser/devtools/devtools_agent_host_impl.h" |
| 7 #include "content/browser/devtools/service_worker_devtools_agent_host.h" | 8 #include "content/browser/devtools/service_worker_devtools_agent_host.h" |
| 8 #include "content/public/browser/browser_thread.h" | 9 #include "content/public/browser/browser_thread.h" |
| 9 #include "content/public/browser/render_process_host.h" | 10 #include "content/public/browser/render_process_host.h" |
| 10 #include "content/public/browser/worker_service.h" | 11 #include "content/public/browser/worker_service.h" |
| 11 #include "ipc/ipc_listener.h" | 12 #include "ipc/ipc_listener.h" |
| 12 | 13 |
| 13 namespace content { | 14 namespace content { |
| 14 | 15 |
| 15 ServiceWorkerDevToolsManager::ServiceWorkerIdentifier::ServiceWorkerIdentifier( | 16 ServiceWorkerDevToolsManager::ServiceWorkerIdentifier::ServiceWorkerIdentifier( |
| 16 const ServiceWorkerContextCore* context, | 17 const ServiceWorkerContextCore* context, |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 AgentHostMap::iterator it = workers_.find(id); | 112 AgentHostMap::iterator it = workers_.find(id); |
| 112 if (it == workers_.end()) | 113 if (it == workers_.end()) |
| 113 return; | 114 return; |
| 114 scoped_refptr<ServiceWorkerDevToolsAgentHost> host = it->second; | 115 scoped_refptr<ServiceWorkerDevToolsAgentHost> host = it->second; |
| 115 host->WorkerReadyForInspection(); | 116 host->WorkerReadyForInspection(); |
| 116 FOR_EACH_OBSERVER(Observer, observer_list_, | 117 FOR_EACH_OBSERVER(Observer, observer_list_, |
| 117 WorkerReadyForInspection(host.get())); | 118 WorkerReadyForInspection(host.get())); |
| 118 | 119 |
| 119 // Then bring up UI for the ones not picked by other clients. | 120 // Then bring up UI for the ones not picked by other clients. |
| 120 if (host->IsPausedForDebugOnStart() && !host->IsAttached()) | 121 if (host->IsPausedForDebugOnStart() && !host->IsAttached()) |
| 121 host->Inspect(); | 122 static_cast<DevToolsAgentHostImpl*>(host.get())->Inspect(); |
| 122 } | 123 } |
| 123 | 124 |
| 124 void ServiceWorkerDevToolsManager::WorkerVersionInstalled(int worker_process_id, | 125 void ServiceWorkerDevToolsManager::WorkerVersionInstalled(int worker_process_id, |
| 125 int worker_route_id) { | 126 int worker_route_id) { |
| 126 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 127 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 127 const WorkerId id(worker_process_id, worker_route_id); | 128 const WorkerId id(worker_process_id, worker_route_id); |
| 128 AgentHostMap::iterator it = workers_.find(id); | 129 AgentHostMap::iterator it = workers_.find(id); |
| 129 if (it == workers_.end()) | 130 if (it == workers_.end()) |
| 130 return; | 131 return; |
| 131 scoped_refptr<ServiceWorkerDevToolsAgentHost> host = it->second; | 132 scoped_refptr<ServiceWorkerDevToolsAgentHost> host = it->second; |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 192 break; | 193 break; |
| 193 } | 194 } |
| 194 return it; | 195 return it; |
| 195 } | 196 } |
| 196 | 197 |
| 197 void ServiceWorkerDevToolsManager::ResetForTesting() { | 198 void ServiceWorkerDevToolsManager::ResetForTesting() { |
| 198 workers_.clear(); | 199 workers_.clear(); |
| 199 } | 200 } |
| 200 | 201 |
| 201 } // namespace content | 202 } // namespace content |
| OLD | NEW |