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

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

Issue 2771823002: Implement updateViaCache flag and no-cache by default for main service worker scripts
Patch Set: change useCache to updateViaCache Created 3 years, 6 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
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_REGISTRATION_H_ 5 #ifndef CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_REGISTRATION_H_
6 #define CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_REGISTRATION_H_ 6 #define CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_REGISTRATION_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <memory> 10 #include <memory>
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 const ServiceWorkerRegistrationInfo& info) {} 43 const ServiceWorkerRegistrationInfo& info) {}
44 virtual void OnRegistrationFailed( 44 virtual void OnRegistrationFailed(
45 ServiceWorkerRegistration* registration) {} 45 ServiceWorkerRegistration* registration) {}
46 virtual void OnRegistrationFinishedUninstalling( 46 virtual void OnRegistrationFinishedUninstalling(
47 ServiceWorkerRegistration* registration) {} 47 ServiceWorkerRegistration* registration) {}
48 virtual void OnUpdateFound( 48 virtual void OnUpdateFound(
49 ServiceWorkerRegistration* registration) {} 49 ServiceWorkerRegistration* registration) {}
50 virtual void OnSkippedWaiting(ServiceWorkerRegistration* registation) {} 50 virtual void OnSkippedWaiting(ServiceWorkerRegistration* registation) {}
51 }; 51 };
52 52
53 ServiceWorkerRegistration(const GURL& pattern, 53 ServiceWorkerRegistration(const ServiceWorkerRegistrationOptions& options,
54 int64_t registration_id, 54 int64_t registration_id,
55 base::WeakPtr<ServiceWorkerContextCore> context); 55 base::WeakPtr<ServiceWorkerContextCore> context);
56 56
57 int64_t id() const { return registration_id_; } 57 int64_t id() const { return registration_id_; }
58 const GURL& pattern() const { return pattern_; } 58 const GURL& pattern() const { return pattern_; }
59 blink::WebServiceWorkerUpdateViaCache update_via_cache() const {
60 return update_via_cache_;
61 }
59 62
60 bool is_deleted() const { return is_deleted_; } 63 bool is_deleted() const { return is_deleted_; }
61 void set_is_deleted(bool deleted) { is_deleted_ = deleted; } 64 void set_is_deleted(bool deleted) { is_deleted_ = deleted; }
62 65
63 bool is_uninstalling() const { return is_uninstalling_; } 66 bool is_uninstalling() const { return is_uninstalling_; }
64 67
65 void set_is_uninstalled(bool uninstalled) { is_uninstalled_ = uninstalled; } 68 void set_is_uninstalled(bool uninstalled) { is_uninstalled_ = uninstalled; }
66 bool is_uninstalled() const { return is_uninstalled_; } 69 bool is_uninstalled() const { return is_uninstalled_; }
67 70
68 int64_t resources_total_size_bytes() const { 71 int64_t resources_total_size_bytes() const {
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 void OnDeleteFinished(ServiceWorkerStatusCode status); 191 void OnDeleteFinished(ServiceWorkerStatusCode status);
189 192
190 // This method corresponds to the [[ClearRegistration]] algorithm. 193 // This method corresponds to the [[ClearRegistration]] algorithm.
191 void Clear(); 194 void Clear();
192 195
193 void OnRestoreFinished(const StatusCallback& callback, 196 void OnRestoreFinished(const StatusCallback& callback,
194 scoped_refptr<ServiceWorkerVersion> version, 197 scoped_refptr<ServiceWorkerVersion> version,
195 ServiceWorkerStatusCode status); 198 ServiceWorkerStatusCode status);
196 199
197 const GURL pattern_; 200 const GURL pattern_;
201 const blink::WebServiceWorkerUpdateViaCache update_via_cache_;
198 const int64_t registration_id_; 202 const int64_t registration_id_;
199 bool is_deleted_; 203 bool is_deleted_;
200 bool is_uninstalling_; 204 bool is_uninstalling_;
201 bool is_uninstalled_; 205 bool is_uninstalled_;
202 bool should_activate_when_ready_; 206 bool should_activate_when_ready_;
203 NavigationPreloadState navigation_preload_state_; 207 NavigationPreloadState navigation_preload_state_;
204 base::Time last_update_check_; 208 base::Time last_update_check_;
205 int64_t resources_total_size_bytes_; 209 int64_t resources_total_size_bytes_;
206 210
207 // This registration is the primary owner of these versions. 211 // This registration is the primary owner of these versions.
208 scoped_refptr<ServiceWorkerVersion> active_version_; 212 scoped_refptr<ServiceWorkerVersion> active_version_;
209 scoped_refptr<ServiceWorkerVersion> waiting_version_; 213 scoped_refptr<ServiceWorkerVersion> waiting_version_;
210 scoped_refptr<ServiceWorkerVersion> installing_version_; 214 scoped_refptr<ServiceWorkerVersion> installing_version_;
211 215
212 base::ObserverList<Listener> listeners_; 216 base::ObserverList<Listener> listeners_;
213 std::vector<base::Closure> registration_finished_callbacks_; 217 std::vector<base::Closure> registration_finished_callbacks_;
214 base::WeakPtr<ServiceWorkerContextCore> context_; 218 base::WeakPtr<ServiceWorkerContextCore> context_;
215 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; 219 scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
216 220
217 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerRegistration); 221 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerRegistration);
218 }; 222 };
219 223
220 } // namespace content 224 } // namespace content
221 225
222 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_REGISTRATION_H_ 226 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_REGISTRATION_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698