Chromium Code Reviews| 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 708e8f543a3c277baf18ecb7095fedcb06420eab..e0386eceb497ce13252a9835cd2072af95ddc543 100644 |
| --- a/content/browser/background_fetch/background_fetch_data_manager.h |
| +++ b/content/browser/background_fetch/background_fetch_data_manager.h |
| @@ -11,13 +11,13 @@ |
| #include "base/macros.h" |
| #include "content/browser/background_fetch/background_fetch_job_data.h" |
| +#include "content/browser/background_fetch/background_fetch_job_info.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 |
| @@ -30,27 +30,32 @@ 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. 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( |
| + // store all of the necessary metadata to track the request. The caller takes |
| + // ownership of the JobData created. |
|
Peter Beverloo
2017/03/09 15:18:57
nit: You can delete "The caller...JobData created.
harkness
2017/03/09 18:35:31
Done.
|
| + std::unique_ptr<BackgroundFetchJobData> CreateRequest( |
| const BackgroundFetchJobInfo& job_info, |
| BackgroundFetchRequestInfos request_infos); |
| private: |
| + void WriteJobToStorage(const BackgroundFetchJobInfo& job_info, |
| + BackgroundFetchRequestInfos request_infos); |
| + |
| + BackgroundFetchRequestInfos& ReadRequestsFromStorage( |
| + const std::string& job_guid); |
| + |
| // 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 JobData for that tag. |
| + // Map from <sw_registration_id, tag> to the job_guid 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_; |
| + // Temporary map to hold data which will be written to storage. |
| + // Map from job_guid to JobInfo. |
| + std::unordered_map<std::string, BackgroundFetchJobInfo> job_map_; |
| + // Map from job_guid to RequestInfos. |
| + std::unordered_map<std::string, BackgroundFetchRequestInfos> request_map_; |
| DISALLOW_COPY_AND_ASSIGN(BackgroundFetchDataManager); |
| }; |