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

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

Issue 1235083006: CallbackPromiseAdapter types should be more compatible with WebCallbacks (2/3). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@web-callbacks-3
Patch Set: Created 5 years, 4 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/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 386eb2656c47c32fabc8b3b479763a0416e56634..c0c7c217fae42f95ac8168bdb1bf7ec4abd78abf 100644
--- a/content/renderer/cache_storage/cache_storage_dispatcher.cc
+++ b/content/renderer/cache_storage/cache_storage_dispatcher.cc
@@ -136,6 +136,17 @@ void ClearCallbacksMapWithErrors(T* callbacks_map) {
}
}
+template <typename T>
+void ClearCallbacksMapWithErrorsNonPtr(T* callbacks_map) {
+ typename T::iterator iter(callbacks_map);
+ while (!iter.IsAtEnd()) {
+ iter.GetCurrentValue()->onError(blink::WebServiceWorkerCacheError(
+ blink::WebServiceWorkerCacheErrorNotFound));
+ callbacks_map->Remove(iter.GetCurrentKey());
+ iter.Advance();
+ }
+}
+
} // namespace
// The WebCache object is the Chromium side implementation of the Blink
@@ -206,7 +217,7 @@ CacheStorageDispatcher::~CacheStorageDispatcher() {
ClearCallbacksMapWithErrors(&cache_match_callbacks_);
ClearCallbacksMapWithErrors(&cache_match_all_callbacks_);
ClearCallbacksMapWithErrors(&cache_keys_callbacks_);
- ClearCallbacksMapWithErrors(&cache_batch_callbacks_);
+ ClearCallbacksMapWithErrorsNonPtr(&cache_batch_callbacks_);
g_cache_storage_dispatcher_tls.Pointer()->Set(kHasBeenDeleted);
}
@@ -518,7 +529,7 @@ void CacheStorageDispatcher::OnCacheBatchError(
DCHECK_EQ(thread_id, CurrentWorkerId());
blink::WebServiceWorkerCache::CacheBatchCallbacks* callbacks =
cache_batch_callbacks_.Lookup(request_id);
- callbacks->onError(new blink::WebServiceWorkerCacheError(reason));
+ callbacks->onError(blink::WebServiceWorkerCacheError(reason));
cache_batch_callbacks_.Remove(request_id);
cache_batch_times_.erase(request_id);
}
« no previous file with comments | « content/renderer/bluetooth/bluetooth_dispatcher.cc ('k') | content/renderer/presentation/presentation_dispatcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698