| 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 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 235 IDToCacheMap::iterator it = id_to_cache_map_.find(cache_id); | 235 IDToCacheMap::iterator it = id_to_cache_map_.find(cache_id); |
| 236 if (it == id_to_cache_map_.end()) { | 236 if (it == id_to_cache_map_.end()) { |
| 237 Send(new CacheStorageMsg_CacheMatchError( | 237 Send(new CacheStorageMsg_CacheMatchError( |
| 238 thread_id, request_id, blink::WebServiceWorkerCacheErrorNotFound)); | 238 thread_id, request_id, blink::WebServiceWorkerCacheErrorNotFound)); |
| 239 return; | 239 return; |
| 240 } | 240 } |
| 241 | 241 |
| 242 scoped_refptr<CacheStorageCache> cache = it->second; | 242 scoped_refptr<CacheStorageCache> cache = it->second; |
| 243 if (request.url.is_empty()) { | 243 if (request.url.is_empty()) { |
| 244 cache->MatchAll( | 244 cache->MatchAll( |
| 245 scoped_ptr<ServiceWorkerFetchRequest>(), match_params, |
| 245 base::Bind(&CacheStorageDispatcherHost::OnCacheMatchAllCallback, this, | 246 base::Bind(&CacheStorageDispatcherHost::OnCacheMatchAllCallback, this, |
| 246 thread_id, request_id, cache)); | 247 thread_id, request_id, cache)); |
| 247 return; | 248 return; |
| 248 } | 249 } |
| 249 | 250 |
| 250 scoped_ptr<ServiceWorkerFetchRequest> scoped_request( | 251 scoped_ptr<ServiceWorkerFetchRequest> scoped_request( |
| 251 new ServiceWorkerFetchRequest(request.url, request.method, | 252 new ServiceWorkerFetchRequest(request.url, request.method, |
| 252 request.headers, request.referrer, | 253 request.headers, request.referrer, |
| 253 request.is_reload)); | 254 request.is_reload)); |
| 255 if (match_params.ignore_search) { |
| 256 cache->MatchAll( |
| 257 std::move(scoped_request), match_params, |
| 258 base::Bind(&CacheStorageDispatcherHost::OnCacheMatchAllCallback, this, |
| 259 thread_id, request_id, cache)); |
| 260 return; |
| 261 } |
| 254 cache->Match( | 262 cache->Match( |
| 255 std::move(scoped_request), | 263 std::move(scoped_request), |
| 256 base::Bind(&CacheStorageDispatcherHost::OnCacheMatchAllCallbackAdapter, | 264 base::Bind(&CacheStorageDispatcherHost::OnCacheMatchAllCallbackAdapter, |
| 257 this, thread_id, request_id, cache)); | 265 this, thread_id, request_id, cache)); |
| 258 } | 266 } |
| 259 | 267 |
| 260 void CacheStorageDispatcherHost::OnCacheKeys( | 268 void CacheStorageDispatcherHost::OnCacheKeys( |
| 261 int thread_id, | 269 int thread_id, |
| 262 int request_id, | 270 int request_id, |
| 263 int cache_id, | 271 int cache_id, |
| (...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 507 UUIDToBlobDataHandleList::iterator it = blob_handle_store_.find(uuid); | 515 UUIDToBlobDataHandleList::iterator it = blob_handle_store_.find(uuid); |
| 508 if (it == blob_handle_store_.end()) | 516 if (it == blob_handle_store_.end()) |
| 509 return; | 517 return; |
| 510 DCHECK(!it->second.empty()); | 518 DCHECK(!it->second.empty()); |
| 511 it->second.pop_front(); | 519 it->second.pop_front(); |
| 512 if (it->second.empty()) | 520 if (it->second.empty()) |
| 513 blob_handle_store_.erase(it); | 521 blob_handle_store_.erase(it); |
| 514 } | 522 } |
| 515 | 523 |
| 516 } // namespace content | 524 } // namespace content |
| OLD | NEW |