| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/renderer/cache_storage/cache_storage_dispatcher.h" | 5 #include "content/renderer/cache_storage/cache_storage_dispatcher.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <map> | 9 #include <map> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 170 } | 170 } |
| 171 void dispatchMatchAll(CacheWithResponsesCallbacks* callbacks, | 171 void dispatchMatchAll(CacheWithResponsesCallbacks* callbacks, |
| 172 const blink::WebServiceWorkerRequest& request, | 172 const blink::WebServiceWorkerRequest& request, |
| 173 const QueryParams& query_params) override { | 173 const QueryParams& query_params) override { |
| 174 if (!dispatcher_) | 174 if (!dispatcher_) |
| 175 return; | 175 return; |
| 176 dispatcher_->dispatchMatchAllForCache(cache_id_, callbacks, request, | 176 dispatcher_->dispatchMatchAllForCache(cache_id_, callbacks, request, |
| 177 query_params); | 177 query_params); |
| 178 } | 178 } |
| 179 void dispatchKeys(CacheWithRequestsCallbacks* callbacks, | 179 void dispatchKeys(CacheWithRequestsCallbacks* callbacks, |
| 180 const blink::WebServiceWorkerRequest* request, | 180 const blink::WebServiceWorkerRequest& request, |
| 181 const QueryParams& query_params) override { | 181 const QueryParams& query_params) override { |
| 182 if (!dispatcher_) | 182 if (!dispatcher_) |
| 183 return; | 183 return; |
| 184 dispatcher_->dispatchKeysForCache(cache_id_, callbacks, request, | 184 dispatcher_->dispatchKeysForCache(cache_id_, callbacks, request, |
| 185 query_params); | 185 query_params); |
| 186 } | 186 } |
| 187 void dispatchBatch( | 187 void dispatchBatch( |
| 188 CacheBatchCallbacks* callbacks, | 188 CacheBatchCallbacks* callbacks, |
| 189 const blink::WebVector<BatchOperation>& batch_operations) override { | 189 const blink::WebVector<BatchOperation>& batch_operations) override { |
| 190 if (!dispatcher_) | 190 if (!dispatcher_) |
| (...skipping 412 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 603 | 603 |
| 604 Send(new CacheStorageHostMsg_CacheMatchAll( | 604 Send(new CacheStorageHostMsg_CacheMatchAll( |
| 605 CurrentWorkerId(), request_id, cache_id, | 605 CurrentWorkerId(), request_id, cache_id, |
| 606 FetchRequestFromWebRequest(request), | 606 FetchRequestFromWebRequest(request), |
| 607 QueryParamsFromWebQueryParams(query_params))); | 607 QueryParamsFromWebQueryParams(query_params))); |
| 608 } | 608 } |
| 609 | 609 |
| 610 void CacheStorageDispatcher::dispatchKeysForCache( | 610 void CacheStorageDispatcher::dispatchKeysForCache( |
| 611 int cache_id, | 611 int cache_id, |
| 612 blink::WebServiceWorkerCache::CacheWithRequestsCallbacks* callbacks, | 612 blink::WebServiceWorkerCache::CacheWithRequestsCallbacks* callbacks, |
| 613 const blink::WebServiceWorkerRequest* request, | 613 const blink::WebServiceWorkerRequest& request, |
| 614 const blink::WebServiceWorkerCache::QueryParams& query_params) { | 614 const blink::WebServiceWorkerCache::QueryParams& query_params) { |
| 615 int request_id = cache_keys_callbacks_.Add(callbacks); | 615 int request_id = cache_keys_callbacks_.Add(callbacks); |
| 616 cache_keys_times_[request_id] = base::TimeTicks::Now(); | 616 cache_keys_times_[request_id] = base::TimeTicks::Now(); |
| 617 | 617 |
| 618 Send(new CacheStorageHostMsg_CacheKeys( | 618 Send(new CacheStorageHostMsg_CacheKeys( |
| 619 CurrentWorkerId(), request_id, cache_id, | 619 CurrentWorkerId(), request_id, cache_id, |
| 620 request ? FetchRequestFromWebRequest(*request) | 620 FetchRequestFromWebRequest(request), |
| 621 : ServiceWorkerFetchRequest(), | |
| 622 QueryParamsFromWebQueryParams(query_params))); | 621 QueryParamsFromWebQueryParams(query_params))); |
| 623 } | 622 } |
| 624 | 623 |
| 625 void CacheStorageDispatcher::dispatchBatchForCache( | 624 void CacheStorageDispatcher::dispatchBatchForCache( |
| 626 int cache_id, | 625 int cache_id, |
| 627 blink::WebServiceWorkerCache::CacheBatchCallbacks* callbacks, | 626 blink::WebServiceWorkerCache::CacheBatchCallbacks* callbacks, |
| 628 const blink::WebVector<blink::WebServiceWorkerCache::BatchOperation>& | 627 const blink::WebVector<blink::WebServiceWorkerCache::BatchOperation>& |
| 629 web_operations) { | 628 web_operations) { |
| 630 int request_id = cache_batch_callbacks_.Add(callbacks); | 629 int request_id = cache_batch_callbacks_.Add(callbacks); |
| 631 cache_batch_times_[request_id] = base::TimeTicks::Now(); | 630 cache_batch_times_[request_id] = base::TimeTicks::Now(); |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 683 CacheStorageDispatcher::WebResponsesFromResponses( | 682 CacheStorageDispatcher::WebResponsesFromResponses( |
| 684 const std::vector<ServiceWorkerResponse>& responses) { | 683 const std::vector<ServiceWorkerResponse>& responses) { |
| 685 blink::WebVector<blink::WebServiceWorkerResponse> web_responses( | 684 blink::WebVector<blink::WebServiceWorkerResponse> web_responses( |
| 686 responses.size()); | 685 responses.size()); |
| 687 for (size_t i = 0; i < responses.size(); ++i) | 686 for (size_t i = 0; i < responses.size(); ++i) |
| 688 PopulateWebResponseFromResponse(responses[i], &(web_responses[i])); | 687 PopulateWebResponseFromResponse(responses[i], &(web_responses[i])); |
| 689 return web_responses; | 688 return web_responses; |
| 690 } | 689 } |
| 691 | 690 |
| 692 } // namespace content | 691 } // namespace content |
| OLD | NEW |