Chromium Code Reviews| Index: content/browser/background_fetch/background_fetch_data_manager.cc |
| diff --git a/content/browser/background_fetch/background_fetch_data_manager.cc b/content/browser/background_fetch/background_fetch_data_manager.cc |
| index cf277010a74f316a6700fdcdcea8481fd29a9aee..358b4f01a82afe9c96e12d51e96910bde93bc18e 100644 |
| --- a/content/browser/background_fetch/background_fetch_data_manager.cc |
| +++ b/content/browser/background_fetch/background_fetch_data_manager.cc |
| @@ -21,35 +21,37 @@ BackgroundFetchDataManager::~BackgroundFetchDataManager() = default; |
| std::unique_ptr<BackgroundFetchJobData> |
| BackgroundFetchDataManager::CreateRequest( |
| - const BackgroundFetchJobInfo& job_info, |
| + std::unique_ptr<BackgroundFetchJobInfo> job_info, |
| BackgroundFetchRequestInfos request_infos) { |
| - JobIdentifier id(job_info.service_worker_registration_id(), job_info.tag()); |
| + JobIdentifier id(job_info->service_worker_registration_id(), job_info->tag()); |
| // Ensure that this is not a duplicate request. |
| if (service_worker_tag_map_.find(id) != service_worker_tag_map_.end()) { |
| - DVLOG(1) << "Origin " << job_info.origin() |
| + DVLOG(1) << "Origin " << job_info->origin() |
| << " has already created a batch request with tag " |
| - << job_info.tag(); |
| + << job_info->tag(); |
| // TODO(harkness) Figure out how to return errors like this. |
| return nullptr; |
| } |
| // Add the request to our maps and return a JobData to track the individual |
| // files in the request. |
| - service_worker_tag_map_[id] = job_info.guid(); |
| - WriteJobToStorage(job_info, std::move(request_infos)); |
| + const std::string& job_guid = job_info->guid(); |
|
Peter Beverloo
2017/03/20 18:42:41
drop &
harkness
2017/03/21 10:14:07
Done.
|
| + service_worker_tag_map_[id] = job_guid; |
| + WriteJobToStorage(std::move(job_info), std::move(request_infos)); |
| // TODO(harkness): Remove data when the job is complete. |
| return base::MakeUnique<BackgroundFetchJobData>( |
| - ReadRequestsFromStorage(job_info.guid())); |
| + ReadRequestsFromStorage(job_guid)); |
| } |
| void BackgroundFetchDataManager::WriteJobToStorage( |
| - const BackgroundFetchJobInfo& job_info, |
| + std::unique_ptr<BackgroundFetchJobInfo> job_info, |
| BackgroundFetchRequestInfos request_infos) { |
| // TODO(harkness): Replace these maps with actually writing to storage. |
| // TODO(harkness): Check for job_guid clash. |
| - job_map_[job_info.guid()] = job_info; |
| - request_map_[job_info.guid()] = std::move(request_infos); |
| + const std::string job_guid = job_info->guid(); |
| + job_map_[job_guid] = std::move(job_info); |
| + request_map_[job_guid] = std::move(request_infos); |
| } |
| // TODO(harkness): This should be changed to read (and cache) small numbers of |