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 429 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
440 iter->second->FilterShutdown(filter); | 440 iter->second->FilterShutdown(filter); |
441 if (iter->first.first == filter->render_process_id()) | 441 if (iter->first.first == filter->render_process_id()) |
442 remove_list.push_back(iter->first); | 442 remove_list.push_back(iter->first); |
443 } | 443 } |
444 for (size_t i = 0; i < remove_list.size(); ++i) { | 444 for (size_t i = 0; i < remove_list.size(); ++i) { |
445 scoped_ptr<SharedWorkerHost> host = | 445 scoped_ptr<SharedWorkerHost> host = |
446 worker_hosts_.take_and_erase(remove_list[i]); | 446 worker_hosts_.take_and_erase(remove_list[i]); |
447 } | 447 } |
448 | 448 |
449 std::vector<int> remove_pending_instance_list; | 449 std::vector<int> remove_pending_instance_list; |
450 for (PendingInstaneMap::iterator iter = pending_instances_.begin(); | 450 for (PendingInstanceMap::iterator iter = pending_instances_.begin(); |
451 iter != pending_instances_.end(); | 451 iter != pending_instances_.end(); ++iter) { |
452 ++iter) { | |
453 iter->second->RemoveRequest(filter->render_process_id()); | 452 iter->second->RemoveRequest(filter->render_process_id()); |
454 if (!iter->second->requests()->size()) | 453 if (!iter->second->requests()->size()) |
455 remove_pending_instance_list.push_back(iter->first); | 454 remove_pending_instance_list.push_back(iter->first); |
456 } | 455 } |
457 for (size_t i = 0; i < remove_pending_instance_list.size(); ++i) | 456 for (size_t i = 0; i < remove_pending_instance_list.size(); ++i) |
458 pending_instances_.take_and_erase(remove_pending_instance_list[i]); | 457 pending_instances_.take_and_erase(remove_pending_instance_list[i]); |
459 } | 458 } |
460 | 459 |
461 void SharedWorkerServiceImpl::NotifyWorkerDestroyed(int worker_process_id, | 460 void SharedWorkerServiceImpl::NotifyWorkerDestroyed(int worker_process_id, |
462 int worker_route_id) { | 461 int worker_route_id) { |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
609 host->instance()->Matches(instance)) { | 608 host->instance()->Matches(instance)) { |
610 return iter->second; | 609 return iter->second; |
611 } | 610 } |
612 } | 611 } |
613 return NULL; | 612 return NULL; |
614 } | 613 } |
615 | 614 |
616 SharedWorkerServiceImpl::SharedWorkerPendingInstance* | 615 SharedWorkerServiceImpl::SharedWorkerPendingInstance* |
617 SharedWorkerServiceImpl::FindPendingInstance( | 616 SharedWorkerServiceImpl::FindPendingInstance( |
618 const SharedWorkerInstance& instance) { | 617 const SharedWorkerInstance& instance) { |
619 for (PendingInstaneMap::iterator iter = pending_instances_.begin(); | 618 for (PendingInstanceMap::iterator iter = pending_instances_.begin(); |
620 iter != pending_instances_.end(); | 619 iter != pending_instances_.end(); ++iter) { |
621 ++iter) { | |
622 if (iter->second->instance()->Matches(instance)) | 620 if (iter->second->instance()->Matches(instance)) |
623 return iter->second; | 621 return iter->second; |
624 } | 622 } |
625 return NULL; | 623 return NULL; |
626 } | 624 } |
627 | 625 |
628 const std::set<int> | 626 const std::set<int> |
629 SharedWorkerServiceImpl::GetRenderersWithWorkerDependency() { | 627 SharedWorkerServiceImpl::GetRenderersWithWorkerDependency() { |
630 std::set<int> dependent_renderers; | 628 std::set<int> dependent_renderers; |
631 for (WorkerHostMap::iterator host_iter = worker_hosts_.begin(); | 629 for (WorkerHostMap::iterator host_iter = worker_hosts_.begin(); |
(...skipping 28 matching lines...) Expand all Loading... |
660 UpdateWorkerDependencyFunc new_func) { | 658 UpdateWorkerDependencyFunc new_func) { |
661 update_worker_dependency_ = new_func; | 659 update_worker_dependency_ = new_func; |
662 } | 660 } |
663 | 661 |
664 void SharedWorkerServiceImpl::ChangeTryIncrementWorkerRefCountFuncForTesting( | 662 void SharedWorkerServiceImpl::ChangeTryIncrementWorkerRefCountFuncForTesting( |
665 bool (*new_func)(int)) { | 663 bool (*new_func)(int)) { |
666 s_try_increment_worker_ref_count_ = new_func; | 664 s_try_increment_worker_ref_count_ = new_func; |
667 } | 665 } |
668 | 666 |
669 } // namespace content | 667 } // namespace content |
OLD | NEW |