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

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

Issue 2753583002: Add the JobComplete callback and error/interrupt information (Closed)
Patch Set: Missed two files because of rebasing, oops. 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 b53501824990fedfd00c626eec4555497fe911c9..0279e3d17b564e795e445829076a0c60ead38931 100644
--- a/content/browser/background_fetch/background_fetch_job_controller.h
+++ b/content/browser/background_fetch/background_fetch_job_controller.h
@@ -9,6 +9,7 @@
#include <string>
#include <unordered_map>
+#include "base/callback.h"
#include "base/macros.h"
#include "base/memory/weak_ptr.h"
#include "content/common/content_export.h"
@@ -27,11 +28,13 @@ class StoragePartition;
class CONTENT_EXPORT BackgroundFetchJobController
: public DownloadItem::Observer {
public:
- BackgroundFetchJobController(
- const std::string& job_guid,
- BrowserContext* browser_context,
- StoragePartition* storage_partition,
- std::unique_ptr<BackgroundFetchJobData> job_data);
+ using JobCompleteCallback = base::Callback<void()>;
Peter Beverloo 2017/03/15 16:53:38 base::OnceClosure. Can also drop the typedef that
harkness 2017/03/16 11:41:09 I had hesitated on this based on the discussions a
+
+ BackgroundFetchJobController(const std::string& job_guid,
+ BrowserContext* browser_context,
+ StoragePartition* storage_partition,
+ std::unique_ptr<BackgroundFetchJobData> job_data,
+ const JobCompleteCallback& callback);
Peter Beverloo 2017/03/15 16:53:38 nit: drop const& if you can use OnceClosure and st
Peter Beverloo 2017/03/15 16:53:38 nit: completed_callback?
harkness 2017/03/16 11:41:09 Done.
harkness 2017/03/16 11:41:09 Done.
~BackgroundFetchJobController() override;
// Start processing on a batch of requests. Some of these may already be in
@@ -67,6 +70,9 @@ class CONTENT_EXPORT BackgroundFetchJobController
// The JobData which talks to the DataManager for this job_guid.
std::unique_ptr<BackgroundFetchJobData> job_data_;
+ // Callback for when all fetches have been completed.
+ JobCompleteCallback callback_;
+
// Map from the GUID assigned by the DownloadManager to the request_guid.
std::unordered_map<std::string, std::string> download_guid_map_;

Powered by Google App Engine
This is Rietveld 408576698