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

Side by Side Diff: content/browser/service_worker/service_worker_cache.h

Issue 608593003: Have ServiceWorkerCache::Put return a Response when completed. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@put_context
Patch Set: Rebase Created 6 years, 2 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
« no previous file with comments | « no previous file | content/browser/service_worker/service_worker_cache.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_CACHE_H_ 5 #ifndef CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_CACHE_H_
6 #define CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_CACHE_H_ 6 #define CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_CACHE_H_
7 7
8 #include "base/callback.h" 8 #include "base/callback.h"
9 #include "base/files/file_path.h" 9 #include "base/files/file_path.h"
10 #include "base/memory/ref_counted.h" 10 #include "base/memory/ref_counted.h"
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 63
64 // Returns ErrorTypeNotFound if not found. The callback will always be called. 64 // Returns ErrorTypeNotFound if not found. The callback will always be called.
65 void Match(scoped_ptr<ServiceWorkerFetchRequest> request, 65 void Match(scoped_ptr<ServiceWorkerFetchRequest> request,
66 const ResponseCallback& callback); 66 const ResponseCallback& callback);
67 67
68 // Puts the request and response object in the cache. The response body (if 68 // Puts the request and response object in the cache. The response body (if
69 // present) is stored in the cache, but not the request body. Returns 69 // present) is stored in the cache, but not the request body. Returns
70 // ErrorTypeOK on success. The callback will always be called. 70 // ErrorTypeOK on success. The callback will always be called.
71 void Put(scoped_ptr<ServiceWorkerFetchRequest> request, 71 void Put(scoped_ptr<ServiceWorkerFetchRequest> request,
72 scoped_ptr<ServiceWorkerResponse> response, 72 scoped_ptr<ServiceWorkerResponse> response,
73 const ErrorCallback& callback); 73 const ResponseCallback& callback);
74 74
75 // Returns ErrorNotFound if not found. Otherwise deletes and returns 75 // Returns ErrorNotFound if not found. Otherwise deletes and returns
76 // ErrorTypeOK. The callback will always be called. 76 // ErrorTypeOK. The callback will always be called.
77 void Delete(scoped_ptr<ServiceWorkerFetchRequest> request, 77 void Delete(scoped_ptr<ServiceWorkerFetchRequest> request,
78 const ErrorCallback& callback); 78 const ErrorCallback& callback);
79 79
80 // TODO(jkarlin): Have keys take an optional ServiceWorkerFetchRequest. 80 // TODO(jkarlin): Have keys take an optional ServiceWorkerFetchRequest.
81 // Returns ErrorTypeOK and a vector of requests if there are no errors. The 81 // Returns ErrorTypeOK and a vector of requests if there are no errors. The
82 // callback will always be called. 82 // callback will always be called.
83 void Keys(const RequestsCallback& callback); 83 void Keys(const RequestsCallback& callback);
(...skipping 17 matching lines...) Expand all
101 net::URLRequestContext* request_context, 101 net::URLRequestContext* request_context,
102 base::WeakPtr<storage::BlobStorageContext> blob_context); 102 base::WeakPtr<storage::BlobStorageContext> blob_context);
103 103
104 // Operations in progress will complete after the cache is deleted but pending 104 // Operations in progress will complete after the cache is deleted but pending
105 // operations (those operations waiting for init to finish) won't. 105 // operations (those operations waiting for init to finish) won't.
106 virtual ~ServiceWorkerCache(); 106 virtual ~ServiceWorkerCache();
107 107
108 void PutImpl(scoped_ptr<ServiceWorkerFetchRequest> request, 108 void PutImpl(scoped_ptr<ServiceWorkerFetchRequest> request,
109 scoped_ptr<ServiceWorkerResponse> response, 109 scoped_ptr<ServiceWorkerResponse> response,
110 scoped_ptr<storage::BlobDataHandle> blob_data_handle, 110 scoped_ptr<storage::BlobDataHandle> blob_data_handle,
111 const ErrorCallback& callback); 111 const ResponseCallback& callback);
112 112
113 // Static callbacks for the Keys function. 113 // Static callbacks for the Keys function.
114 static void KeysDidOpenNextEntry(scoped_ptr<KeysContext> keys_context, 114 static void KeysDidOpenNextEntry(scoped_ptr<KeysContext> keys_context,
115 int rv); 115 int rv);
116 static void KeysProcessNextEntry(scoped_ptr<KeysContext> keys_context, 116 static void KeysProcessNextEntry(scoped_ptr<KeysContext> keys_context,
117 const Entries::iterator& iter); 117 const Entries::iterator& iter);
118 static void KeysDidReadHeaders( 118 static void KeysDidReadHeaders(
119 scoped_ptr<KeysContext> keys_context, 119 scoped_ptr<KeysContext> keys_context,
120 const Entries::iterator& iter, 120 const Entries::iterator& iter,
121 scoped_ptr<ServiceWorkerRequestResponseHeaders> headers); 121 scoped_ptr<ServiceWorkerRequestResponseHeaders> headers);
(...skipping 15 matching lines...) Expand all
137 std::vector<base::Closure> init_callbacks_; 137 std::vector<base::Closure> init_callbacks_;
138 138
139 base::WeakPtrFactory<ServiceWorkerCache> weak_ptr_factory_; 139 base::WeakPtrFactory<ServiceWorkerCache> weak_ptr_factory_;
140 140
141 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerCache); 141 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerCache);
142 }; 142 };
143 143
144 } // namespace content 144 } // namespace content
145 145
146 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_CACHE_H_ 146 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_CACHE_H_
OLDNEW
« no previous file with comments | « no previous file | content/browser/service_worker/service_worker_cache.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698