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 727 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
752 } | 753 } |
753 | 754 |
754 void ServiceWorkerStorage::OnDiskCacheInitialized(int rv) { | 755 void ServiceWorkerStorage::OnDiskCacheInitialized(int rv) { |
755 if (rv != net::OK) { | 756 if (rv != net::OK) { |
756 LOG(ERROR) << "Failed to open the serviceworker diskcache: " | 757 LOG(ERROR) << "Failed to open the serviceworker diskcache: " |
757 << net::ErrorToString(rv); | 758 << net::ErrorToString(rv); |
758 // TODO(michaeln): DeleteAndStartOver() | 759 // TODO(michaeln): DeleteAndStartOver() |
759 disk_cache_->Disable(); | 760 disk_cache_->Disable(); |
760 state_ = DISABLED; | 761 state_ = DISABLED; |
761 } | 762 } |
| 763 ServiceWorkerHistograms::CountInitDiskCacheResult(rv == net::OK); |
762 } | 764 } |
763 | 765 |
764 void ServiceWorkerStorage::StartPurgingResources( | 766 void ServiceWorkerStorage::StartPurgingResources( |
765 const std::vector<int64>& ids) { | 767 const std::vector<int64>& ids) { |
766 for (size_t i = 0; i < ids.size(); ++i) | 768 for (size_t i = 0; i < ids.size(); ++i) |
767 purgeable_reource_ids_.push_back(ids[i]); | 769 purgeable_reource_ids_.push_back(ids[i]); |
768 ContinuePurgingResources(); | 770 ContinuePurgingResources(); |
769 } | 771 } |
770 | 772 |
771 void ServiceWorkerStorage::StartPurgingResources( | 773 void ServiceWorkerStorage::StartPurgingResources( |
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
969 const FindInDBCallback& callback) { | 971 const FindInDBCallback& callback) { |
970 ServiceWorkerDatabase::RegistrationData data; | 972 ServiceWorkerDatabase::RegistrationData data; |
971 ResourceList resources; | 973 ResourceList resources; |
972 ServiceWorkerDatabase::Status status = | 974 ServiceWorkerDatabase::Status status = |
973 database->ReadRegistration(registration_id, origin, &data, &resources); | 975 database->ReadRegistration(registration_id, origin, &data, &resources); |
974 original_task_runner->PostTask( | 976 original_task_runner->PostTask( |
975 FROM_HERE, base::Bind(callback, data, resources, status)); | 977 FROM_HERE, base::Bind(callback, data, resources, status)); |
976 } | 978 } |
977 | 979 |
978 } // namespace content | 980 } // namespace content |
OLD | NEW |