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/file_util.h" | 10 #include "base/file_util.h" |
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
223 weak_factory_.InvalidateWeakPtrs(); | 223 weak_factory_.InvalidateWeakPtrs(); |
224 database_task_runner_->DeleteSoon(FROM_HERE, database_.release()); | 224 database_task_runner_->DeleteSoon(FROM_HERE, database_.release()); |
225 } | 225 } |
226 | 226 |
227 // static | 227 // static |
228 scoped_ptr<ServiceWorkerStorage> ServiceWorkerStorage::Create( | 228 scoped_ptr<ServiceWorkerStorage> ServiceWorkerStorage::Create( |
229 const base::FilePath& path, | 229 const base::FilePath& path, |
230 base::WeakPtr<ServiceWorkerContextCore> context, | 230 base::WeakPtr<ServiceWorkerContextCore> context, |
231 const scoped_refptr<base::SequencedTaskRunner>& database_task_runner, | 231 const scoped_refptr<base::SequencedTaskRunner>& database_task_runner, |
232 const scoped_refptr<base::SingleThreadTaskRunner>& disk_cache_thread, | 232 const scoped_refptr<base::SingleThreadTaskRunner>& disk_cache_thread, |
233 quota::QuotaManagerProxy* quota_manager_proxy) { | 233 storage::QuotaManagerProxy* quota_manager_proxy) { |
234 return make_scoped_ptr(new ServiceWorkerStorage(path, | 234 return make_scoped_ptr(new ServiceWorkerStorage(path, |
235 context, | 235 context, |
236 database_task_runner, | 236 database_task_runner, |
237 disk_cache_thread, | 237 disk_cache_thread, |
238 quota_manager_proxy)); | 238 quota_manager_proxy)); |
239 } | 239 } |
240 | 240 |
241 // static | 241 // static |
242 scoped_ptr<ServiceWorkerStorage> ServiceWorkerStorage::Create( | 242 scoped_ptr<ServiceWorkerStorage> ServiceWorkerStorage::Create( |
243 base::WeakPtr<ServiceWorkerContextCore> context, | 243 base::WeakPtr<ServiceWorkerContextCore> context, |
(...skipping 426 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
670 if (!has_checked_for_stale_resources_) | 670 if (!has_checked_for_stale_resources_) |
671 DeleteStaleResources(); | 671 DeleteStaleResources(); |
672 StartPurgingResources(resources); | 672 StartPurgingResources(resources); |
673 } | 673 } |
674 | 674 |
675 ServiceWorkerStorage::ServiceWorkerStorage( | 675 ServiceWorkerStorage::ServiceWorkerStorage( |
676 const base::FilePath& path, | 676 const base::FilePath& path, |
677 base::WeakPtr<ServiceWorkerContextCore> context, | 677 base::WeakPtr<ServiceWorkerContextCore> context, |
678 const scoped_refptr<base::SequencedTaskRunner>& database_task_runner, | 678 const scoped_refptr<base::SequencedTaskRunner>& database_task_runner, |
679 const scoped_refptr<base::SingleThreadTaskRunner>& disk_cache_thread, | 679 const scoped_refptr<base::SingleThreadTaskRunner>& disk_cache_thread, |
680 quota::QuotaManagerProxy* quota_manager_proxy) | 680 storage::QuotaManagerProxy* quota_manager_proxy) |
681 : next_registration_id_(kInvalidServiceWorkerRegistrationId), | 681 : next_registration_id_(kInvalidServiceWorkerRegistrationId), |
682 next_version_id_(kInvalidServiceWorkerVersionId), | 682 next_version_id_(kInvalidServiceWorkerVersionId), |
683 next_resource_id_(kInvalidServiceWorkerResourceId), | 683 next_resource_id_(kInvalidServiceWorkerResourceId), |
684 state_(UNINITIALIZED), | 684 state_(UNINITIALIZED), |
685 path_(path), | 685 path_(path), |
686 context_(context), | 686 context_(context), |
687 database_task_runner_(database_task_runner), | 687 database_task_runner_(database_task_runner), |
688 disk_cache_thread_(disk_cache_thread), | 688 disk_cache_thread_(disk_cache_thread), |
689 quota_manager_proxy_(quota_manager_proxy), | 689 quota_manager_proxy_(quota_manager_proxy), |
690 is_purge_pending_(false), | 690 is_purge_pending_(false), |
(...skipping 708 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1399 // Give up the corruption recovery until the browser restarts. | 1399 // Give up the corruption recovery until the browser restarts. |
1400 LOG(ERROR) << "Failed to delete the diskcache."; | 1400 LOG(ERROR) << "Failed to delete the diskcache."; |
1401 callback.Run(SERVICE_WORKER_ERROR_FAILED); | 1401 callback.Run(SERVICE_WORKER_ERROR_FAILED); |
1402 return; | 1402 return; |
1403 } | 1403 } |
1404 DVLOG(1) << "Deleted ServiceWorkerDiskCache successfully."; | 1404 DVLOG(1) << "Deleted ServiceWorkerDiskCache successfully."; |
1405 callback.Run(SERVICE_WORKER_OK); | 1405 callback.Run(SERVICE_WORKER_OK); |
1406 } | 1406 } |
1407 | 1407 |
1408 } // namespace content | 1408 } // namespace content |
OLD | NEW |