| 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/renderer/cache_storage/webserviceworkercachestorage_impl.h" | 5 #include "content/renderer/cache_storage/webserviceworkercachestorage_impl.h" |
| 6 | 6 |
| 7 #include <memory> |
| 8 #include <utility> |
| 9 |
| 7 #include "content/child/thread_safe_sender.h" | 10 #include "content/child/thread_safe_sender.h" |
| 8 #include "content/renderer/cache_storage/cache_storage_dispatcher.h" | 11 #include "content/renderer/cache_storage/cache_storage_dispatcher.h" |
| 9 #include "third_party/WebKit/public/platform/WebHTTPHeaderVisitor.h" | 12 #include "third_party/WebKit/public/platform/WebHTTPHeaderVisitor.h" |
| 10 #include "third_party/WebKit/public/platform/modules/serviceworker/WebServiceWor
kerCache.h" | 13 #include "third_party/WebKit/public/platform/modules/serviceworker/WebServiceWor
kerCache.h" |
| 11 #include "third_party/WebKit/public/platform/modules/serviceworker/WebServiceWor
kerRequest.h" | 14 #include "third_party/WebKit/public/platform/modules/serviceworker/WebServiceWor
kerRequest.h" |
| 12 #include "third_party/WebKit/public/platform/modules/serviceworker/WebServiceWor
kerResponse.h" | 15 #include "third_party/WebKit/public/platform/modules/serviceworker/WebServiceWor
kerResponse.h" |
| 13 | 16 |
| 14 using base::TimeTicks; | 17 using base::TimeTicks; |
| 15 | 18 |
| 16 namespace content { | 19 namespace content { |
| 17 | 20 |
| 18 WebServiceWorkerCacheStorageImpl::WebServiceWorkerCacheStorageImpl( | 21 WebServiceWorkerCacheStorageImpl::WebServiceWorkerCacheStorageImpl( |
| 19 ThreadSafeSender* thread_safe_sender, | 22 ThreadSafeSender* thread_safe_sender, |
| 20 const url::Origin& origin) | 23 const url::Origin& origin) |
| 21 : thread_safe_sender_(thread_safe_sender), origin_(origin) {} | 24 : thread_safe_sender_(thread_safe_sender), origin_(origin) {} |
| 22 | 25 |
| 23 WebServiceWorkerCacheStorageImpl::~WebServiceWorkerCacheStorageImpl() { | 26 WebServiceWorkerCacheStorageImpl::~WebServiceWorkerCacheStorageImpl() { |
| 24 } | 27 } |
| 25 | 28 |
| 26 void WebServiceWorkerCacheStorageImpl::dispatchHas( | 29 void WebServiceWorkerCacheStorageImpl::dispatchHas( |
| 27 CacheStorageCallbacks* callbacks, | 30 std::unique_ptr<CacheStorageCallbacks> callbacks, |
| 28 const blink::WebString& cacheName) { | 31 const blink::WebString& cacheName) { |
| 29 GetDispatcher()->dispatchHas(callbacks, origin_, cacheName); | 32 GetDispatcher()->dispatchHas(std::move(callbacks), origin_, cacheName); |
| 30 } | 33 } |
| 31 | 34 |
| 32 void WebServiceWorkerCacheStorageImpl::dispatchOpen( | 35 void WebServiceWorkerCacheStorageImpl::dispatchOpen( |
| 33 CacheStorageWithCacheCallbacks* callbacks, | 36 std::unique_ptr<CacheStorageWithCacheCallbacks> callbacks, |
| 34 const blink::WebString& cacheName) { | 37 const blink::WebString& cacheName) { |
| 35 GetDispatcher()->dispatchOpen(callbacks, origin_, cacheName); | 38 GetDispatcher()->dispatchOpen(std::move(callbacks), origin_, cacheName); |
| 36 } | 39 } |
| 37 | 40 |
| 38 void WebServiceWorkerCacheStorageImpl::dispatchDelete( | 41 void WebServiceWorkerCacheStorageImpl::dispatchDelete( |
| 39 CacheStorageCallbacks* callbacks, | 42 std::unique_ptr<CacheStorageCallbacks> callbacks, |
| 40 const blink::WebString& cacheName) { | 43 const blink::WebString& cacheName) { |
| 41 GetDispatcher()->dispatchDelete(callbacks, origin_, cacheName); | 44 GetDispatcher()->dispatchDelete(std::move(callbacks), origin_, cacheName); |
| 42 } | 45 } |
| 43 | 46 |
| 44 void WebServiceWorkerCacheStorageImpl::dispatchKeys( | 47 void WebServiceWorkerCacheStorageImpl::dispatchKeys( |
| 45 CacheStorageKeysCallbacks* callbacks) { | 48 std::unique_ptr<CacheStorageKeysCallbacks> callbacks) { |
| 46 GetDispatcher()->dispatchKeys(callbacks, origin_); | 49 GetDispatcher()->dispatchKeys(std::move(callbacks), origin_); |
| 47 } | 50 } |
| 48 | 51 |
| 49 void WebServiceWorkerCacheStorageImpl::dispatchMatch( | 52 void WebServiceWorkerCacheStorageImpl::dispatchMatch( |
| 50 CacheStorageMatchCallbacks* callbacks, | 53 std::unique_ptr<CacheStorageMatchCallbacks> callbacks, |
| 51 const blink::WebServiceWorkerRequest& request, | 54 const blink::WebServiceWorkerRequest& request, |
| 52 const blink::WebServiceWorkerCache::QueryParams& query_params) { | 55 const blink::WebServiceWorkerCache::QueryParams& query_params) { |
| 53 GetDispatcher()->dispatchMatch(callbacks, origin_, request, query_params); | 56 GetDispatcher()->dispatchMatch(std::move(callbacks), origin_, request, |
| 57 query_params); |
| 54 } | 58 } |
| 55 | 59 |
| 56 CacheStorageDispatcher* WebServiceWorkerCacheStorageImpl::GetDispatcher() | 60 CacheStorageDispatcher* WebServiceWorkerCacheStorageImpl::GetDispatcher() |
| 57 const { | 61 const { |
| 58 return CacheStorageDispatcher::ThreadSpecificInstance( | 62 return CacheStorageDispatcher::ThreadSpecificInstance( |
| 59 thread_safe_sender_.get()); | 63 thread_safe_sender_.get()); |
| 60 } | 64 } |
| 61 | 65 |
| 62 } // namespace content | 66 } // namespace content |
| OLD | NEW |