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