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 |
477 blink::WebWorkerCreationError | 486 blink::WebWorkerCreationError |
478 SharedWorkerServiceImpl::ReserveRenderProcessToCreateWorker( | 487 SharedWorkerServiceImpl::ReserveRenderProcessToCreateWorker( |
479 std::unique_ptr<SharedWorkerPendingInstance> pending_instance) { | 488 std::unique_ptr<SharedWorkerPendingInstance> pending_instance) { |
480 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 489 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
481 DCHECK(!FindPendingInstance(*pending_instance->instance())); | 490 DCHECK(!FindPendingInstance(*pending_instance->instance())); |
482 if (!pending_instance->requests()->size()) | 491 if (!pending_instance->requests()->size()) |
483 return blink::WebWorkerCreationErrorNone; | 492 return blink::WebWorkerCreationErrorNone; |
484 | 493 |
485 int worker_process_id = -1; | 494 int worker_process_id = -1; |
486 int worker_route_id = MSG_ROUTING_NONE; | 495 int worker_route_id = MSG_ROUTING_NONE; |
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
674 UpdateWorkerDependencyFunc new_func) { | 683 UpdateWorkerDependencyFunc new_func) { |
675 update_worker_dependency_ = new_func; | 684 update_worker_dependency_ = new_func; |
676 } | 685 } |
677 | 686 |
678 void SharedWorkerServiceImpl::ChangeTryIncrementWorkerRefCountFuncForTesting( | 687 void SharedWorkerServiceImpl::ChangeTryIncrementWorkerRefCountFuncForTesting( |
679 bool (*new_func)(int)) { | 688 bool (*new_func)(int)) { |
680 s_try_increment_worker_ref_count_ = new_func; | 689 s_try_increment_worker_ref_count_ = new_func; |
681 } | 690 } |
682 | 691 |
683 } // namespace content | 692 } // namespace content |
OLD | NEW |