Chromium Code Reviews| Index: components/offline_pages/core/prefetch/prefetch_service.h |
| diff --git a/components/offline_pages/core/prefetch/prefetch_service.h b/components/offline_pages/core/prefetch/prefetch_service.h |
| index 0bb85086e858397bff3ef9d02bcca313993ce0ea..eee0de0b14d110023c014e66d4b6967a409ff6b7 100644 |
| --- a/components/offline_pages/core/prefetch/prefetch_service.h |
| +++ b/components/offline_pages/core/prefetch/prefetch_service.h |
| @@ -27,6 +27,17 @@ class PrefetchService : public KeyedService { |
| GURL url; |
| }; |
| + // A |ScopedBackgroundTask| is created when we are running in a background |
| + // task. Destroying this object should notify the system that we are done |
| + // processing the background task. |
| + class ScopedBackgroundTask { |
| + public: |
| + ScopedBackgroundTask(); |
| + virtual ~ScopedBackgroundTask(); |
| + |
| + virtual void SetNeedsReschedule(bool reschedule) = 0; |
| + }; |
| + |
| ~PrefetchService() override = default; |
| // Called when a consumer has candidate URLs for the system to prefetch. |
| @@ -43,6 +54,14 @@ class PrefetchService : public KeyedService { |
| // Called to invalidate a single PrefetchURL entry identified by |client_id|. |
| // If multiple have the same |client_id|, they will all be removed. |
| virtual void RemovePrefetchURLsByClientId(const ClientId& client_id) = 0; |
| + |
| + virtual void BeginBackgroundTask( |
|
carlosk
2017/04/19 23:01:38
nit: add descriptive comment.
|
| + std::unique_ptr<ScopedBackgroundTask> task) = 0; |
| + |
| + // Called when a task must stop immediately due to system constraints. After |
| + // this call completes, the system will reschedule the task based on whether |
| + // SetNeedsReschedule has been called. |
| + virtual void StopBackgroundTask(ScopedBackgroundTask* task) = 0; |
| }; |
| } // namespace offline_pages |