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 | |
458 blink::WebWorkerCreationError | 449 blink::WebWorkerCreationError |
459 SharedWorkerServiceImpl::ReserveRenderProcessToCreateWorker( | 450 SharedWorkerServiceImpl::ReserveRenderProcessToCreateWorker( |
460 std::unique_ptr<SharedWorkerPendingInstance> pending_instance) { | 451 std::unique_ptr<SharedWorkerPendingInstance> pending_instance) { |
461 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 452 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
462 DCHECK(!FindPendingInstance(*pending_instance->instance())); | 453 DCHECK(!FindPendingInstance(*pending_instance->instance())); |
463 if (!pending_instance->requests()->size()) | 454 if (!pending_instance->requests()->size()) |
464 return blink::WebWorkerCreationErrorNone; | 455 return blink::WebWorkerCreationErrorNone; |
465 | 456 |
466 int worker_process_id = -1; | 457 int worker_process_id = -1; |
467 int worker_route_id = MSG_ROUTING_NONE; | 458 int worker_route_id = MSG_ROUTING_NONE; |
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
655 UpdateWorkerDependencyFunc new_func) { | 646 UpdateWorkerDependencyFunc new_func) { |
656 update_worker_dependency_ = new_func; | 647 update_worker_dependency_ = new_func; |
657 } | 648 } |
658 | 649 |
659 void SharedWorkerServiceImpl::ChangeTryIncrementWorkerRefCountFuncForTesting( | 650 void SharedWorkerServiceImpl::ChangeTryIncrementWorkerRefCountFuncForTesting( |
660 bool (*new_func)(int)) { | 651 bool (*new_func)(int)) { |
661 s_try_increment_worker_ref_count_ = new_func; | 652 s_try_increment_worker_ref_count_ = new_func; |
662 } | 653 } |
663 | 654 |
664 } // namespace content | 655 } // namespace content |
OLD | NEW |