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

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

Issue 2753583002: Add the JobComplete callback and error/interrupt information (Closed)
Patch Set: Missed two files because of rebasing, oops. 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..d78222d9ac41c42e872bb3dcfdc143cc1c1a0e5f 100644
--- a/content/browser/background_fetch/background_fetch_context.cc
+++ b/content/browser/background_fetch/background_fetch_context.cc
@@ -68,8 +68,22 @@ 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::Bind(&BackgroundFetchContext::JobComplete, this,
+ job_info.guid()));
Peter Beverloo 2017/03/15 16:53:38 We need to clear job_map_ in ShutdownOnIO. This cr
harkness 2017/03/16 11:41:09 Done.
}
}
+void BackgroundFetchContext::JobComplete(const std::string& job_guid) {
+ DCHECK(job_map_.find(job_guid) != job_map_.end());
+
+ // TODO(harkness): Get enough data to send the response back to the
+ // caller.
Peter Beverloo 2017/03/15 16:53:38 micro nit: same re: the TODO
harkness 2017/03/16 11:41:09 Done.
+
+ 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