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

Unified Diff: content/browser/background_fetch/background_fetch_context.cc

Issue 2753583002: Add the JobComplete callback and error/interrupt information (Closed)
Patch Set: added argument name Created 3 years, 9 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_context.cc
diff --git a/content/browser/background_fetch/background_fetch_context.cc b/content/browser/background_fetch/background_fetch_context.cc
index 55773de7211e66e8bc174fcde5c538af05a9c6ac..a6dfc65bf78c7db17c1be21ad27782dfc729e133 100644
--- a/content/browser/background_fetch/background_fetch_context.cc
+++ b/content/browser/background_fetch/background_fetch_context.cc
@@ -50,6 +50,8 @@ void BackgroundFetchContext::ShutdownOnIO() {
// any status to the DataManager.
for (auto& job : job_map_)
job.second->Shutdown();
+
+ job_map_.clear();
}
void BackgroundFetchContext::CreateRequest(
@@ -68,8 +70,19 @@ void BackgroundFetchContext::CreateRequest(
// the JobData to get information about individual requests for the job.
job_map_[job_info.guid()] = base::MakeUnique<BackgroundFetchJobController>(
job_info.guid(), browser_context_, storage_partition_,
- std::move(job_data));
+ std::move(job_data),
+ base::BindOnce(&BackgroundFetchContext::DidCompleteJob, this,
+ job_info.guid()));
}
}
+void BackgroundFetchContext::DidCompleteJob(const std::string& job_guid) {
+ DCHECK(job_map_.find(job_guid) != job_map_.end());
+
+ job_map_.erase(job_guid);
+
+ // TODO(harkness): Once the caller receives the message, inform the
+ // DataManager that it can clean up the pending job.
+}
+
} // namespace content

Powered by Google App Engine
This is Rietveld 408576698