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

Unified Diff: content/renderer/cache_storage/cache_storage_dispatcher.cc

Issue 1152003008: CacheStorage: Pass an error object allocated on heap to WebCallbacks::onError (1) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/cache_storage/cache_storage_dispatcher.cc
diff --git a/content/renderer/cache_storage/cache_storage_dispatcher.cc b/content/renderer/cache_storage/cache_storage_dispatcher.cc
index da40cbf1ff861132a7c25a95eca5955eed1311c2..7eafde7702b6809c8b708115d03501d2c96d894b 100644
--- a/content/renderer/cache_storage/cache_storage_dispatcher.cc
+++ b/content/renderer/cache_storage/cache_storage_dispatcher.cc
@@ -126,9 +126,15 @@ template <typename T>
void ClearCallbacksMapWithErrors(T* callbacks_map) {
typename T::iterator iter(callbacks_map);
while (!iter.IsAtEnd()) {
+#ifdef CRBUG_494884
+ iter.GetCurrentValue()->onError(
+ new blink::WebServiceWorkerCacheError(
+ blink::WebServiceWorkerCacheErrorNotFound));
+#else
blink::WebServiceWorkerCacheError reason =
blink::WebServiceWorkerCacheErrorNotFound;
iter.GetCurrentValue()->onError(&reason);
+#endif
callbacks_map->Remove(iter.GetCurrentKey());
iter.Advance();
}
@@ -355,7 +361,11 @@ void CacheStorageDispatcher::OnCacheStorageHasError(
DCHECK_EQ(thread_id, CurrentWorkerId());
WebServiceWorkerCacheStorage::CacheStorageCallbacks* callbacks =
has_callbacks_.Lookup(request_id);
+#ifdef CRBUG_494884
+ callbacks->onError(new blink::WebServiceWorkerCacheError(reason));
+#else
callbacks->onError(&reason);
+#endif
has_callbacks_.Remove(request_id);
has_times_.erase(request_id);
}
@@ -367,7 +377,11 @@ void CacheStorageDispatcher::OnCacheStorageOpenError(
DCHECK_EQ(thread_id, CurrentWorkerId());
WebServiceWorkerCacheStorage::CacheStorageWithCacheCallbacks* callbacks =
open_callbacks_.Lookup(request_id);
+#ifdef CRBUG_494884
+ callbacks->onError(new blink::WebServiceWorkerCacheError(reason));
+#else
callbacks->onError(&reason);
+#endif
open_callbacks_.Remove(request_id);
open_times_.erase(request_id);
}
@@ -379,7 +393,11 @@ void CacheStorageDispatcher::OnCacheStorageDeleteError(
DCHECK_EQ(thread_id, CurrentWorkerId());
WebServiceWorkerCacheStorage::CacheStorageCallbacks* callbacks =
delete_callbacks_.Lookup(request_id);
+#ifdef CRBUG_494884
+ callbacks->onError(new blink::WebServiceWorkerCacheError(reason));
+#else
callbacks->onError(&reason);
+#endif
delete_callbacks_.Remove(request_id);
delete_times_.erase(request_id);
}
@@ -391,7 +409,11 @@ void CacheStorageDispatcher::OnCacheStorageKeysError(
DCHECK_EQ(thread_id, CurrentWorkerId());
WebServiceWorkerCacheStorage::CacheStorageKeysCallbacks* callbacks =
keys_callbacks_.Lookup(request_id);
+#ifdef CRBUG_494884
+ callbacks->onError(new blink::WebServiceWorkerCacheError(reason));
+#else
callbacks->onError(&reason);
+#endif
keys_callbacks_.Remove(request_id);
keys_times_.erase(request_id);
}
@@ -403,7 +425,11 @@ void CacheStorageDispatcher::OnCacheStorageMatchError(
DCHECK_EQ(thread_id, CurrentWorkerId());
WebServiceWorkerCacheStorage::CacheStorageMatchCallbacks* callbacks =
match_callbacks_.Lookup(request_id);
+#ifdef CRBUG_494884
+ callbacks->onError(new blink::WebServiceWorkerCacheError(reason));
+#else
callbacks->onError(&reason);
+#endif
match_callbacks_.Remove(request_id);
match_times_.erase(request_id);
}
@@ -480,7 +506,11 @@ void CacheStorageDispatcher::OnCacheMatchError(
DCHECK_EQ(thread_id, CurrentWorkerId());
blink::WebServiceWorkerCache::CacheMatchCallbacks* callbacks =
cache_match_callbacks_.Lookup(request_id);
+#ifdef CRBUG_494884
+ callbacks->onError(new blink::WebServiceWorkerCacheError(reason));
+#else
callbacks->onError(&reason);
+#endif
cache_match_callbacks_.Remove(request_id);
cache_match_times_.erase(request_id);
}
@@ -492,7 +522,11 @@ void CacheStorageDispatcher::OnCacheMatchAllError(
DCHECK_EQ(thread_id, CurrentWorkerId());
blink::WebServiceWorkerCache::CacheWithResponsesCallbacks* callbacks =
cache_match_all_callbacks_.Lookup(request_id);
+#ifdef CRBUG_494884
+ callbacks->onError(new blink::WebServiceWorkerCacheError(reason));
+#else
callbacks->onError(&reason);
+#endif
cache_match_all_callbacks_.Remove(request_id);
cache_match_all_times_.erase(request_id);
}
@@ -504,7 +538,11 @@ void CacheStorageDispatcher::OnCacheKeysError(
DCHECK_EQ(thread_id, CurrentWorkerId());
blink::WebServiceWorkerCache::CacheWithRequestsCallbacks* callbacks =
cache_keys_callbacks_.Lookup(request_id);
+#ifdef CRBUG_494884
+ callbacks->onError(new blink::WebServiceWorkerCacheError(reason));
+#else
callbacks->onError(&reason);
+#endif
cache_keys_callbacks_.Remove(request_id);
cache_keys_times_.erase(request_id);
}
@@ -516,7 +554,11 @@ void CacheStorageDispatcher::OnCacheBatchError(
DCHECK_EQ(thread_id, CurrentWorkerId());
blink::WebServiceWorkerCache::CacheBatchCallbacks* callbacks =
cache_batch_callbacks_.Lookup(request_id);
+#ifdef CRBUG_494884
+ callbacks->onError(new blink::WebServiceWorkerCacheError(reason));
+#else
callbacks->onError(&reason);
+#endif
cache_batch_callbacks_.Remove(request_id);
cache_batch_times_.erase(request_id);
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698