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 | 15 |
16 namespace blink { | 16 namespace blink { |
17 | 17 |
18 // The Service Worker Cache API. The embedder provides the implementation of the
Cache to Blink. Blink uses the interface | 18 // The Service Worker Cache API. The embedder provides the implementation of the |
19 // to operate on entries. | 19 // Cache to Blink. Blink uses the interface to operate on entries. This object |
20 // This object is owned by Blink, and should be destroyed as each Cache instance
is no longer in use. | 20 // is owned by Blink, and should be destroyed as each Cache instance is no |
| 21 // longer in use. |
21 class WebServiceWorkerCache { | 22 class WebServiceWorkerCache { |
22 public: | 23 public: |
23 using CacheMatchCallbacks = | 24 using CacheMatchCallbacks = |
24 WebCallbacks<const WebServiceWorkerResponse&, WebServiceWorkerCacheError>; | 25 WebCallbacks<const WebServiceWorkerResponse&, WebServiceWorkerCacheError>; |
25 using CacheWithResponsesCallbacks = | 26 using CacheWithResponsesCallbacks = |
26 WebCallbacks<const WebVector<WebServiceWorkerResponse>&, | 27 WebCallbacks<const WebVector<WebServiceWorkerResponse>&, |
27 WebServiceWorkerCacheError>; | 28 WebServiceWorkerCacheError>; |
28 using CacheWithRequestsCallbacks = | 29 using CacheWithRequestsCallbacks = |
29 WebCallbacks<const WebVector<WebServiceWorkerRequest>&, | 30 WebCallbacks<const WebVector<WebServiceWorkerRequest>&, |
30 WebServiceWorkerCacheError>; | 31 WebServiceWorkerCacheError>; |
(...skipping 23 matching lines...) Expand all Loading... |
54 BatchOperation() : operationType(OperationTypeUndefined) {} | 55 BatchOperation() : operationType(OperationTypeUndefined) {} |
55 | 56 |
56 OperationType operationType; | 57 OperationType operationType; |
57 WebServiceWorkerRequest request; | 58 WebServiceWorkerRequest request; |
58 WebServiceWorkerResponse response; | 59 WebServiceWorkerResponse response; |
59 QueryParams matchParams; | 60 QueryParams matchParams; |
60 }; | 61 }; |
61 | 62 |
62 WebServiceWorkerCache() {} | 63 WebServiceWorkerCache() {} |
63 | 64 |
64 // Ownership of the Cache*Callbacks methods passes to the WebServiceWorkerCach
e instance, which will delete it after | 65 // Ownership of the Cache*Callbacks methods passes to the |
65 // calling onSuccess or onFailure. | 66 // WebServiceWorkerCache instance, which will delete it after calling |
| 67 // onSuccess or onFailure. |
66 virtual void dispatchMatch(CacheMatchCallbacks*, | 68 virtual void dispatchMatch(CacheMatchCallbacks*, |
67 const WebServiceWorkerRequest&, | 69 const WebServiceWorkerRequest&, |
68 const QueryParams&) = 0; | 70 const QueryParams&) = 0; |
69 virtual void dispatchMatchAll(CacheWithResponsesCallbacks*, | 71 virtual void dispatchMatchAll(CacheWithResponsesCallbacks*, |
70 const WebServiceWorkerRequest&, | 72 const WebServiceWorkerRequest&, |
71 const QueryParams&) = 0; | 73 const QueryParams&) = 0; |
72 virtual void dispatchKeys(CacheWithRequestsCallbacks*, | 74 virtual void dispatchKeys(CacheWithRequestsCallbacks*, |
73 const WebServiceWorkerRequest&, | 75 const WebServiceWorkerRequest&, |
74 const QueryParams&) = 0; | 76 const QueryParams&) = 0; |
75 virtual void dispatchBatch(CacheBatchCallbacks*, | 77 virtual void dispatchBatch(CacheBatchCallbacks*, |
76 const WebVector<BatchOperation>&) = 0; | 78 const WebVector<BatchOperation>&) = 0; |
77 }; | 79 }; |
78 | 80 |
79 } // namespace blink | 81 } // namespace blink |
80 | 82 |
81 #endif // WebServiceWorkerCache_h | 83 #endif // WebServiceWorkerCache_h |
OLD | NEW |