| 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 329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 340 SharedWorkerMessageFilter* filter, | 340 SharedWorkerMessageFilter* filter, |
| 341 unsigned long long document_id) { | 341 unsigned long long document_id) { |
| 342 ScopedWorkerDependencyChecker checker(this); | 342 ScopedWorkerDependencyChecker checker(this); |
| 343 for (WorkerHostMap::const_iterator iter = worker_hosts_.begin(); | 343 for (WorkerHostMap::const_iterator iter = worker_hosts_.begin(); |
| 344 iter != worker_hosts_.end(); | 344 iter != worker_hosts_.end(); |
| 345 ++iter) { | 345 ++iter) { |
| 346 iter->second->DocumentDetached(filter, document_id); | 346 iter->second->DocumentDetached(filter, document_id); |
| 347 } | 347 } |
| 348 } | 348 } |
| 349 | 349 |
| 350 void SharedWorkerServiceImpl::CountFeature(SharedWorkerMessageFilter* filter, |
| 351 int worker_route_id, |
| 352 uint32_t feature) { |
| 353 if (SharedWorkerHost* host = |
| 354 FindSharedWorkerHost(filter->render_process_id(), worker_route_id)) { |
| 355 host->CountFeature(feature); |
| 356 } |
| 357 } |
| 358 |
| 350 void SharedWorkerServiceImpl::WorkerContextClosed( | 359 void SharedWorkerServiceImpl::WorkerContextClosed( |
| 351 SharedWorkerMessageFilter* filter, | 360 SharedWorkerMessageFilter* filter, |
| 352 int worker_route_id) { | 361 int worker_route_id) { |
| 353 ScopedWorkerDependencyChecker checker(this); | 362 ScopedWorkerDependencyChecker checker(this); |
| 354 if (SharedWorkerHost* host = | 363 if (SharedWorkerHost* host = |
| 355 FindSharedWorkerHost(filter->render_process_id(), worker_route_id)) | 364 FindSharedWorkerHost(filter->render_process_id(), worker_route_id)) |
| 356 host->WorkerContextClosed(); | 365 host->WorkerContextClosed(); |
| 357 } | 366 } |
| 358 | 367 |
| 359 void SharedWorkerServiceImpl::WorkerContextDestroyed( | 368 void SharedWorkerServiceImpl::WorkerContextDestroyed( |
| 360 SharedWorkerMessageFilter* filter, | 369 SharedWorkerMessageFilter* filter, |
| 361 int worker_route_id) { | 370 int worker_route_id) { |
| 362 ScopedWorkerDependencyChecker checker(this); | 371 ScopedWorkerDependencyChecker checker(this); |
| 372 if (SharedWorkerHost* host = |
| 373 FindSharedWorkerHost(filter->render_process_id(), worker_route_id)) { |
| 374 host->WorkerContextDestroyed(); |
| 375 } |
| 363 ProcessRouteIdPair key(filter->render_process_id(), worker_route_id); | 376 ProcessRouteIdPair key(filter->render_process_id(), worker_route_id); |
| 364 worker_hosts_.erase(key); | 377 worker_hosts_.erase(key); |
| 365 } | 378 } |
| 366 | 379 |
| 367 void SharedWorkerServiceImpl::WorkerReadyForInspection( | 380 void SharedWorkerServiceImpl::WorkerReadyForInspection( |
| 368 SharedWorkerMessageFilter* filter, | 381 SharedWorkerMessageFilter* filter, |
| 369 int worker_route_id) { | 382 int worker_route_id) { |
| 370 if (SharedWorkerHost* host = | 383 if (SharedWorkerHost* host = |
| 371 FindSharedWorkerHost(filter->render_process_id(), worker_route_id)) | 384 FindSharedWorkerHost(filter->render_process_id(), worker_route_id)) |
| 372 host->WorkerReadyForInspection(); | 385 host->WorkerReadyForInspection(); |
| (...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 666 UpdateWorkerDependencyFunc new_func) { | 679 UpdateWorkerDependencyFunc new_func) { |
| 667 update_worker_dependency_ = new_func; | 680 update_worker_dependency_ = new_func; |
| 668 } | 681 } |
| 669 | 682 |
| 670 void SharedWorkerServiceImpl::ChangeTryIncrementWorkerRefCountFuncForTesting( | 683 void SharedWorkerServiceImpl::ChangeTryIncrementWorkerRefCountFuncForTesting( |
| 671 bool (*new_func)(int)) { | 684 bool (*new_func)(int)) { |
| 672 s_try_increment_worker_ref_count_ = new_func; | 685 s_try_increment_worker_ref_count_ = new_func; |
| 673 } | 686 } |
| 674 | 687 |
| 675 } // namespace content | 688 } // namespace content |
| OLD | NEW |