| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <iterator> | 10 #include <iterator> |
| (...skipping 428 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 439 pending_instances_.erase(to_remove); | 439 pending_instances_.erase(to_remove); |
| 440 } | 440 } |
| 441 | 441 |
| 442 void SharedWorkerServiceImpl::NotifyWorkerDestroyed(int worker_process_id, | 442 void SharedWorkerServiceImpl::NotifyWorkerDestroyed(int worker_process_id, |
| 443 int worker_route_id) { | 443 int worker_route_id) { |
| 444 FOR_EACH_OBSERVER(WorkerServiceObserver, | 444 FOR_EACH_OBSERVER(WorkerServiceObserver, |
| 445 observers_, | 445 observers_, |
| 446 WorkerDestroyed(worker_process_id, worker_route_id)); | 446 WorkerDestroyed(worker_process_id, worker_route_id)); |
| 447 } | 447 } |
| 448 | 448 |
| 449 // TODO(alokp): Remove after collecting crash data. |
| 450 // Temporary checks to verify that all shared workers are terminated. |
| 451 // It is suspected that shared workers prevent render process hosts |
| 452 // from shutting down: crbug.com/608049 |
| 453 void SharedWorkerServiceImpl::CheckAllWorkersTerminated() { |
| 454 std::set<int> dependent_renderers = GetRenderersWithWorkerDependency(); |
| 455 CHECK_EQ(0u, dependent_renderers.size()); |
| 456 } |
| 457 |
| 449 blink::WebWorkerCreationError | 458 blink::WebWorkerCreationError |
| 450 SharedWorkerServiceImpl::ReserveRenderProcessToCreateWorker( | 459 SharedWorkerServiceImpl::ReserveRenderProcessToCreateWorker( |
| 451 std::unique_ptr<SharedWorkerPendingInstance> pending_instance) { | 460 std::unique_ptr<SharedWorkerPendingInstance> pending_instance) { |
| 452 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 461 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 453 DCHECK(!FindPendingInstance(*pending_instance->instance())); | 462 DCHECK(!FindPendingInstance(*pending_instance->instance())); |
| 454 if (!pending_instance->requests()->size()) | 463 if (!pending_instance->requests()->size()) |
| 455 return blink::WebWorkerCreationErrorNone; | 464 return blink::WebWorkerCreationErrorNone; |
| 456 | 465 |
| 457 int worker_process_id = -1; | 466 int worker_process_id = -1; |
| 458 int worker_route_id = MSG_ROUTING_NONE; | 467 int worker_route_id = MSG_ROUTING_NONE; |
| (...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 646 UpdateWorkerDependencyFunc new_func) { | 655 UpdateWorkerDependencyFunc new_func) { |
| 647 update_worker_dependency_ = new_func; | 656 update_worker_dependency_ = new_func; |
| 648 } | 657 } |
| 649 | 658 |
| 650 void SharedWorkerServiceImpl::ChangeTryIncrementWorkerRefCountFuncForTesting( | 659 void SharedWorkerServiceImpl::ChangeTryIncrementWorkerRefCountFuncForTesting( |
| 651 bool (*new_func)(int)) { | 660 bool (*new_func)(int)) { |
| 652 s_try_increment_worker_ref_count_ = new_func; | 661 s_try_increment_worker_ref_count_ = new_func; |
| 653 } | 662 } |
| 654 | 663 |
| 655 } // namespace content | 664 } // namespace content |
| OLD | NEW |