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 456 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
467 } | 467 } |
468 } | 468 } |
469 | 469 |
470 void SharedWorkerServiceImpl::NotifyWorkerDestroyed(int worker_process_id, | 470 void SharedWorkerServiceImpl::NotifyWorkerDestroyed(int worker_process_id, |
471 int worker_route_id) { | 471 int worker_route_id) { |
472 FOR_EACH_OBSERVER(WorkerServiceObserver, | 472 FOR_EACH_OBSERVER(WorkerServiceObserver, |
473 observers_, | 473 observers_, |
474 WorkerDestroyed(worker_process_id, worker_route_id)); | 474 WorkerDestroyed(worker_process_id, worker_route_id)); |
475 } | 475 } |
476 | 476 |
477 // TODO(alokp): Remove after collecting crash data. | |
478 // Temporary checks to verify that all shared workers are terminated. | |
479 // It is suspected that shared workers prevent render process hosts | |
480 // from shutting down: crbug.com/608049 | |
481 void SharedWorkerServiceImpl::CheckAllWorkersTerminated() { | |
482 std::set<int> dependent_renderers = GetRenderersWithWorkerDependency(); | |
483 CHECK_EQ(0u, dependent_renderers.size()); | |
484 } | |
485 | |
486 blink::WebWorkerCreationError | 477 blink::WebWorkerCreationError |
487 SharedWorkerServiceImpl::ReserveRenderProcessToCreateWorker( | 478 SharedWorkerServiceImpl::ReserveRenderProcessToCreateWorker( |
488 std::unique_ptr<SharedWorkerPendingInstance> pending_instance) { | 479 std::unique_ptr<SharedWorkerPendingInstance> pending_instance) { |
489 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 480 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
490 DCHECK(!FindPendingInstance(*pending_instance->instance())); | 481 DCHECK(!FindPendingInstance(*pending_instance->instance())); |
491 if (!pending_instance->requests()->size()) | 482 if (!pending_instance->requests()->size()) |
492 return blink::WebWorkerCreationErrorNone; | 483 return blink::WebWorkerCreationErrorNone; |
493 | 484 |
494 int worker_process_id = -1; | 485 int worker_process_id = -1; |
495 int worker_route_id = MSG_ROUTING_NONE; | 486 int worker_route_id = MSG_ROUTING_NONE; |
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
683 UpdateWorkerDependencyFunc new_func) { | 674 UpdateWorkerDependencyFunc new_func) { |
684 update_worker_dependency_ = new_func; | 675 update_worker_dependency_ = new_func; |
685 } | 676 } |
686 | 677 |
687 void SharedWorkerServiceImpl::ChangeTryIncrementWorkerRefCountFuncForTesting( | 678 void SharedWorkerServiceImpl::ChangeTryIncrementWorkerRefCountFuncForTesting( |
688 bool (*new_func)(int)) { | 679 bool (*new_func)(int)) { |
689 s_try_increment_worker_ref_count_ = new_func; | 680 s_try_increment_worker_ref_count_ = new_func; |
690 } | 681 } |
691 | 682 |
692 } // namespace content | 683 } // namespace content |
OLD | NEW |