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); |
}; |