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/shared_worker/shared_worker_service_impl.h" | 5 #include "content/browser/shared_worker/shared_worker_service_impl.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <iterator> | 8 #include <iterator> |
9 #include <set> | 9 #include <set> |
10 #include <vector> | 10 #include <vector> |
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
280 SharedWorkerMessageFilter* filter) { | 280 SharedWorkerMessageFilter* filter) { |
281 ScopedWorkerDependencyChecker checker(this); | 281 ScopedWorkerDependencyChecker checker(this); |
282 std::vector<ProcessRouteIdPair> remove_list; | 282 std::vector<ProcessRouteIdPair> remove_list; |
283 for (WorkerHostMap::iterator iter = worker_hosts_.begin(); | 283 for (WorkerHostMap::iterator iter = worker_hosts_.begin(); |
284 iter != worker_hosts_.end(); | 284 iter != worker_hosts_.end(); |
285 ++iter) { | 285 ++iter) { |
286 iter->second->FilterShutdown(filter); | 286 iter->second->FilterShutdown(filter); |
287 if (iter->first.first == filter->render_process_id()) | 287 if (iter->first.first == filter->render_process_id()) |
288 remove_list.push_back(iter->first); | 288 remove_list.push_back(iter->first); |
289 } | 289 } |
290 for (size_t i = 0; i < remove_list.size(); ++i) | 290 for (size_t i = 0; i < remove_list.size(); ++i) { |
291 worker_hosts_.erase(remove_list[i]); | 291 scoped_ptr<SharedWorkerHost> host = |
| 292 worker_hosts_.take_and_erase(remove_list[i]); |
| 293 } |
| 294 } |
| 295 |
| 296 void SharedWorkerServiceImpl::NotifyWorkerDestroyed(int worker_process_id, |
| 297 int worker_route_id) { |
| 298 FOR_EACH_OBSERVER(WorkerServiceObserver, |
| 299 observers_, |
| 300 WorkerDestroyed(worker_process_id, worker_route_id)); |
292 } | 301 } |
293 | 302 |
294 SharedWorkerHost* SharedWorkerServiceImpl::FindSharedWorkerHost( | 303 SharedWorkerHost* SharedWorkerServiceImpl::FindSharedWorkerHost( |
295 SharedWorkerMessageFilter* filter, | 304 SharedWorkerMessageFilter* filter, |
296 int worker_route_id) { | 305 int worker_route_id) { |
297 return worker_hosts_.get(std::make_pair(filter->render_process_id(), | 306 return worker_hosts_.get(std::make_pair(filter->render_process_id(), |
298 worker_route_id)); | 307 worker_route_id)); |
299 } | 308 } |
300 | 309 |
301 SharedWorkerInstance* SharedWorkerServiceImpl::FindSharedWorkerInstance( | 310 SharedWorkerInstance* SharedWorkerServiceImpl::FindSharedWorkerInstance( |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
351 update_worker_dependency_(added_items, removed_items); | 360 update_worker_dependency_(added_items, removed_items); |
352 } | 361 } |
353 } | 362 } |
354 | 363 |
355 void SharedWorkerServiceImpl::ChangeUpdateWorkerDependencyFuncForTesting( | 364 void SharedWorkerServiceImpl::ChangeUpdateWorkerDependencyFuncForTesting( |
356 UpdateWorkerDependencyFunc new_func) { | 365 UpdateWorkerDependencyFunc new_func) { |
357 update_worker_dependency_ = new_func; | 366 update_worker_dependency_ = new_func; |
358 } | 367 } |
359 | 368 |
360 } // namespace content | 369 } // namespace content |
OLD | NEW |