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

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

Issue 599473002: ServiceWorker CacheID update (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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
« no previous file with comments | « content/browser/service_worker/service_worker_cache_listener.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 7a5892ee6d72a80651bdfdd5edffd044b918d077..59a9ae9fa3c54447a916171ed570985e31861faf 100644
--- a/content/browser/service_worker/service_worker_cache_listener.cc
+++ b/content/browser/service_worker/service_worker_cache_listener.cc
@@ -222,25 +222,13 @@ void ServiceWorkerCacheListener::OnCacheStorageKeysCallback(
ServiceWorkerCacheListener::CacheID
ServiceWorkerCacheListener::StoreCacheReference(
const scoped_refptr<ServiceWorkerCache>& cache) {
- CacheToIDMap::iterator it = cache_to_id_map_.find(cache.get());
- if (it == cache_to_id_map_.end()) {
- CacheID cache_id = next_cache_id_++;
- cache_to_id_map_.insert(std::make_pair(cache.get(), cache_id));
- id_to_cache_map_.insert(std::make_pair(cache_id, cache));
- return cache_id;
- }
-
- return it->second;
+ int cache_id = next_cache_id_++;
+ id_to_cache_map_[cache_id] = cache;
+ return cache_id;
}
void ServiceWorkerCacheListener::DropCacheReference(CacheID cache_id) {
- IDToCacheMap::iterator it = id_to_cache_map_.find(cache_id);
- if (it != id_to_cache_map_.end())
- return;
-
- size_t deleted = cache_to_id_map_.erase(it->second.get());
- DCHECK(deleted == 1u);
- id_to_cache_map_.erase(it);
+ id_to_cache_map_.erase(cache_id);
}
} // namespace content
« no previous file with comments | « content/browser/service_worker/service_worker_cache_listener.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698