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_VERSION_H_ | 5 #ifndef CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_VERSION_H_ |
6 #define CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_VERSION_H_ | 6 #define CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_VERSION_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <map> | 10 #include <map> |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
171 | 171 |
172 // If an update is scheduled but not yet started, this resets the timer | 172 // If an update is scheduled but not yet started, this resets the timer |
173 // delaying the start time by a 'small' amount. | 173 // delaying the start time by a 'small' amount. |
174 void DeferScheduledUpdate(); | 174 void DeferScheduledUpdate(); |
175 | 175 |
176 // Starts an update now. | 176 // Starts an update now. |
177 void StartUpdate(); | 177 void StartUpdate(); |
178 | 178 |
179 // Starts the worker if it isn't already running, and calls |task| when the | 179 // Starts the worker if it isn't already running, and calls |task| when the |
180 // worker is running, or |error_callback| if starting the worker failed. | 180 // worker is running, or |error_callback| if starting the worker failed. |
181 void RunAfterStartWorker(const StatusCallback& error_callback, | 181 void RunAfterStartWorker(const base::Closure& task, |
182 const base::Closure& task); | 182 const StatusCallback& error_callback); |
183 | 183 |
184 // Call this while the worker is running before dispatching an event to the | 184 // Call this while the worker is running before dispatching an event to the |
185 // worker. This informs ServiceWorkerVersion about the event in progress. | 185 // worker. This informs ServiceWorkerVersion about the event in progress. |
186 // Returns a request id, which should later be passed to FinishRequest when | 186 // Returns a request id, which should later be passed to FinishRequest when |
187 // the event finished. | 187 // the event finished. |
188 // The |error_callback| is called if either ServiceWorkerVersion decides the | 188 // The |error_callback| is called if either ServiceWorkerVersion decides the |
189 // event is taking too long, or if for some reason the worker stops or is | 189 // event is taking too long, or if for some reason the worker stops or is |
190 // killed before the request finishes. | 190 // killed before the request finishes. |
191 int StartRequest(ServiceWorkerMetrics::EventType event_type, | 191 int StartRequest(ServiceWorkerMetrics::EventType event_type, |
192 const StatusCallback& error_callback); | 192 const StatusCallback& error_callback); |
(...skipping 630 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
823 if (!ResponseMessage::Dispatch(&message, &callback_, this, param, | 823 if (!ResponseMessage::Dispatch(&message, &callback_, this, param, |
824 &CallbackType::Run)) | 824 &CallbackType::Run)) |
825 message.set_dispatch_error(); | 825 message.set_dispatch_error(); |
826 | 826 |
827 return true; | 827 return true; |
828 } | 828 } |
829 | 829 |
830 } // namespace content | 830 } // namespace content |
831 | 831 |
832 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_VERSION_H_ | 832 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_VERSION_H_ |
OLD | NEW |