| Index: content/browser/service_worker/service_worker_cache.cc
|
| diff --git a/content/browser/service_worker/service_worker_cache.cc b/content/browser/service_worker/service_worker_cache.cc
|
| index 2911b406d1bc0f4109f668ec0c77685ae94f94c1..2fb5216d8f19a7c1ccd4ea561e894b3648adc446 100644
|
| --- a/content/browser/service_worker/service_worker_cache.cc
|
| +++ b/content/browser/service_worker/service_worker_cache.cc
|
| @@ -605,7 +605,7 @@ struct ServiceWorkerCache::KeysContext {
|
| entries[i]->Close();
|
| if (enumerated_entry)
|
| enumerated_entry->Close();
|
| - if (cache && backend_iterator)
|
| + if (cache && backend_iterator && cache->backend_)
|
| cache->backend_->EndEnumeration(&backend_iterator);
|
| }
|
|
|
| @@ -627,19 +627,19 @@ struct ServiceWorkerCache::KeysContext {
|
| };
|
|
|
| // static
|
| -scoped_ptr<ServiceWorkerCache> ServiceWorkerCache::CreateMemoryCache(
|
| +scoped_refptr<ServiceWorkerCache> ServiceWorkerCache::CreateMemoryCache(
|
| net::URLRequestContext* request_context,
|
| base::WeakPtr<storage::BlobStorageContext> blob_context) {
|
| - return make_scoped_ptr(
|
| + return make_scoped_refptr(
|
| new ServiceWorkerCache(base::FilePath(), request_context, blob_context));
|
| }
|
|
|
| // static
|
| -scoped_ptr<ServiceWorkerCache> ServiceWorkerCache::CreatePersistentCache(
|
| +scoped_refptr<ServiceWorkerCache> ServiceWorkerCache::CreatePersistentCache(
|
| const base::FilePath& path,
|
| net::URLRequestContext* request_context,
|
| base::WeakPtr<storage::BlobStorageContext> blob_context) {
|
| - return make_scoped_ptr(
|
| + return make_scoped_refptr(
|
| new ServiceWorkerCache(path, request_context, blob_context));
|
| }
|
|
|
| @@ -787,6 +787,10 @@ void ServiceWorkerCache::Keys(const RequestsCallback& callback) {
|
| open_entry_callback.Run(rv);
|
| }
|
|
|
| +void ServiceWorkerCache::Close() {
|
| + backend_.reset();
|
| +}
|
| +
|
| ServiceWorkerCache::ServiceWorkerCache(
|
| const base::FilePath& path,
|
| net::URLRequestContext* request_context,
|
| @@ -849,6 +853,12 @@ void ServiceWorkerCache::KeysDidOpenNextEntry(
|
| return;
|
| }
|
|
|
| + if (!cache->backend_) {
|
| + keys_context->original_callback.Run(ErrorTypeNotFound,
|
| + scoped_ptr<Requests>());
|
| + return;
|
| + }
|
| +
|
| // Store the entry.
|
| keys_context->entries.push_back(keys_context->enumerated_entry);
|
| keys_context->enumerated_entry = NULL;
|
|
|