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_CONTEXT_WRAPPER_H_ | 5 #ifndef CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_CONTEXT_WRAPPER_H_ |
6 #define CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_CONTEXT_WRAPPER_H_ | 6 #define CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_CONTEXT_WRAPPER_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <memory> | 10 #include <memory> |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
167 // version, returns ERROR_NOT_FOUND. | 167 // version, returns ERROR_NOT_FOUND. |
168 // - If the registration does not have the active version but has the waiting | 168 // - If the registration does not have the active version but has the waiting |
169 // version, activates the waiting version and runs |callback| when it is | 169 // version, activates the waiting version and runs |callback| when it is |
170 // activated. | 170 // activated. |
171 // | 171 // |
172 // Must be called from the IO thread. | 172 // Must be called from the IO thread. |
173 void FindReadyRegistrationForId(int64_t registration_id, | 173 void FindReadyRegistrationForId(int64_t registration_id, |
174 const GURL& origin, | 174 const GURL& origin, |
175 const FindRegistrationCallback& callback); | 175 const FindRegistrationCallback& callback); |
176 | 176 |
| 177 // Returns the registration for |registration_id|. It is guaranteed that the |
| 178 // returned registration has the activated worker. |
| 179 // |
| 180 // Generally |FindReadyRegistrationForId| should be used to look up a |
| 181 // registration by |registration_id| since it's more efficient. But if a |
| 182 // |registration_id| is all that is available this method can be used instead. |
| 183 // |
| 184 // - If the registration is not found, returns ERROR_NOT_FOUND. |
| 185 // - If the registration has neither the waiting version nor the active |
| 186 // version, returns ERROR_NOT_FOUND. |
| 187 // - If the registration does not have the active version but has the waiting |
| 188 // version, activates the waiting version and runs |callback| when it is |
| 189 // activated. |
| 190 // |
| 191 // Must be called from the IO thread. |
| 192 void FindReadyRegistrationForIdOnly(int64_t registration_id, |
| 193 const FindRegistrationCallback& callback); |
| 194 |
177 // All these methods must be called from the IO thread. | 195 // All these methods must be called from the IO thread. |
178 void GetAllRegistrations(const GetRegistrationsInfosCallback& callback); | 196 void GetAllRegistrations(const GetRegistrationsInfosCallback& callback); |
179 void GetRegistrationUserData(int64_t registration_id, | 197 void GetRegistrationUserData(int64_t registration_id, |
180 const std::vector<std::string>& keys, | 198 const std::vector<std::string>& keys, |
181 const GetUserDataCallback& callback); | 199 const GetUserDataCallback& callback); |
182 void StoreRegistrationUserData( | 200 void StoreRegistrationUserData( |
183 int64_t registration_id, | 201 int64_t registration_id, |
184 const GURL& origin, | 202 const GURL& origin, |
185 const std::vector<std::pair<std::string, std::string>>& key_value_pairs, | 203 const std::vector<std::pair<std::string, std::string>>& key_value_pairs, |
186 const StatusCallback& callback); | 204 const StatusCallback& callback); |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
300 | 318 |
301 // Must be touched on the UI thread. | 319 // Must be touched on the UI thread. |
302 std::map<int, int> navigation_hint_task_count_per_process_; | 320 std::map<int, int> navigation_hint_task_count_per_process_; |
303 | 321 |
304 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerContextWrapper); | 322 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerContextWrapper); |
305 }; | 323 }; |
306 | 324 |
307 } // namespace content | 325 } // namespace content |
308 | 326 |
309 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_CONTEXT_WRAPPER_H_ | 327 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_CONTEXT_WRAPPER_H_ |
OLD | NEW |