Index: content/browser/service_worker/service_worker_cache_listener.cc |
diff --git a/content/browser/service_worker/service_worker_cache_listener.cc b/content/browser/service_worker/service_worker_cache_listener.cc |
index a2e51db02cb2afd153b64b6f55a8fe613131d436..ea431721c0f33846b6cd75631bce6f846e0ff4a8 100644 |
--- a/content/browser/service_worker/service_worker_cache_listener.cc |
+++ b/content/browser/service_worker/service_worker_cache_listener.cc |
@@ -49,7 +49,10 @@ WebServiceWorkerCacheError ToWebServiceWorkerCacheError( |
ServiceWorkerCacheListener::ServiceWorkerCacheListener( |
ServiceWorkerVersion* version, |
base::WeakPtr<ServiceWorkerContextCore> context) |
- : version_(version), context_(context), weak_factory_(this) { |
+ : version_(version), |
+ context_(context), |
+ next_cache_id_(0), |
+ weak_factory_(this) { |
} |
ServiceWorkerCacheListener::~ServiceWorkerCacheListener() { |
@@ -143,13 +146,16 @@ void ServiceWorkerCacheListener::Send(const IPC::Message& message) { |
void ServiceWorkerCacheListener::OnCacheStorageGetCallback( |
int request_id, |
- int cache_id, |
+ const scoped_refptr<ServiceWorkerCache>& cache, |
ServiceWorkerCacheStorage::CacheStorageError error) { |
if (error != ServiceWorkerCacheStorage::CACHE_STORAGE_ERROR_NO_ERROR) { |
Send(ServiceWorkerMsg_CacheStorageGetError( |
request_id, ToWebServiceWorkerCacheError(error))); |
return; |
} |
+ |
+ CacheID cache_id = next_cache_id_++; |
+ cache_map_.insert(std::make_pair(cache_id, cache)); |
Send(ServiceWorkerMsg_CacheStorageGetSuccess(request_id, cache_id)); |
} |
@@ -173,13 +179,15 @@ void ServiceWorkerCacheListener::OnCacheStorageHasCallback( |
void ServiceWorkerCacheListener::OnCacheStorageCreateCallback( |
int request_id, |
- int cache_id, |
+ const scoped_refptr<ServiceWorkerCache>& cache, |
ServiceWorkerCacheStorage::CacheStorageError error) { |
if (error != ServiceWorkerCacheStorage::CACHE_STORAGE_ERROR_NO_ERROR) { |
Send(ServiceWorkerMsg_CacheStorageCreateError( |
request_id, ToWebServiceWorkerCacheError(error))); |
return; |
} |
+ CacheID cache_id = next_cache_id_++; |
+ cache_map_.insert(std::make_pair(cache_id, cache)); |
Send(ServiceWorkerMsg_CacheStorageCreateSuccess(request_id, cache_id)); |
} |