OLD | NEW |
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 <string> | 8 #include <string> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 void AddListener(Listener* listener); | 87 void AddListener(Listener* listener); |
88 void RemoveListener(Listener* listener); | 88 void RemoveListener(Listener* listener); |
89 void NotifyRegistrationFailed(); | 89 void NotifyRegistrationFailed(); |
90 void NotifyUpdateFound(); | 90 void NotifyUpdateFound(); |
91 | 91 |
92 ServiceWorkerRegistrationInfo GetInfo(); | 92 ServiceWorkerRegistrationInfo GetInfo(); |
93 | 93 |
94 // Sets the corresposding version attribute and resets the position | 94 // Sets the corresposding version attribute and resets the position |
95 // (if any) left vacant (ie. by a waiting version being promoted). | 95 // (if any) left vacant (ie. by a waiting version being promoted). |
96 // Also notifies listeners via OnVersionAttributesChanged. | 96 // Also notifies listeners via OnVersionAttributesChanged. |
97 void SetActiveVersion(ServiceWorkerVersion* version); | 97 void SetActiveVersion(const scoped_refptr<ServiceWorkerVersion>& version); |
98 void SetWaitingVersion(ServiceWorkerVersion* version); | 98 void SetWaitingVersion(const scoped_refptr<ServiceWorkerVersion>& version); |
99 void SetInstallingVersion(ServiceWorkerVersion* version); | 99 void SetInstallingVersion(const scoped_refptr<ServiceWorkerVersion>& version); |
100 | 100 |
101 // If version is the installing, waiting, active version of this | 101 // If version is the installing, waiting, active version of this |
102 // registation, the method will reset that field to NULL, and notify | 102 // registation, the method will reset that field to NULL, and notify |
103 // listeners via OnVersionAttributesChanged. | 103 // listeners via OnVersionAttributesChanged. |
104 void UnsetVersion(ServiceWorkerVersion* version); | 104 void UnsetVersion(ServiceWorkerVersion* version); |
105 | 105 |
106 // Triggers the [[Activate]] algorithm when the currently active version | 106 // Triggers the [[Activate]] algorithm when the currently active version |
107 // has no controllees. If there are no controllees at the time the method | 107 // has no controllees. If there are no controllees at the time the method |
108 // is called or when version's skip waiting flag is set, activation is | 108 // is called or when version's skip waiting flag is set, activation is |
109 // initiated immediately. | 109 // initiated immediately. |
(...skipping 25 matching lines...) Expand all Loading... |
135 const std::string& data, | 135 const std::string& data, |
136 const StatusCallback& callback); | 136 const StatusCallback& callback); |
137 void ClearUserData(const std::string& key, | 137 void ClearUserData(const std::string& key, |
138 const StatusCallback& callback); | 138 const StatusCallback& callback); |
139 | 139 |
140 private: | 140 private: |
141 friend class base::RefCounted<ServiceWorkerRegistration>; | 141 friend class base::RefCounted<ServiceWorkerRegistration>; |
142 | 142 |
143 ~ServiceWorkerRegistration() override; | 143 ~ServiceWorkerRegistration() override; |
144 | 144 |
145 void SetVersionInternal( | |
146 ServiceWorkerVersion* version, | |
147 scoped_refptr<ServiceWorkerVersion>* data_member, | |
148 int change_flag); | |
149 void UnsetVersionInternal( | 145 void UnsetVersionInternal( |
150 ServiceWorkerVersion* version, | 146 ServiceWorkerVersion* version, |
151 ChangedVersionAttributesMask* mask); | 147 ChangedVersionAttributesMask* mask); |
152 | 148 |
153 // ServiceWorkerVersion::Listener override. | 149 // ServiceWorkerVersion::Listener override. |
154 void OnNoControllees(ServiceWorkerVersion* version) override; | 150 void OnNoControllees(ServiceWorkerVersion* version) override; |
155 | 151 |
156 // This method corresponds to the [[Activate]] algorithm. | 152 // This method corresponds to the [[Activate]] algorithm. |
157 void ActivateWaitingVersion(); | 153 void ActivateWaitingVersion(); |
158 void OnActivateEventFinished( | 154 void OnActivateEventFinished( |
(...skipping 21 matching lines...) Expand all Loading... |
180 scoped_refptr<ServiceWorkerVersion> installing_version_; | 176 scoped_refptr<ServiceWorkerVersion> installing_version_; |
181 ObserverList<Listener> listeners_; | 177 ObserverList<Listener> listeners_; |
182 base::WeakPtr<ServiceWorkerContextCore> context_; | 178 base::WeakPtr<ServiceWorkerContextCore> context_; |
183 | 179 |
184 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerRegistration); | 180 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerRegistration); |
185 }; | 181 }; |
186 | 182 |
187 } // namespace content | 183 } // namespace content |
188 | 184 |
189 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_REGISTRATION_H_ | 185 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_REGISTRATION_H_ |
OLD | NEW |