Chromium Code Reviews| Index: content/browser/devtools/protocol/service_worker_handler.cc |
| diff --git a/content/browser/devtools/protocol/service_worker_handler.cc b/content/browser/devtools/protocol/service_worker_handler.cc |
| index 995442f1c36b854f0504fa9634d39e290e5c0916..4750a490e91bea6c6a86287ec993040a39cd3ed7 100644 |
| --- a/content/browser/devtools/protocol/service_worker_handler.cc |
| +++ b/content/browser/devtools/protocol/service_worker_handler.cc |
| @@ -192,8 +192,10 @@ void ServiceWorkerHandler::UpdateHosts() { |
| GetMatchingServiceWorkers(urls_); |
| for (auto pair : old_hosts) { |
| - if (new_hosts.find(pair.first) == new_hosts.end()) |
| + if (new_hosts.find(pair.first) == new_hosts.end()) { |
| + pair.second->DetachClient(); |
| ReportWorkerTerminated(pair.second.get()); |
| + } |
| } |
| for (auto pair : new_hosts) { |
| @@ -299,13 +301,13 @@ void ServiceWorkerHandler::DispatchProtocolMessage( |
| void ServiceWorkerHandler::AgentHostClosed( |
| DevToolsAgentHost* host, |
| bool replaced_with_another_client) { |
| - WorkerDestroyed(static_cast<ServiceWorkerDevToolsAgentHost*>(host)); |
| + ReportWorkerTerminated(static_cast<ServiceWorkerDevToolsAgentHost*>(host)); |
|
dgozman
2015/03/20 09:42:44
Let's remove host from |attached_hosts_| right her
pfeldman
2015/03/20 10:05:25
What you are suggesting is worse since we should o
|
| } |
| void ServiceWorkerHandler::WorkerCreated( |
| ServiceWorkerDevToolsAgentHost* host) { |
| auto hosts = GetMatchingServiceWorkers(urls_); |
| - if (hosts.find(host->GetId()) != hosts.end()) |
| + if (hosts.find(host->GetId()) != hosts.end() && !host->IsAttached()) |
| host->PauseForDebugOnStart(); |
| } |
| @@ -335,7 +337,6 @@ void ServiceWorkerHandler::ReportWorkerTerminated( |
| auto it = attached_hosts_.find(host->GetId()); |
| if (it == attached_hosts_.end()) |
| return; |
| - it->second->DetachClient(); |
| client_->WorkerTerminated(WorkerTerminatedParams::Create()-> |
| set_worker_id(host->GetId())); |
| attached_hosts_.erase(it); |