Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(484)

Unified Diff: content/browser/background_fetch/background_fetch_job_controller.h

Issue 2776353004: Give the BackgroundFetchJobController a simple state. (Closed)
Patch Set: Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: content/browser/background_fetch/background_fetch_job_controller.h
diff --git a/content/browser/background_fetch/background_fetch_job_controller.h b/content/browser/background_fetch/background_fetch_job_controller.h
index 5d4fdcc7f006abfde28b6c958df77fa485ed549b..eac97eff46b74f0a2de7a7463b1ba2169c1741b6 100644
--- a/content/browser/background_fetch/background_fetch_job_controller.h
+++ b/content/browser/background_fetch/background_fetch_job_controller.h
@@ -30,9 +30,10 @@ class StoragePartition;
class CONTENT_EXPORT BackgroundFetchJobController
: public DownloadItem::Observer {
public:
+ enum class State { INITIALIZED, FETCHING, ABORTED, COMPLETED };
+
using CompletedCallback =
- base::OnceCallback<void(const BackgroundFetchRegistrationId&,
- bool /* aborted_by_developer */)>;
+ base::OnceCallback<void(BackgroundFetchJobController*)>;
harkness 2017/03/28 14:55:43 optional: personally, I would have this callback r
Peter Beverloo 2017/03/29 13:05:22 I'm keeping this as-is for now. We can reduce the
BackgroundFetchJobController(
const BackgroundFetchRegistrationId& registration_id,
@@ -57,6 +58,9 @@ class CONTENT_EXPORT BackgroundFetchJobController
// Called by the BackgroundFetchContext when the system is shutting down.
void Shutdown();
+ // Returns the current state of this Job Controller.
+ State state() const { return state_; }
+
// Returns the registration id for which this job is fetching data.
const BackgroundFetchRegistrationId& registration_id() const {
return registration_id_;
@@ -84,6 +88,9 @@ class CONTENT_EXPORT BackgroundFetchJobController
// Options for the represented background fetch registration.
BackgroundFetchOptions options_;
+ // The current state of this Job Controller.
+ State state_ = State::INITIALIZED;
+
// TODO(peter): Deprecated, remove in favor of |registration_id|.
std::string job_guid_;

Powered by Google App Engine
This is Rietveld 408576698