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

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

Issue 1270513002: Service Worker: Make ServiceWorkerRegistration.update() return a promise. (Chromium 2/3) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Pass a raw ptr to callback's onError instead of a scoped_ptr. Created 5 years, 4 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_context_core.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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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_CONTEXT_CORE_H_ 5 #ifndef CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_CONTEXT_CORE_H_
6 #define CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_CONTEXT_CORE_H_ 6 #define CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_CONTEXT_CORE_H_
7 7
8 #include <map> 8 #include <map>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 // In chromium, there is one instance per storagepartition. This class 51 // In chromium, there is one instance per storagepartition. This class
52 // is the root of the containment hierarchy for service worker data 52 // is the root of the containment hierarchy for service worker data
53 // associated with a particular partition. 53 // associated with a particular partition.
54 class CONTENT_EXPORT ServiceWorkerContextCore 54 class CONTENT_EXPORT ServiceWorkerContextCore
55 : NON_EXPORTED_BASE(public ServiceWorkerVersion::Listener) { 55 : NON_EXPORTED_BASE(public ServiceWorkerVersion::Listener) {
56 public: 56 public:
57 typedef base::Callback<void(ServiceWorkerStatusCode status)> StatusCallback; 57 typedef base::Callback<void(ServiceWorkerStatusCode status)> StatusCallback;
58 typedef base::Callback<void(ServiceWorkerStatusCode status, 58 typedef base::Callback<void(ServiceWorkerStatusCode status,
59 const std::string& status_message, 59 const std::string& status_message,
60 int64 registration_id)> RegistrationCallback; 60 int64 registration_id)> RegistrationCallback;
61 typedef base::Callback<void(ServiceWorkerStatusCode status,
62 const std::string& status_message,
63 int64 registration_id)> UpdateCallback;
61 typedef base::Callback< 64 typedef base::Callback<
62 void(ServiceWorkerStatusCode status)> UnregistrationCallback; 65 void(ServiceWorkerStatusCode status)> UnregistrationCallback;
63 typedef IDMap<ServiceWorkerProviderHost, IDMapOwnPointer> ProviderMap; 66 typedef IDMap<ServiceWorkerProviderHost, IDMapOwnPointer> ProviderMap;
64 typedef IDMap<ProviderMap, IDMapOwnPointer> ProcessToProviderMap; 67 typedef IDMap<ProviderMap, IDMapOwnPointer> ProcessToProviderMap;
65 68
66 using ProviderByClientUUIDMap = 69 using ProviderByClientUUIDMap =
67 std::map<std::string, ServiceWorkerProviderHost*>; 70 std::map<std::string, ServiceWorkerProviderHost*>;
68 71
69 // Directory for ServiceWorkerStorage and ServiceWorkerCacheManager. 72 // Directory for ServiceWorkerStorage and ServiceWorkerCacheManager.
70 static const base::FilePath::CharType kServiceWorkerDirectory[]; 73 static const base::FilePath::CharType kServiceWorkerDirectory[];
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 const RegistrationCallback& callback); 178 const RegistrationCallback& callback);
176 void UnregisterServiceWorker(const GURL& pattern, 179 void UnregisterServiceWorker(const GURL& pattern,
177 const UnregistrationCallback& callback); 180 const UnregistrationCallback& callback);
178 // Callback is called issued after all unregistrations occur. The Status 181 // Callback is called issued after all unregistrations occur. The Status
179 // is populated as SERVICE_WORKER_OK if all succeed, or SERVICE_WORKER_FAILED 182 // is populated as SERVICE_WORKER_OK if all succeed, or SERVICE_WORKER_FAILED
180 // if any did not succeed. 183 // if any did not succeed.
181 void UnregisterServiceWorkers(const GURL& origin, 184 void UnregisterServiceWorkers(const GURL& origin,
182 const UnregistrationCallback& callback); 185 const UnregistrationCallback& callback);
183 void UpdateServiceWorker(ServiceWorkerRegistration* registration, 186 void UpdateServiceWorker(ServiceWorkerRegistration* registration,
184 bool force_bypass_cache); 187 bool force_bypass_cache);
188 void UpdateServiceWorker(ServiceWorkerRegistration* registration,
189 bool force_bypass_cache,
190 ServiceWorkerProviderHost* provider_host,
191 const UpdateCallback& callback);
185 192
186 // This class maintains collections of live instances, this class 193 // This class maintains collections of live instances, this class
187 // does not own these object or influence their lifetime. 194 // does not own these object or influence their lifetime.
188 ServiceWorkerRegistration* GetLiveRegistration(int64 registration_id); 195 ServiceWorkerRegistration* GetLiveRegistration(int64 registration_id);
189 void AddLiveRegistration(ServiceWorkerRegistration* registration); 196 void AddLiveRegistration(ServiceWorkerRegistration* registration);
190 void RemoveLiveRegistration(int64 registration_id); 197 void RemoveLiveRegistration(int64 registration_id);
191 const std::map<int64, ServiceWorkerRegistration*>& GetLiveRegistrations() 198 const std::map<int64, ServiceWorkerRegistration*>& GetLiveRegistrations()
192 const { 199 const {
193 return live_registrations_; 200 return live_registrations_;
194 } 201 }
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
238 ProviderMap* GetProviderMapForProcess(int process_id) { 245 ProviderMap* GetProviderMapForProcess(int process_id) {
239 return providers_->Lookup(process_id); 246 return providers_->Lookup(process_id);
240 } 247 }
241 248
242 void RegistrationComplete(const GURL& pattern, 249 void RegistrationComplete(const GURL& pattern,
243 const RegistrationCallback& callback, 250 const RegistrationCallback& callback,
244 ServiceWorkerStatusCode status, 251 ServiceWorkerStatusCode status,
245 const std::string& status_message, 252 const std::string& status_message,
246 ServiceWorkerRegistration* registration); 253 ServiceWorkerRegistration* registration);
247 254
255 void UpdateComplete(const UpdateCallback& callback,
256 ServiceWorkerStatusCode status,
257 const std::string& status_message,
258 ServiceWorkerRegistration* registration);
259
248 void UnregistrationComplete(const GURL& pattern, 260 void UnregistrationComplete(const GURL& pattern,
249 const UnregistrationCallback& callback, 261 const UnregistrationCallback& callback,
250 int64 registration_id, 262 int64 registration_id,
251 ServiceWorkerStatusCode status); 263 ServiceWorkerStatusCode status);
252 264
253 void DidGetAllRegistrationsForUnregisterForOrigin( 265 void DidGetAllRegistrationsForUnregisterForOrigin(
254 const UnregistrationCallback& result, 266 const UnregistrationCallback& result,
255 const GURL& origin, 267 const GURL& origin,
256 const std::vector<ServiceWorkerRegistrationInfo>& registrations); 268 const std::vector<ServiceWorkerRegistrationInfo>& registrations);
257 269
(...skipping 14 matching lines...) Expand all
272 scoped_refptr<base::ObserverListThreadSafe<ServiceWorkerContextObserver>> 284 scoped_refptr<base::ObserverListThreadSafe<ServiceWorkerContextObserver>>
273 observer_list_; 285 observer_list_;
274 base::WeakPtrFactory<ServiceWorkerContextCore> weak_factory_; 286 base::WeakPtrFactory<ServiceWorkerContextCore> weak_factory_;
275 287
276 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerContextCore); 288 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerContextCore);
277 }; 289 };
278 290
279 } // namespace content 291 } // namespace content
280 292
281 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_CONTEXT_CORE_H_ 293 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_CONTEXT_CORE_H_
OLDNEW
« no previous file with comments | « no previous file | content/browser/service_worker/service_worker_context_core.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698