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

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

Issue 717353004: ServiceWorker: Add support for .skipWaiting and controllerchange event(2/3) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: add missing '!' Created 6 years, 1 month 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 "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "base/gtest_prod_util.h" 9 #include "base/gtest_prod_util.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 22 matching lines...) Expand all
33 public: 33 public:
34 virtual void OnVersionAttributesChanged( 34 virtual void OnVersionAttributesChanged(
35 ServiceWorkerRegistration* registration, 35 ServiceWorkerRegistration* registration,
36 ChangedVersionAttributesMask changed_mask, 36 ChangedVersionAttributesMask changed_mask,
37 const ServiceWorkerRegistrationInfo& info) {} 37 const ServiceWorkerRegistrationInfo& info) {}
38 virtual void OnRegistrationFailed( 38 virtual void OnRegistrationFailed(
39 ServiceWorkerRegistration* registration) {} 39 ServiceWorkerRegistration* registration) {}
40 virtual void OnRegistrationFinishedUninstalling( 40 virtual void OnRegistrationFinishedUninstalling(
41 ServiceWorkerRegistration* registration) {} 41 ServiceWorkerRegistration* registration) {}
42 virtual void OnUpdateFound( 42 virtual void OnUpdateFound(
43 ServiceWorkerRegistration* registration) {} 43 ServiceWorkerRegistration* registration) {}
michaeln 2014/11/14 23:06:39 virtual void OnSkippedWaiting(reg) ?
xiang 2014/11/17 08:42:10 Done.
44 }; 44 };
45 45
46 ServiceWorkerRegistration(const GURL& pattern, 46 ServiceWorkerRegistration(const GURL& pattern,
47 int64 registration_id, 47 int64 registration_id,
48 base::WeakPtr<ServiceWorkerContextCore> context); 48 base::WeakPtr<ServiceWorkerContextCore> context);
49 49
50 int64 id() const { return registration_id_; } 50 int64 id() const { return registration_id_; }
51 const GURL& pattern() const { return pattern_; } 51 const GURL& pattern() const { return pattern_; }
52 52
53 bool is_deleted() const { return is_deleted_; } 53 bool is_deleted() const { return is_deleted_; }
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 // If version is the installing, waiting, active version of this 95 // If version is the installing, waiting, active version of this
96 // registation, the method will reset that field to NULL, and notify 96 // registation, the method will reset that field to NULL, and notify
97 // listeners via OnVersionAttributesChanged. 97 // listeners via OnVersionAttributesChanged.
98 void UnsetVersion(ServiceWorkerVersion* version); 98 void UnsetVersion(ServiceWorkerVersion* version);
99 99
100 // Triggers the [[Activate]] algorithm when the currently active version 100 // Triggers the [[Activate]] algorithm when the currently active version
101 // has no controllees. If there are no controllees at the time the method 101 // has no controllees. If there are no controllees at the time the method
102 // is called, activation is initiated immediately. 102 // is called, activation is initiated immediately.
103 void ActivateWaitingVersionWhenReady(); 103 void ActivateWaitingVersionWhenReady();
104 104
105 // Activate version immediately. Used when skip waiting flag is set.
falken 2014/11/14 04:00:15 The second sentence is a little misleading: it's a
xiang 2014/11/17 08:42:10 Done.
106 void ActivateWaitingVersion();
107
105 // Triggers the [[ClearRegistration]] algorithm when the currently 108 // Triggers the [[ClearRegistration]] algorithm when the currently
106 // active version has no controllees. Deletes this registration 109 // active version has no controllees. Deletes this registration
107 // from storage immediately. 110 // from storage immediately.
108 void ClearWhenReady(); 111 void ClearWhenReady();
109 112
110 // Restores this registration in storage and cancels the pending 113 // Restores this registration in storage and cancels the pending
111 // [[ClearRegistration]] algorithm. 114 // [[ClearRegistration]] algorithm.
112 void AbortPendingClear(const StatusCallback& callback); 115 void AbortPendingClear(const StatusCallback& callback);
113 116
114 // The time of the most recent update check. 117 // The time of the most recent update check.
115 base::Time last_update_check() const { return last_update_check_; } 118 base::Time last_update_check() const { return last_update_check_; }
116 void set_last_update_check(base::Time last) { last_update_check_ = last; } 119 void set_last_update_check(base::Time last) { last_update_check_ = last; }
117 120
118 private: 121 private:
119 friend class base::RefCounted<ServiceWorkerRegistration>; 122 friend class base::RefCounted<ServiceWorkerRegistration>;
120 123
121 ~ServiceWorkerRegistration() override; 124 ~ServiceWorkerRegistration() override;
122 125
123 void SetVersionInternal( 126 void SetVersionInternal(
124 ServiceWorkerVersion* version, 127 ServiceWorkerVersion* version,
125 scoped_refptr<ServiceWorkerVersion>* data_member, 128 scoped_refptr<ServiceWorkerVersion>* data_member,
126 int change_flag); 129 int change_flag);
127 void UnsetVersionInternal( 130 void UnsetVersionInternal(
128 ServiceWorkerVersion* version, 131 ServiceWorkerVersion* version,
129 ChangedVersionAttributesMask* mask); 132 ChangedVersionAttributesMask* mask);
130 133
131 // ServiceWorkerVersion::Listener override. 134 // ServiceWorkerVersion::Listener override.
132 void OnNoControllees(ServiceWorkerVersion* version) override; 135 void OnNoControllees(ServiceWorkerVersion* version) override;
133 136
134 // This method corresponds to the [[Activate]] algorithm. 137 void PrepareProviderHostsToSkipWaiting();
135 void ActivateWaitingVersion();
136 void OnActivateEventFinished( 138 void OnActivateEventFinished(
137 ServiceWorkerVersion* activating_version, 139 ServiceWorkerVersion* activating_version,
138 ServiceWorkerStatusCode status); 140 ServiceWorkerStatusCode status);
139 void OnDeleteFinished(ServiceWorkerStatusCode status); 141 void OnDeleteFinished(ServiceWorkerStatusCode status);
140 142
141 // This method corresponds to the [[ClearRegistration]] algorithm. 143 // This method corresponds to the [[ClearRegistration]] algorithm.
142 void Clear(); 144 void Clear();
143 145
144 void OnRestoreFinished(const StatusCallback& callback, 146 void OnRestoreFinished(const StatusCallback& callback,
145 scoped_refptr<ServiceWorkerVersion> version, 147 scoped_refptr<ServiceWorkerVersion> version,
(...skipping 12 matching lines...) Expand all
158 scoped_refptr<ServiceWorkerVersion> installing_version_; 160 scoped_refptr<ServiceWorkerVersion> installing_version_;
159 ObserverList<Listener> listeners_; 161 ObserverList<Listener> listeners_;
160 base::WeakPtr<ServiceWorkerContextCore> context_; 162 base::WeakPtr<ServiceWorkerContextCore> context_;
161 163
162 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerRegistration); 164 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerRegistration);
163 }; 165 };
164 166
165 } // namespace content 167 } // namespace content
166 168
167 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_REGISTRATION_H_ 169 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_REGISTRATION_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698