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 a730ed1b2bdbc9a9ca94689d879b71f41e3abad7..246d9947f9083c3e1df5e3358b83b1d61f30c89d 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)); |
} |
@@ -807,6 +807,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, |
@@ -837,6 +841,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; |