| 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 #ifndef WebServiceWorkerCache_h | 5 #ifndef WebServiceWorkerCache_h |
| 6 #define WebServiceWorkerCache_h | 6 #define WebServiceWorkerCache_h |
| 7 | 7 |
| 8 #include "public/platform/WebCallbacks.h" | 8 #include "public/platform/WebCallbacks.h" |
| 9 #include "public/platform/WebCommon.h" | 9 #include "public/platform/WebCommon.h" |
| 10 #include "public/platform/WebString.h" | 10 #include "public/platform/WebString.h" |
| 11 #include "public/platform/WebVector.h" | 11 #include "public/platform/WebVector.h" |
| 12 #include "public/platform/modules/serviceworker/WebServiceWorkerCacheError.h" | 12 #include "public/platform/modules/serviceworker/WebServiceWorkerCacheError.h" |
| 13 #include "public/platform/modules/serviceworker/WebServiceWorkerRequest.h" | 13 #include "public/platform/modules/serviceworker/WebServiceWorkerRequest.h" |
| 14 #include "public/platform/modules/serviceworker/WebServiceWorkerResponse.h" | 14 #include "public/platform/modules/serviceworker/WebServiceWorkerResponse.h" |
| 15 #include <memory> |
| 16 #include <utility> |
| 15 | 17 |
| 16 namespace blink { | 18 namespace blink { |
| 17 | 19 |
| 18 // The Service Worker Cache API. The embedder provides the implementation of the | 20 // The Service Worker Cache API. The embedder provides the implementation of the |
| 19 // Cache to Blink. Blink uses the interface to operate on entries. This object | 21 // Cache to Blink. Blink uses the interface to operate on entries. This object |
| 20 // is owned by Blink, and should be destroyed as each Cache instance is no | 22 // is owned by Blink, and should be destroyed as each Cache instance is no |
| 21 // longer in use. | 23 // longer in use. |
| 22 class WebServiceWorkerCache { | 24 class WebServiceWorkerCache { |
| 23 public: | 25 public: |
| 24 using CacheMatchCallbacks = | 26 using CacheMatchCallbacks = |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 WebServiceWorkerRequest request; | 60 WebServiceWorkerRequest request; |
| 59 WebServiceWorkerResponse response; | 61 WebServiceWorkerResponse response; |
| 60 QueryParams matchParams; | 62 QueryParams matchParams; |
| 61 }; | 63 }; |
| 62 | 64 |
| 63 WebServiceWorkerCache() {} | 65 WebServiceWorkerCache() {} |
| 64 | 66 |
| 65 // Ownership of the Cache*Callbacks methods passes to the | 67 // Ownership of the Cache*Callbacks methods passes to the |
| 66 // WebServiceWorkerCache instance, which will delete it after calling | 68 // WebServiceWorkerCache instance, which will delete it after calling |
| 67 // onSuccess or onFailure. | 69 // onSuccess or onFailure. |
| 68 virtual void dispatchMatch(CacheMatchCallbacks*, | 70 virtual void dispatchMatch(std::unique_ptr<CacheMatchCallbacks>, |
| 69 const WebServiceWorkerRequest&, | 71 const WebServiceWorkerRequest&, |
| 70 const QueryParams&) = 0; | 72 const QueryParams&) = 0; |
| 71 virtual void dispatchMatchAll(CacheWithResponsesCallbacks*, | 73 virtual void dispatchMatchAll(std::unique_ptr<CacheWithResponsesCallbacks>, |
| 72 const WebServiceWorkerRequest&, | 74 const WebServiceWorkerRequest&, |
| 73 const QueryParams&) = 0; | 75 const QueryParams&) = 0; |
| 74 virtual void dispatchKeys(CacheWithRequestsCallbacks*, | 76 virtual void dispatchKeys(std::unique_ptr<CacheWithRequestsCallbacks>, |
| 75 const WebServiceWorkerRequest&, | 77 const WebServiceWorkerRequest&, |
| 76 const QueryParams&) = 0; | 78 const QueryParams&) = 0; |
| 77 virtual void dispatchBatch(CacheBatchCallbacks*, | 79 virtual void dispatchBatch(std::unique_ptr<CacheBatchCallbacks>, |
| 78 const WebVector<BatchOperation>&) = 0; | 80 const WebVector<BatchOperation>&) = 0; |
| 79 }; | 81 }; |
| 80 | 82 |
| 81 } // namespace blink | 83 } // namespace blink |
| 82 | 84 |
| 83 #endif // WebServiceWorkerCache_h | 85 #endif // WebServiceWorkerCache_h |
| OLD | NEW |