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_storage.h" | 5 #include "content/browser/service_worker/service_worker_storage.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/bind_helpers.h" | 9 #include "base/bind_helpers.h" |
10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
11 #include "base/sequenced_task_runner.h" | 11 #include "base/sequenced_task_runner.h" |
12 #include "base/task_runner_util.h" | 12 #include "base/task_runner_util.h" |
13 #include "content/browser/service_worker/service_worker_context_core.h" | 13 #include "content/browser/service_worker/service_worker_context_core.h" |
14 #include "content/browser/service_worker/service_worker_disk_cache.h" | 14 #include "content/browser/service_worker/service_worker_disk_cache.h" |
| 15 #include "content/browser/service_worker/service_worker_histograms.h" |
15 #include "content/browser/service_worker/service_worker_info.h" | 16 #include "content/browser/service_worker/service_worker_info.h" |
16 #include "content/browser/service_worker/service_worker_registration.h" | 17 #include "content/browser/service_worker/service_worker_registration.h" |
17 #include "content/browser/service_worker/service_worker_utils.h" | 18 #include "content/browser/service_worker/service_worker_utils.h" |
18 #include "content/browser/service_worker/service_worker_version.h" | 19 #include "content/browser/service_worker/service_worker_version.h" |
19 #include "content/common/service_worker/service_worker_types.h" | 20 #include "content/common/service_worker/service_worker_types.h" |
20 #include "content/public/browser/browser_thread.h" | 21 #include "content/public/browser/browser_thread.h" |
21 #include "net/base/net_errors.h" | 22 #include "net/base/net_errors.h" |
22 #include "webkit/browser/quota/quota_manager_proxy.h" | 23 #include "webkit/browser/quota/quota_manager_proxy.h" |
23 | 24 |
24 namespace content { | 25 namespace content { |
(...skipping 721 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
746 } | 747 } |
747 | 748 |
748 void ServiceWorkerStorage::OnDiskCacheInitialized(int rv) { | 749 void ServiceWorkerStorage::OnDiskCacheInitialized(int rv) { |
749 if (rv != net::OK) { | 750 if (rv != net::OK) { |
750 LOG(ERROR) << "Failed to open the serviceworker diskcache: " | 751 LOG(ERROR) << "Failed to open the serviceworker diskcache: " |
751 << net::ErrorToString(rv); | 752 << net::ErrorToString(rv); |
752 // TODO(michaeln): DeleteAndStartOver() | 753 // TODO(michaeln): DeleteAndStartOver() |
753 disk_cache_->Disable(); | 754 disk_cache_->Disable(); |
754 state_ = DISABLED; | 755 state_ = DISABLED; |
755 } | 756 } |
| 757 ServiceWorkerHistograms::CountInitDiskCacheResult(rv == net::OK); |
756 } | 758 } |
757 | 759 |
758 void ServiceWorkerStorage::StartPurgingResources( | 760 void ServiceWorkerStorage::StartPurgingResources( |
759 const std::vector<int64>& ids) { | 761 const std::vector<int64>& ids) { |
760 for (size_t i = 0; i < ids.size(); ++i) | 762 for (size_t i = 0; i < ids.size(); ++i) |
761 purgeable_reource_ids_.push_back(ids[i]); | 763 purgeable_reource_ids_.push_back(ids[i]); |
762 ContinuePurgingResources(); | 764 ContinuePurgingResources(); |
763 } | 765 } |
764 | 766 |
765 void ServiceWorkerStorage::StartPurgingResources( | 767 void ServiceWorkerStorage::StartPurgingResources( |
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
963 const FindInDBCallback& callback) { | 965 const FindInDBCallback& callback) { |
964 ServiceWorkerDatabase::RegistrationData data; | 966 ServiceWorkerDatabase::RegistrationData data; |
965 ResourceList resources; | 967 ResourceList resources; |
966 ServiceWorkerDatabase::Status status = | 968 ServiceWorkerDatabase::Status status = |
967 database->ReadRegistration(registration_id, origin, &data, &resources); | 969 database->ReadRegistration(registration_id, origin, &data, &resources); |
968 original_task_runner->PostTask( | 970 original_task_runner->PostTask( |
969 FROM_HERE, base::Bind(callback, data, resources, status)); | 971 FROM_HERE, base::Bind(callback, data, resources, status)); |
970 } | 972 } |
971 | 973 |
972 } // namespace content | 974 } // namespace content |
OLD | NEW |