| 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 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 164 } | 164 } |
| 165 void dispatchMatchAll(CacheWithResponsesCallbacks* callbacks, | 165 void dispatchMatchAll(CacheWithResponsesCallbacks* callbacks, |
| 166 const blink::WebServiceWorkerRequest& request, | 166 const blink::WebServiceWorkerRequest& request, |
| 167 const QueryParams& query_params) override { | 167 const QueryParams& query_params) override { |
| 168 if (!dispatcher_) | 168 if (!dispatcher_) |
| 169 return; | 169 return; |
| 170 dispatcher_->dispatchMatchAllForCache(cache_id_, callbacks, request, | 170 dispatcher_->dispatchMatchAllForCache(cache_id_, callbacks, request, |
| 171 query_params); | 171 query_params); |
| 172 } | 172 } |
| 173 void dispatchKeys(CacheWithRequestsCallbacks* callbacks, | 173 void dispatchKeys(CacheWithRequestsCallbacks* callbacks, |
| 174 const blink::WebServiceWorkerRequest* request, | 174 const blink::WebServiceWorkerRequest& request, |
| 175 const QueryParams& query_params) override { | 175 const QueryParams& query_params) override { |
| 176 if (!dispatcher_) | 176 if (!dispatcher_) |
| 177 return; | 177 return; |
| 178 dispatcher_->dispatchKeysForCache(cache_id_, callbacks, request, | 178 dispatcher_->dispatchKeysForCache(cache_id_, callbacks, request, |
| 179 query_params); | 179 query_params); |
| 180 } | 180 } |
| 181 void dispatchBatch( | 181 void dispatchBatch( |
| 182 CacheBatchCallbacks* callbacks, | 182 CacheBatchCallbacks* callbacks, |
| 183 const blink::WebVector<BatchOperation>& batch_operations) override { | 183 const blink::WebVector<BatchOperation>& batch_operations) override { |
| 184 if (!dispatcher_) | 184 if (!dispatcher_) |
| (...skipping 412 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 597 | 597 |
| 598 Send(new CacheStorageHostMsg_CacheMatchAll( | 598 Send(new CacheStorageHostMsg_CacheMatchAll( |
| 599 CurrentWorkerId(), request_id, cache_id, | 599 CurrentWorkerId(), request_id, cache_id, |
| 600 FetchRequestFromWebRequest(request), | 600 FetchRequestFromWebRequest(request), |
| 601 QueryParamsFromWebQueryParams(query_params))); | 601 QueryParamsFromWebQueryParams(query_params))); |
| 602 } | 602 } |
| 603 | 603 |
| 604 void CacheStorageDispatcher::dispatchKeysForCache( | 604 void CacheStorageDispatcher::dispatchKeysForCache( |
| 605 int cache_id, | 605 int cache_id, |
| 606 blink::WebServiceWorkerCache::CacheWithRequestsCallbacks* callbacks, | 606 blink::WebServiceWorkerCache::CacheWithRequestsCallbacks* callbacks, |
| 607 const blink::WebServiceWorkerRequest* request, | 607 const blink::WebServiceWorkerRequest& request, |
| 608 const blink::WebServiceWorkerCache::QueryParams& query_params) { | 608 const blink::WebServiceWorkerCache::QueryParams& query_params) { |
| 609 int request_id = cache_keys_callbacks_.Add(callbacks); | 609 int request_id = cache_keys_callbacks_.Add(callbacks); |
| 610 cache_keys_times_[request_id] = base::TimeTicks::Now(); | 610 cache_keys_times_[request_id] = base::TimeTicks::Now(); |
| 611 | 611 |
| 612 Send(new CacheStorageHostMsg_CacheKeys( | 612 Send(new CacheStorageHostMsg_CacheKeys( |
| 613 CurrentWorkerId(), request_id, cache_id, | 613 CurrentWorkerId(), request_id, cache_id, |
| 614 request ? FetchRequestFromWebRequest(*request) | 614 FetchRequestFromWebRequest(request), |
| 615 : ServiceWorkerFetchRequest(), | |
| 616 QueryParamsFromWebQueryParams(query_params))); | 615 QueryParamsFromWebQueryParams(query_params))); |
| 617 } | 616 } |
| 618 | 617 |
| 619 void CacheStorageDispatcher::dispatchBatchForCache( | 618 void CacheStorageDispatcher::dispatchBatchForCache( |
| 620 int cache_id, | 619 int cache_id, |
| 621 blink::WebServiceWorkerCache::CacheBatchCallbacks* callbacks, | 620 blink::WebServiceWorkerCache::CacheBatchCallbacks* callbacks, |
| 622 const blink::WebVector<blink::WebServiceWorkerCache::BatchOperation>& | 621 const blink::WebVector<blink::WebServiceWorkerCache::BatchOperation>& |
| 623 web_operations) { | 622 web_operations) { |
| 624 int request_id = cache_batch_callbacks_.Add(callbacks); | 623 int request_id = cache_batch_callbacks_.Add(callbacks); |
| 625 cache_batch_times_[request_id] = base::TimeTicks::Now(); | 624 cache_batch_times_[request_id] = base::TimeTicks::Now(); |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 666 CacheStorageDispatcher::WebResponsesFromResponses( | 665 CacheStorageDispatcher::WebResponsesFromResponses( |
| 667 const std::vector<ServiceWorkerResponse>& responses) { | 666 const std::vector<ServiceWorkerResponse>& responses) { |
| 668 blink::WebVector<blink::WebServiceWorkerResponse> web_responses( | 667 blink::WebVector<blink::WebServiceWorkerResponse> web_responses( |
| 669 responses.size()); | 668 responses.size()); |
| 670 for (size_t i = 0; i < responses.size(); ++i) | 669 for (size_t i = 0; i < responses.size(); ++i) |
| 671 PopulateWebResponseFromResponse(responses[i], &(web_responses[i])); | 670 PopulateWebResponseFromResponse(responses[i], &(web_responses[i])); |
| 672 return web_responses; | 671 return web_responses; |
| 673 } | 672 } |
| 674 | 673 |
| 675 } // namespace content | 674 } // namespace content |
| OLD | NEW |