Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(232)

Unified Diff: content/browser/service_worker/service_worker_cache_listener.cc

Issue 549493002: Expose ServiceWorkerCache objects to ServiceWorkerCacheStorageManager clients. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@refptr3
Patch Set: Fix after rebase Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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));
}

Powered by Google App Engine
This is Rietveld 408576698