| 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" |
| (...skipping 676 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 687 base::Bind(&ServiceWorkerStorage::OnDiskCacheInitialized, | 687 base::Bind(&ServiceWorkerStorage::OnDiskCacheInitialized, |
| 688 weak_factory_.GetWeakPtr())); | 688 weak_factory_.GetWeakPtr())); |
| 689 if (rv != net::ERR_IO_PENDING) | 689 if (rv != net::ERR_IO_PENDING) |
| 690 OnDiskCacheInitialized(rv); | 690 OnDiskCacheInitialized(rv); |
| 691 | 691 |
| 692 return disk_cache_.get(); | 692 return disk_cache_.get(); |
| 693 } | 693 } |
| 694 | 694 |
| 695 void ServiceWorkerStorage::OnDiskCacheInitialized(int rv) { | 695 void ServiceWorkerStorage::OnDiskCacheInitialized(int rv) { |
| 696 if (rv != net::OK) { | 696 if (rv != net::OK) { |
| 697 LOG(ERROR) << "Failed to open the serviceworker diskcache."; | 697 LOG(ERROR) << "Failed to open the serviceworker diskcache: " |
| 698 << net::ErrorToString(rv); |
| 698 // TODO(michaeln): DeleteAndStartOver() | 699 // TODO(michaeln): DeleteAndStartOver() |
| 699 disk_cache_->Disable(); | 700 disk_cache_->Disable(); |
| 700 state_ = DISABLED; | 701 state_ = DISABLED; |
| 701 } | 702 } |
| 702 } | 703 } |
| 703 | 704 |
| 704 void ServiceWorkerStorage::StartPurgingResources( | 705 void ServiceWorkerStorage::StartPurgingResources( |
| 705 const std::vector<int64>& ids) { | 706 const std::vector<int64>& ids) { |
| 706 for (size_t i = 0; i < ids.size(); ++i) | 707 for (size_t i = 0; i < ids.size(); ++i) |
| 707 purgeable_reource_ids_.push_back(ids[i]); | 708 purgeable_reource_ids_.push_back(ids[i]); |
| (...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 900 const FindInDBCallback& callback) { | 901 const FindInDBCallback& callback) { |
| 901 ServiceWorkerDatabase::RegistrationData data; | 902 ServiceWorkerDatabase::RegistrationData data; |
| 902 ResourceList resources; | 903 ResourceList resources; |
| 903 ServiceWorkerDatabase::Status status = | 904 ServiceWorkerDatabase::Status status = |
| 904 database->ReadRegistration(registration_id, origin, &data, &resources); | 905 database->ReadRegistration(registration_id, origin, &data, &resources); |
| 905 original_task_runner->PostTask( | 906 original_task_runner->PostTask( |
| 906 FROM_HERE, base::Bind(callback, data, resources, status)); | 907 FROM_HERE, base::Bind(callback, data, resources, status)); |
| 907 } | 908 } |
| 908 | 909 |
| 909 } // namespace content | 910 } // namespace content |
| OLD | NEW |