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