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

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: fix tests Created 3 years, 8 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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 GURL& pattern,
54 bool use_cache,
54 int64_t registration_id, 55 int64_t registration_id,
55 base::WeakPtr<ServiceWorkerContextCore> context); 56 base::WeakPtr<ServiceWorkerContextCore> context);
56 57
57 int64_t id() const { return registration_id_; } 58 int64_t id() const { return registration_id_; }
58 const GURL& pattern() const { return pattern_; } 59 const GURL& pattern() const { return pattern_; }
60 bool use_cache() const { return use_cache_; }
59 61
60 bool is_deleted() const { return is_deleted_; } 62 bool is_deleted() const { return is_deleted_; }
61 void set_is_deleted(bool deleted) { is_deleted_ = deleted; } 63 void set_is_deleted(bool deleted) { is_deleted_ = deleted; }
62 64
63 bool is_uninstalling() const { return is_uninstalling_; } 65 bool is_uninstalling() const { return is_uninstalling_; }
64 66
65 void set_is_uninstalled(bool uninstalled) { is_uninstalled_ = uninstalled; } 67 void set_is_uninstalled(bool uninstalled) { is_uninstalled_ = uninstalled; }
66 bool is_uninstalled() const { return is_uninstalled_; } 68 bool is_uninstalled() const { return is_uninstalled_; }
67 69
68 int64_t resources_total_size_bytes() const { 70 int64_t resources_total_size_bytes() const {
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
187 void OnDeleteFinished(ServiceWorkerStatusCode status); 189 void OnDeleteFinished(ServiceWorkerStatusCode status);
188 190
189 // This method corresponds to the [[ClearRegistration]] algorithm. 191 // This method corresponds to the [[ClearRegistration]] algorithm.
190 void Clear(); 192 void Clear();
191 193
192 void OnRestoreFinished(const StatusCallback& callback, 194 void OnRestoreFinished(const StatusCallback& callback,
193 scoped_refptr<ServiceWorkerVersion> version, 195 scoped_refptr<ServiceWorkerVersion> version,
194 ServiceWorkerStatusCode status); 196 ServiceWorkerStatusCode status);
195 197
196 const GURL pattern_; 198 const GURL pattern_;
199 const bool use_cache_;
nhiroki 2017/03/28 06:49:51 Why don't you use ServiceWorkerRegistrationOptions
yuryu 2017/03/28 07:07:02 I thought it would make sense to align the type wi
nhiroki 2017/03/28 07:21:50 IMO, we don't have to make the implementation comp
yuryu 2017/07/20 10:15:12 Acknowledged.
197 const int64_t registration_id_; 200 const int64_t registration_id_;
198 bool is_deleted_; 201 bool is_deleted_;
199 bool is_uninstalling_; 202 bool is_uninstalling_;
200 bool is_uninstalled_; 203 bool is_uninstalled_;
201 bool should_activate_when_ready_; 204 bool should_activate_when_ready_;
202 NavigationPreloadState navigation_preload_state_; 205 NavigationPreloadState navigation_preload_state_;
203 base::Time last_update_check_; 206 base::Time last_update_check_;
204 int64_t resources_total_size_bytes_; 207 int64_t resources_total_size_bytes_;
205 208
206 // This registration is the primary owner of these versions. 209 // This registration is the primary owner of these versions.
207 scoped_refptr<ServiceWorkerVersion> active_version_; 210 scoped_refptr<ServiceWorkerVersion> active_version_;
208 scoped_refptr<ServiceWorkerVersion> waiting_version_; 211 scoped_refptr<ServiceWorkerVersion> waiting_version_;
209 scoped_refptr<ServiceWorkerVersion> installing_version_; 212 scoped_refptr<ServiceWorkerVersion> installing_version_;
210 213
211 base::ObserverList<Listener> listeners_; 214 base::ObserverList<Listener> listeners_;
212 std::vector<base::Closure> registration_finished_callbacks_; 215 std::vector<base::Closure> registration_finished_callbacks_;
213 base::WeakPtr<ServiceWorkerContextCore> context_; 216 base::WeakPtr<ServiceWorkerContextCore> context_;
214 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; 217 scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
215 218
216 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerRegistration); 219 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerRegistration);
217 }; 220 };
218 221
219 } // namespace content 222 } // namespace content
220 223
221 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_REGISTRATION_H_ 224 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_REGISTRATION_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698