| 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 "base/bind_helpers.h" | 7 #include "base/bind_helpers.h" |
| 8 #include "base/files/file_util.h" | 8 #include "base/files/file_util.h" |
| 9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
| 10 #include "base/sequenced_task_runner.h" | 10 #include "base/sequenced_task_runner.h" |
| (...skipping 1353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1364 installing_registrations_.find(registration_id); | 1364 installing_registrations_.find(registration_id); |
| 1365 if (found == installing_registrations_.end()) | 1365 if (found == installing_registrations_.end()) |
| 1366 return NULL; | 1366 return NULL; |
| 1367 return found->second.get(); | 1367 return found->second.get(); |
| 1368 } | 1368 } |
| 1369 | 1369 |
| 1370 ServiceWorkerDiskCache* ServiceWorkerStorage::disk_cache() { | 1370 ServiceWorkerDiskCache* ServiceWorkerStorage::disk_cache() { |
| 1371 if (disk_cache_) | 1371 if (disk_cache_) |
| 1372 return disk_cache_.get(); | 1372 return disk_cache_.get(); |
| 1373 | 1373 |
| 1374 disk_cache_.reset(new ServiceWorkerDiskCache); | 1374 disk_cache_ = ServiceWorkerDiskCache::CreateWithBlockFileBackend(); |
| 1375 | 1375 |
| 1376 base::FilePath path = GetDiskCachePath(); | 1376 base::FilePath path = GetDiskCachePath(); |
| 1377 if (path.empty()) { | 1377 if (path.empty()) { |
| 1378 int rv = disk_cache_->InitWithMemBackend(kMaxMemDiskCacheSize, | 1378 int rv = disk_cache_->InitWithMemBackend(kMaxMemDiskCacheSize, |
| 1379 net::CompletionCallback()); | 1379 net::CompletionCallback()); |
| 1380 DCHECK_EQ(net::OK, rv); | 1380 DCHECK_EQ(net::OK, rv); |
| 1381 return disk_cache_.get(); | 1381 return disk_cache_.get(); |
| 1382 } | 1382 } |
| 1383 | 1383 |
| 1384 int rv = disk_cache_->InitWithDiskBackend( | 1384 int rv = disk_cache_->InitWithDiskBackend( |
| (...skipping 426 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1811 callback.Run(SERVICE_WORKER_ERROR_FAILED); | 1811 callback.Run(SERVICE_WORKER_ERROR_FAILED); |
| 1812 return; | 1812 return; |
| 1813 } | 1813 } |
| 1814 DVLOG(1) << "Deleted ServiceWorkerDiskCache successfully."; | 1814 DVLOG(1) << "Deleted ServiceWorkerDiskCache successfully."; |
| 1815 ServiceWorkerMetrics::RecordDeleteAndStartOverResult( | 1815 ServiceWorkerMetrics::RecordDeleteAndStartOverResult( |
| 1816 ServiceWorkerMetrics::DELETE_OK); | 1816 ServiceWorkerMetrics::DELETE_OK); |
| 1817 callback.Run(SERVICE_WORKER_OK); | 1817 callback.Run(SERVICE_WORKER_OK); |
| 1818 } | 1818 } |
| 1819 | 1819 |
| 1820 } // namespace content | 1820 } // namespace content |
| OLD | NEW |