| 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 a12c93d6b6c898c8fb2aaeeec885d40d9b379e6d..de5741cd66fc28209d9467afc30c64cb4e176953 100644
|
| --- a/content/browser/cache_storage/cache_storage_dispatcher_host.cc
|
| +++ b/content/browser/cache_storage/cache_storage_dispatcher_host.cc
|
| @@ -227,9 +227,11 @@ void CacheStorageDispatcherHost::OnCacheMatch(
|
| 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, cache));
|
| +
|
| + cache->Match(
|
| + std::move(scoped_request),
|
| + base::Bind(&CacheStorageDispatcherHost::OnCacheMatchCallback, this,
|
| + thread_id, request_id, StoreCacheReference(cache)));
|
| }
|
|
|
| void CacheStorageDispatcherHost::OnCacheMatchAll(
|
| @@ -250,7 +252,7 @@ void CacheStorageDispatcherHost::OnCacheMatchAll(
|
| cache->MatchAll(
|
| std::unique_ptr<ServiceWorkerFetchRequest>(), match_params,
|
| base::Bind(&CacheStorageDispatcherHost::OnCacheMatchAllCallback, this,
|
| - thread_id, request_id, cache));
|
| + thread_id, request_id, StoreCacheReference(cache)));
|
| return;
|
| }
|
|
|
| @@ -262,13 +264,13 @@ void CacheStorageDispatcherHost::OnCacheMatchAll(
|
| cache->MatchAll(
|
| std::move(scoped_request), match_params,
|
| base::Bind(&CacheStorageDispatcherHost::OnCacheMatchAllCallback, this,
|
| - thread_id, request_id, cache));
|
| + thread_id, request_id, StoreCacheReference(cache)));
|
| return;
|
| }
|
| cache->Match(
|
| std::move(scoped_request),
|
| base::Bind(&CacheStorageDispatcherHost::OnCacheMatchAllCallbackAdapter,
|
| - this, thread_id, request_id, cache));
|
| + this, thread_id, request_id, StoreCacheReference(cache)));
|
| }
|
|
|
| void CacheStorageDispatcherHost::OnCacheKeys(
|
| @@ -287,7 +289,7 @@ void CacheStorageDispatcherHost::OnCacheKeys(
|
| scoped_refptr<CacheStorageCache> cache = it->second;
|
|
|
| cache->Keys(base::Bind(&CacheStorageDispatcherHost::OnCacheKeysCallback, this,
|
| - thread_id, request_id, cache));
|
| + thread_id, request_id, StoreCacheReference(cache)));
|
| }
|
|
|
| void CacheStorageDispatcherHost::OnCacheBatch(
|
| @@ -303,8 +305,9 @@ void CacheStorageDispatcherHost::OnCacheBatch(
|
| }
|
| scoped_refptr<CacheStorageCache> cache = it->second;
|
| cache->BatchOperation(
|
| - operations, base::Bind(&CacheStorageDispatcherHost::OnCacheBatchCallback,
|
| - this, thread_id, request_id, cache));
|
| + operations,
|
| + base::Bind(&CacheStorageDispatcherHost::OnCacheBatchCallback, this,
|
| + thread_id, request_id, StoreCacheReference(cache)));
|
| }
|
|
|
| void CacheStorageDispatcherHost::OnCacheClosed(int cache_id) {
|
| @@ -402,10 +405,11 @@ void CacheStorageDispatcherHost::OnCacheStorageMatchCallback(
|
| void CacheStorageDispatcherHost::OnCacheMatchCallback(
|
| int thread_id,
|
| int request_id,
|
| - scoped_refptr<CacheStorageCache> cache,
|
| + CacheID cache_id,
|
| 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)));
|
| @@ -421,7 +425,7 @@ void CacheStorageDispatcherHost::OnCacheMatchCallback(
|
| void CacheStorageDispatcherHost::OnCacheMatchAllCallbackAdapter(
|
| int thread_id,
|
| int request_id,
|
| - scoped_refptr<CacheStorageCache> cache,
|
| + CacheID cache_id,
|
| CacheStorageError error,
|
| std::unique_ptr<ServiceWorkerResponse> response,
|
| std::unique_ptr<storage::BlobDataHandle> blob_data_handle) {
|
| @@ -435,17 +439,18 @@ void CacheStorageDispatcherHost::OnCacheMatchAllCallbackAdapter(
|
| if (blob_data_handle)
|
| blob_data_handles->push_back(*blob_data_handle);
|
| }
|
| - OnCacheMatchAllCallback(thread_id, request_id, std::move(cache), error,
|
| + OnCacheMatchAllCallback(thread_id, request_id, cache_id, error,
|
| std::move(responses), std::move(blob_data_handles));
|
| }
|
|
|
| void CacheStorageDispatcherHost::OnCacheMatchAllCallback(
|
| int thread_id,
|
| int request_id,
|
| - scoped_refptr<CacheStorageCache> cache,
|
| + CacheID cache_id,
|
| 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)));
|
| @@ -462,9 +467,10 @@ void CacheStorageDispatcherHost::OnCacheMatchAllCallback(
|
| void CacheStorageDispatcherHost::OnCacheKeysCallback(
|
| int thread_id,
|
| int request_id,
|
| - scoped_refptr<CacheStorageCache> cache,
|
| + CacheID cache_id,
|
| 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)));
|
| @@ -483,11 +489,11 @@ void CacheStorageDispatcherHost::OnCacheKeysCallback(
|
| Send(new CacheStorageMsg_CacheKeysSuccess(thread_id, request_id, out));
|
| }
|
|
|
| -void CacheStorageDispatcherHost::OnCacheBatchCallback(
|
| - int thread_id,
|
| - int request_id,
|
| - scoped_refptr<CacheStorageCache> cache,
|
| - CacheStorageError error) {
|
| +void CacheStorageDispatcherHost::OnCacheBatchCallback(int thread_id,
|
| + int request_id,
|
| + CacheID cache_id,
|
| + CacheStorageError error) {
|
| + DropCacheReference(cache_id);
|
| if (error != CACHE_STORAGE_OK) {
|
| Send(new CacheStorageMsg_CacheBatchError(
|
| thread_id, request_id, ToWebServiceWorkerCacheError(error)));
|
|
|