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

Unified Diff: content/browser/cache_storage/cache_storage_dispatcher_host.cc

Issue 2040373006: Revert of [CacheStorage] Clean up CacheStorageCache lifetimes (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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/cache_storage/cache_storage_dispatcher_host.cc
diff --git a/content/browser/cache_storage/cache_storage_dispatcher_host.cc b/content/browser/cache_storage/cache_storage_dispatcher_host.cc
index de5741cd66fc28209d9467afc30c64cb4e176953..a12c93d6b6c898c8fb2aaeeec885d40d9b379e6d 100644
--- a/content/browser/cache_storage/cache_storage_dispatcher_host.cc
+++ b/content/browser/cache_storage/cache_storage_dispatcher_host.cc
@@ -227,11 +227,9 @@
new ServiceWorkerFetchRequest(request.url, request.method,
request.headers, request.referrer,
request.is_reload));
-
- cache->Match(
- std::move(scoped_request),
- base::Bind(&CacheStorageDispatcherHost::OnCacheMatchCallback, this,
- thread_id, request_id, StoreCacheReference(cache)));
+ cache->Match(std::move(scoped_request),
+ base::Bind(&CacheStorageDispatcherHost::OnCacheMatchCallback,
+ this, thread_id, request_id, cache));
}
void CacheStorageDispatcherHost::OnCacheMatchAll(
@@ -252,7 +250,7 @@
cache->MatchAll(
std::unique_ptr<ServiceWorkerFetchRequest>(), match_params,
base::Bind(&CacheStorageDispatcherHost::OnCacheMatchAllCallback, this,
- thread_id, request_id, StoreCacheReference(cache)));
+ thread_id, request_id, cache));
return;
}
@@ -264,13 +262,13 @@
cache->MatchAll(
std::move(scoped_request), match_params,
base::Bind(&CacheStorageDispatcherHost::OnCacheMatchAllCallback, this,
- thread_id, request_id, StoreCacheReference(cache)));
+ thread_id, request_id, cache));
return;
}
cache->Match(
std::move(scoped_request),
base::Bind(&CacheStorageDispatcherHost::OnCacheMatchAllCallbackAdapter,
- this, thread_id, request_id, StoreCacheReference(cache)));
+ this, thread_id, request_id, cache));
}
void CacheStorageDispatcherHost::OnCacheKeys(
@@ -289,7 +287,7 @@
scoped_refptr<CacheStorageCache> cache = it->second;
cache->Keys(base::Bind(&CacheStorageDispatcherHost::OnCacheKeysCallback, this,
- thread_id, request_id, StoreCacheReference(cache)));
+ thread_id, request_id, cache));
}
void CacheStorageDispatcherHost::OnCacheBatch(
@@ -305,9 +303,8 @@
}
scoped_refptr<CacheStorageCache> cache = it->second;
cache->BatchOperation(
- operations,
- base::Bind(&CacheStorageDispatcherHost::OnCacheBatchCallback, this,
- thread_id, request_id, StoreCacheReference(cache)));
+ operations, base::Bind(&CacheStorageDispatcherHost::OnCacheBatchCallback,
+ this, thread_id, request_id, cache));
}
void CacheStorageDispatcherHost::OnCacheClosed(int cache_id) {
@@ -405,11 +402,10 @@
void CacheStorageDispatcherHost::OnCacheMatchCallback(
int thread_id,
int request_id,
- CacheID cache_id,
+ scoped_refptr<CacheStorageCache> cache,
CacheStorageError error,
std::unique_ptr<ServiceWorkerResponse> response,
std::unique_ptr<storage::BlobDataHandle> blob_data_handle) {
- DropCacheReference(cache_id);
if (error != CACHE_STORAGE_OK) {
Send(new CacheStorageMsg_CacheMatchError(
thread_id, request_id, ToWebServiceWorkerCacheError(error)));
@@ -425,7 +421,7 @@
void CacheStorageDispatcherHost::OnCacheMatchAllCallbackAdapter(
int thread_id,
int request_id,
- CacheID cache_id,
+ scoped_refptr<CacheStorageCache> cache,
CacheStorageError error,
std::unique_ptr<ServiceWorkerResponse> response,
std::unique_ptr<storage::BlobDataHandle> blob_data_handle) {
@@ -439,18 +435,17 @@
if (blob_data_handle)
blob_data_handles->push_back(*blob_data_handle);
}
- OnCacheMatchAllCallback(thread_id, request_id, cache_id, error,
+ OnCacheMatchAllCallback(thread_id, request_id, std::move(cache), error,
std::move(responses), std::move(blob_data_handles));
}
void CacheStorageDispatcherHost::OnCacheMatchAllCallback(
int thread_id,
int request_id,
- CacheID cache_id,
+ scoped_refptr<CacheStorageCache> cache,
CacheStorageError error,
std::unique_ptr<CacheStorageCache::Responses> responses,
std::unique_ptr<CacheStorageCache::BlobDataHandles> blob_data_handles) {
- DropCacheReference(cache_id);
if (error != CACHE_STORAGE_OK && error != CACHE_STORAGE_ERROR_NOT_FOUND) {
Send(new CacheStorageMsg_CacheMatchAllError(
thread_id, request_id, ToWebServiceWorkerCacheError(error)));
@@ -467,10 +462,9 @@
void CacheStorageDispatcherHost::OnCacheKeysCallback(
int thread_id,
int request_id,
- CacheID cache_id,
+ scoped_refptr<CacheStorageCache> cache,
CacheStorageError error,
std::unique_ptr<CacheStorageCache::Requests> requests) {
- DropCacheReference(cache_id);
if (error != CACHE_STORAGE_OK) {
Send(new CacheStorageMsg_CacheKeysError(
thread_id, request_id, ToWebServiceWorkerCacheError(error)));
@@ -489,11 +483,11 @@
Send(new CacheStorageMsg_CacheKeysSuccess(thread_id, request_id, out));
}
-void CacheStorageDispatcherHost::OnCacheBatchCallback(int thread_id,
- int request_id,
- CacheID cache_id,
- CacheStorageError error) {
- DropCacheReference(cache_id);
+void CacheStorageDispatcherHost::OnCacheBatchCallback(
+ int thread_id,
+ int request_id,
+ scoped_refptr<CacheStorageCache> cache,
+ CacheStorageError error) {
if (error != CACHE_STORAGE_OK) {
Send(new CacheStorageMsg_CacheBatchError(
thread_id, request_id, ToWebServiceWorkerCacheError(error)));
« no previous file with comments | « content/browser/cache_storage/cache_storage_dispatcher_host.h ('k') | content/browser/renderer_host/render_message_filter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698