| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "content/browser/cache_storage/cache_storage_dispatcher_host.h" | 5 #include "content/browser/cache_storage/cache_storage_dispatcher_host.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 286 const ServiceWorkerFetchRequest& request, | 286 const ServiceWorkerFetchRequest& request, |
| 287 const CacheStorageCacheQueryParams& match_params) { | 287 const CacheStorageCacheQueryParams& match_params) { |
| 288 IDToCacheMap::iterator it = id_to_cache_map_.find(cache_id); | 288 IDToCacheMap::iterator it = id_to_cache_map_.find(cache_id); |
| 289 if (it == id_to_cache_map_.end() || !it->second->value()) { | 289 if (it == id_to_cache_map_.end() || !it->second->value()) { |
| 290 Send(new CacheStorageMsg_CacheKeysError( | 290 Send(new CacheStorageMsg_CacheKeysError( |
| 291 thread_id, request_id, blink::WebServiceWorkerCacheErrorNotFound)); | 291 thread_id, request_id, blink::WebServiceWorkerCacheErrorNotFound)); |
| 292 return; | 292 return; |
| 293 } | 293 } |
| 294 | 294 |
| 295 CacheStorageCache* cache = it->second->value(); | 295 CacheStorageCache* cache = it->second->value(); |
| 296 cache->Keys(base::Bind(&CacheStorageDispatcherHost::OnCacheKeysCallback, this, | 296 std::unique_ptr<ServiceWorkerFetchRequest> request_ptr( |
| 297 thread_id, request_id, | 297 new ServiceWorkerFetchRequest(request.url, request.method, |
| 298 base::Passed(it->second->Clone()))); | 298 request.headers, request.referrer, |
| 299 request.is_reload)); |
| 300 cache->Keys( |
| 301 std::move(request_ptr), match_params, |
| 302 base::Bind(&CacheStorageDispatcherHost::OnCacheKeysCallback, this, |
| 303 thread_id, request_id, base::Passed(it->second->Clone()))); |
| 299 } | 304 } |
| 300 | 305 |
| 301 void CacheStorageDispatcherHost::OnCacheBatch( | 306 void CacheStorageDispatcherHost::OnCacheBatch( |
| 302 int thread_id, | 307 int thread_id, |
| 303 int request_id, | 308 int request_id, |
| 304 int cache_id, | 309 int cache_id, |
| 305 const std::vector<CacheStorageBatchOperation>& operations) { | 310 const std::vector<CacheStorageBatchOperation>& operations) { |
| 306 IDToCacheMap::iterator it = id_to_cache_map_.find(cache_id); | 311 IDToCacheMap::iterator it = id_to_cache_map_.find(cache_id); |
| 307 if (it == id_to_cache_map_.end() || !it->second->value()) { | 312 if (it == id_to_cache_map_.end() || !it->second->value()) { |
| 308 Send(new CacheStorageMsg_CacheBatchError( | 313 Send(new CacheStorageMsg_CacheBatchError( |
| (...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 539 UUIDToBlobDataHandleList::iterator it = blob_handle_store_.find(uuid); | 544 UUIDToBlobDataHandleList::iterator it = blob_handle_store_.find(uuid); |
| 540 if (it == blob_handle_store_.end()) | 545 if (it == blob_handle_store_.end()) |
| 541 return; | 546 return; |
| 542 DCHECK(!it->second.empty()); | 547 DCHECK(!it->second.empty()); |
| 543 it->second.pop_front(); | 548 it->second.pop_front(); |
| 544 if (it->second.empty()) | 549 if (it->second.empty()) |
| 545 blob_handle_store_.erase(it); | 550 blob_handle_store_.erase(it); |
| 546 } | 551 } |
| 547 | 552 |
| 548 } // namespace content | 553 } // namespace content |
| OLD | NEW |