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

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

Issue 2708943002: Create the BackgroundFetchBatchManager and initiate a download. (Closed)
Patch Set: Moved JobData into a stand-alone class and renamed to BackgroundFetchJobData Created 3 years, 10 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_data_manager.h
diff --git a/content/browser/background_fetch/background_fetch_data_manager.h b/content/browser/background_fetch/background_fetch_data_manager.h
index 3244a5556bbee2716813fd61dae52e967c9a644f..e494cddbf6dea5bf65b05a0f68bd3f95b78715ea 100644
--- a/content/browser/background_fetch/background_fetch_data_manager.h
+++ b/content/browser/background_fetch/background_fetch_data_manager.h
@@ -7,14 +7,16 @@
#include <map>
#include <string>
+#include <unordered_map>
#include "base/macros.h"
-#include "content/browser/background_fetch/fetch_request.h"
+#include "content/browser/background_fetch/background_fetch_job_data.h"
#include "content/common/content_export.h"
#include "url/origin.h"
namespace content {
+class BackgroundFetchJobInfo;
class BackgroundFetchContext;
Peter Beverloo 2017/02/28 03:32:54 nit: alphabetize
harkness 2017/02/28 11:31:08 Done.
harkness 2017/02/28 11:31:08 Done.
// The BackgroundFetchDataManager keeps track of all of the outstanding requests
@@ -28,17 +30,28 @@ class CONTENT_EXPORT BackgroundFetchDataManager {
~BackgroundFetchDataManager();
// Called by BackgroundFetchContext when a new request is started, this will
- // store all of the necessary metadata to track the request.
- void CreateRequest(const FetchRequest& fetch_request);
+ // store all of the necessary metadata to track the request. The lifetime of
+ // the returned pointer is tied to the lifetime of the
+ // BackgroundFetchDataManager.
+ // TODO(harkness): Lifetime should be tied to the lifetime of the associated
+ // JobController once there is a JobController per request.
Peter Beverloo 2017/02/28 03:32:54 Please do address this in a next CL, it's really f
harkness 2017/02/28 11:31:08 Acknowledged.
+ BackgroundFetchJobData* CreateRequest(
+ const BackgroundFetchJobInfo& job_info,
+ BackgroundFetchRequestInfos& request_infos);
private:
// BackgroundFetchContext owns this BackgroundFetchDataManager, so the
// DataManager is guaranteed to be destructed before the Context.
BackgroundFetchContext* background_fetch_context_;
- // Map from <sw_registration_id, tag> to the FetchRequest for that tag.
- using FetchIdentifier = std::pair<int64_t, std::string>;
- std::map<FetchIdentifier, FetchRequest> fetch_map_;
+ // Map from <sw_registration_id, tag> to the BackgroundFetchJobInfo for that
Peter Beverloo 2017/02/28 03:32:54 JobInfo -> JobData
harkness 2017/02/28 11:31:08 Done.
+ // tag.
+ using JobIdentifier = std::pair<int64_t, std::string>;
+ std::map<JobIdentifier, std::string> service_worker_tag_map_;
+
+ // Map of batch guid to the associated BackgroundFetchJobData object.
+ std::unordered_map<std::string, std::unique_ptr<BackgroundFetchJobData>>
+ batch_map_;
DISALLOW_COPY_AND_ASSIGN(BackgroundFetchDataManager);
};

Powered by Google App Engine
This is Rietveld 408576698