| 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 // If the worker is already running, |task| is executed synchronously (before |
| 182 const base::Closure& task); | 182 // this method returns). |
| 183 void RunAfterStartWorker(const base::Closure& task, |
| 184 const StatusCallback& error_callback); |
| 183 | 185 |
| 184 // Call this while the worker is running before dispatching an event to the | 186 // Call this while the worker is running before dispatching an event to the |
| 185 // worker. This informs ServiceWorkerVersion about the event in progress. | 187 // worker. This informs ServiceWorkerVersion about the event in progress. |
| 186 // Returns a request id, which should later be passed to FinishRequest when | 188 // Returns a request id, which should later be passed to FinishRequest when |
| 187 // the event finished. | 189 // the event finished. |
| 188 // The |error_callback| is called if either ServiceWorkerVersion decides the | 190 // 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 | 191 // event is taking too long, or if for some reason the worker stops or is |
| 190 // killed before the request finishes. | 192 // killed before the request finishes. |
| 191 int StartRequest(ServiceWorkerMetrics::EventType event_type, | 193 int StartRequest(ServiceWorkerMetrics::EventType event_type, |
| 192 const StatusCallback& error_callback); | 194 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, | 825 if (!ResponseMessage::Dispatch(&message, &callback_, this, param, |
| 824 &CallbackType::Run)) | 826 &CallbackType::Run)) |
| 825 message.set_dispatch_error(); | 827 message.set_dispatch_error(); |
| 826 | 828 |
| 827 return true; | 829 return true; |
| 828 } | 830 } |
| 829 | 831 |
| 830 } // namespace content | 832 } // namespace content |
| 831 | 833 |
| 832 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_VERSION_H_ | 834 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_VERSION_H_ |
| OLD | NEW |