| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_cache_storage.h" | 5 #include "content/browser/service_worker/service_worker_cache_storage.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
| 10 #include "base/files/memory_mapped_file.h" | 10 #include "base/files/memory_mapped_file.h" |
| (...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 376 const base::FilePath& path, | 376 const base::FilePath& path, |
| 377 bool memory_only, | 377 bool memory_only, |
| 378 base::SequencedTaskRunner* cache_task_runner, | 378 base::SequencedTaskRunner* cache_task_runner, |
| 379 net::URLRequestContext* request_context, | 379 net::URLRequestContext* request_context, |
| 380 base::WeakPtr<storage::BlobStorageContext> blob_context) | 380 base::WeakPtr<storage::BlobStorageContext> blob_context) |
| 381 : initialized_(false), | 381 : initialized_(false), |
| 382 origin_path_(path), | 382 origin_path_(path), |
| 383 cache_task_runner_(cache_task_runner), | 383 cache_task_runner_(cache_task_runner), |
| 384 weak_factory_(this) { | 384 weak_factory_(this) { |
| 385 if (memory_only) | 385 if (memory_only) |
| 386 cache_loader_ = | 386 cache_loader_ = new MemoryLoader( |
| 387 new MemoryLoader(cache_task_runner_, request_context, blob_context); | 387 cache_task_runner_.get(), request_context, blob_context); |
| 388 else | 388 else |
| 389 cache_loader_ = new SimpleCacheLoader( | 389 cache_loader_ = new SimpleCacheLoader( |
| 390 origin_path_, cache_task_runner_, request_context, blob_context); | 390 origin_path_, cache_task_runner_.get(), request_context, blob_context); |
| 391 } | 391 } |
| 392 | 392 |
| 393 ServiceWorkerCacheStorage::~ServiceWorkerCacheStorage() { | 393 ServiceWorkerCacheStorage::~ServiceWorkerCacheStorage() { |
| 394 } | 394 } |
| 395 | 395 |
| 396 void ServiceWorkerCacheStorage::CreateCache( | 396 void ServiceWorkerCacheStorage::CreateCache( |
| 397 const std::string& cache_name, | 397 const std::string& cache_name, |
| 398 const CacheAndErrorCallback& callback) { | 398 const CacheAndErrorCallback& callback) { |
| 399 if (!initialized_) { | 399 if (!initialized_) { |
| 400 LazyInit(base::Bind(&ServiceWorkerCacheStorage::CreateCache, | 400 LazyInit(base::Bind(&ServiceWorkerCacheStorage::CreateCache, |
| (...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 707 NameMap::const_iterator it = name_map_.find(cache_name); | 707 NameMap::const_iterator it = name_map_.find(cache_name); |
| 708 if (it == name_map_.end()) | 708 if (it == name_map_.end()) |
| 709 return NULL; | 709 return NULL; |
| 710 | 710 |
| 711 ServiceWorkerCache* cache = cache_map_.Lookup(it->second); | 711 ServiceWorkerCache* cache = cache_map_.Lookup(it->second); |
| 712 DCHECK(cache); | 712 DCHECK(cache); |
| 713 return cache; | 713 return cache; |
| 714 } | 714 } |
| 715 | 715 |
| 716 } // namespace content | 716 } // namespace content |
| OLD | NEW |