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

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

Issue 2708943002: Create the BackgroundFetchBatchManager and initiate a download. (Closed)
Patch Set: fixed nits Created 3 years, 10 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 5e7301c48c1f952245b83300bd1c980d4d0e27b9..2fde2c68454d1fabccfca1805a53360911a1802a 100644
--- a/content/browser/background_fetch/background_fetch_context.cc
+++ b/content/browser/background_fetch/background_fetch_context.cc
@@ -4,7 +4,8 @@
#include "content/browser/background_fetch/background_fetch_context.h"
-#include "content/browser/background_fetch/fetch_request.h"
+#include "content/browser/background_fetch/background_fetch_job_info.h"
+#include "content/browser/background_fetch/background_fetch_request_info.h"
#include "content/browser/service_worker/service_worker_context_wrapper.h"
#include "content/public/browser/browser_context.h"
#include "content/public/browser/browser_thread.h"
@@ -15,8 +16,10 @@ namespace content {
BackgroundFetchContext::BackgroundFetchContext(
BrowserContext* browser_context,
+ StoragePartition* storage_partition,
const scoped_refptr<ServiceWorkerContextWrapper>& service_worker_context)
: service_worker_context_(service_worker_context),
+ background_fetch_job_controller_(browser_context, storage_partition),
background_fetch_data_manager_(this) {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
// TODO(harkness): BackgroundFetchContext should have
@@ -32,19 +35,22 @@ void BackgroundFetchContext::Init() {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
// TODO(harkness): Create the Download observer.
- // TODO(harkness): Create the Batch manager.
}
void BackgroundFetchContext::Shutdown() {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
}
-void BackgroundFetchContext::CreateRequest(const FetchRequest& fetch_request) {
- DCHECK_CURRENTLY_ON(BrowserThread::UI);
+void BackgroundFetchContext::CreateRequest(
+ const BackgroundFetchJobInfo& job_info,
+ std::vector<BackgroundFetchRequestInfo>& request_infos) {
+ DCHECK_GE(1U, request_infos.size());
// Inform the data manager about the new download.
- background_fetch_data_manager_.CreateRequest(fetch_request);
-
- // TODO(harkness): Make the request to the download manager.
+ BackgroundFetchJobData* job_data =
+ background_fetch_data_manager_.CreateRequest(job_info, request_infos);
+ // If job_data is null, the DataManager will have logged an error.
+ if (job_data)
+ background_fetch_job_controller_.ProcessJob(job_info.guid(), job_data);
}
} // namespace content

Powered by Google App Engine
This is Rietveld 408576698