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

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

Issue 2708943002: Create the BackgroundFetchBatchManager and initiate a download. (Closed)
Patch Set: fixed nits 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..708e8f543a3c277baf18ecb7095fedcb06420eab 100644
--- a/content/browser/background_fetch/background_fetch_data_manager.h
+++ b/content/browser/background_fetch/background_fetch_data_manager.h
@@ -7,15 +7,17 @@
#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 BackgroundFetchContext;
+class BackgroundFetchJobInfo;
// The BackgroundFetchDataManager keeps track of all of the outstanding requests
// which are in process in the DownloadManager. When Chromium restarts, it is
@@ -28,17 +30,27 @@ 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.
+ 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 JobData for that 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