Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(142)

Side by Side Diff: public/platform/WebServiceWorkerCache.h

Issue 603673002: Reland of "Introducing the WebServiceWorkerCache." (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@minimaster
Patch Set: build fix Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef WebServiceWorkerCache_h
6 #define WebServiceWorkerCache_h
7
8 #include "public/platform/WebCallbacks.h"
9 #include "public/platform/WebCommon.h"
10 #include "public/platform/WebServiceWorkerCacheError.h"
11 #include "public/platform/WebServiceWorkerRequest.h"
12 #include "public/platform/WebServiceWorkerResponse.h"
13 #include "public/platform/WebString.h"
14 #include "public/platform/WebVector.h"
15
16 namespace blink {
17
18 // The Service Worker Cache API. The embedder provides the implementation of the Cache to Blink. Blink uses the interface
19 // to operate on entries.
20 // This object is owned by Blink, and should be destroyed as each Cache instance is no longer in use.
21 class WebServiceWorkerCache {
22 public:
23 typedef WebCallbacks<WebServiceWorkerResponse, WebServiceWorkerCacheError> C acheMatchCallbacks;
24 typedef WebCallbacks<WebVector<WebServiceWorkerResponse>, WebServiceWorkerCa cheError> CacheWithResponsesCallbacks;
25 typedef WebCallbacks<WebVector<WebServiceWorkerRequest>, WebServiceWorkerCac heError> CacheWithRequestsCallbacks;
26
27 virtual ~WebServiceWorkerCache() { }
28
29 // Options that affect the scope of searches.
30 struct QueryParams {
31 QueryParams() : ignoreSearch(false), ignoreMethod(false), ignoreVary(fal se), prefixMatch(false) { }
32
33 bool ignoreSearch;
34 bool ignoreMethod;
35 bool ignoreVary;
36 bool prefixMatch;
37 WebString cacheName;
38 };
39
40 enum OperationType {
41 OperationTypeUndefined,
42 OperationTypePut,
43 OperationTypeDelete,
44 OperationTypeLast = OperationTypeDelete
45 };
46
47 struct BatchOperation {
48 BatchOperation() : operationType(OperationTypeUndefined) { }
49
50 OperationType operationType;
51 WebServiceWorkerRequest request;
52 WebServiceWorkerResponse response;
53 QueryParams matchParams;
54 };
55
56 WebServiceWorkerCache() { }
57
58 // Ownership of the Cache*Callbacks methods passes to the WebServiceWorkerCa che instance, which will delete it after
59 // calling onSuccess or onFailure.
60 virtual void dispatchMatch(CacheMatchCallbacks*, const WebServiceWorkerReque st&, const QueryParams&) = 0;
61 virtual void dispatchMatchAll(CacheWithResponsesCallbacks*, const WebService WorkerRequest&, const QueryParams&) = 0;
62 virtual void dispatchKeys(CacheWithRequestsCallbacks*, const WebServiceWorke rRequest*, const QueryParams&) = 0;
63 virtual void dispatchBatch(CacheWithResponsesCallbacks*, const WebVector<Bat chOperation>&) = 0;
64 };
65
66 } // namespace blink
67
68 #endif // WebServiceWorkerCache_h
OLDNEW
« no previous file with comments | « Source/modules/serviceworkers/CacheTest.cpp ('k') | public/platform/WebServiceWorkerCacheStorage.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698