OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/service_worker/service_worker_context_core.h" | 5 #include "content/browser/service_worker/service_worker_context_core.h" |
6 | 6 |
7 #include "base/barrier_closure.h" | 7 #include "base/barrier_closure.h" |
8 #include "base/bind.h" | 8 #include "base/bind.h" |
9 #include "base/bind_helpers.h" | 9 #include "base/bind_helpers.h" |
10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
(...skipping 419 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
430 std::vector<ServiceWorkerVersionInfo> infos; | 430 std::vector<ServiceWorkerVersionInfo> infos; |
431 for (std::map<int64, ServiceWorkerVersion*>::const_iterator iter = | 431 for (std::map<int64, ServiceWorkerVersion*>::const_iterator iter = |
432 live_versions_.begin(); | 432 live_versions_.begin(); |
433 iter != live_versions_.end(); | 433 iter != live_versions_.end(); |
434 ++iter) { | 434 ++iter) { |
435 infos.push_back(iter->second->GetInfo()); | 435 infos.push_back(iter->second->GetInfo()); |
436 } | 436 } |
437 return infos; | 437 return infos; |
438 } | 438 } |
439 | 439 |
| 440 void ServiceWorkerContextCore::ProtectVersion( |
| 441 const scoped_refptr<ServiceWorkerVersion>& version) { |
| 442 DCHECK(protected_versions_.find(version->version_id()) == |
| 443 protected_versions_.end()); |
| 444 protected_versions_[version->version_id()] = version; |
| 445 } |
| 446 |
| 447 void ServiceWorkerContextCore::UnprotectVersion(int64 version_id) { |
| 448 DCHECK(protected_versions_.find(version_id) != protected_versions_.end()); |
| 449 protected_versions_.erase(version_id); |
| 450 } |
| 451 |
440 int ServiceWorkerContextCore::GetNewServiceWorkerHandleId() { | 452 int ServiceWorkerContextCore::GetNewServiceWorkerHandleId() { |
441 return next_handle_id_++; | 453 return next_handle_id_++; |
442 } | 454 } |
443 | 455 |
444 int ServiceWorkerContextCore::GetNewRegistrationHandleId() { | 456 int ServiceWorkerContextCore::GetNewRegistrationHandleId() { |
445 return next_registration_handle_id_++; | 457 return next_registration_handle_id_++; |
446 } | 458 } |
447 | 459 |
448 void ServiceWorkerContextCore::ScheduleDeleteAndStartOver() const { | 460 void ServiceWorkerContextCore::ScheduleDeleteAndStartOver() const { |
449 storage_->Disable(); | 461 storage_->Disable(); |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
575 observer_list_->Notify(FROM_HERE, | 587 observer_list_->Notify(FROM_HERE, |
576 &ServiceWorkerContextObserver::OnControlleeRemoved, | 588 &ServiceWorkerContextObserver::OnControlleeRemoved, |
577 version->version_id(), provider_host->client_uuid()); | 589 version->version_id(), provider_host->client_uuid()); |
578 } | 590 } |
579 | 591 |
580 ServiceWorkerProcessManager* ServiceWorkerContextCore::process_manager() { | 592 ServiceWorkerProcessManager* ServiceWorkerContextCore::process_manager() { |
581 return wrapper_->process_manager(); | 593 return wrapper_->process_manager(); |
582 } | 594 } |
583 | 595 |
584 } // namespace content | 596 } // namespace content |
OLD | NEW |