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..e38e9d4903dfa7d0fa3ca2f5219ccf1bc7e21c88 100644 |
--- a/content/browser/background_fetch/background_fetch_context.cc |
+++ b/content/browser/background_fetch/background_fetch_context.cc |
@@ -4,6 +4,7 @@ |
#include "content/browser/background_fetch/background_fetch_context.h" |
+#include "content/browser/background_fetch/batch_request.h" |
#include "content/browser/background_fetch/fetch_request.h" |
#include "content/browser/service_worker/service_worker_context_wrapper.h" |
#include "content/public/browser/browser_context.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_batch_manager_(browser_context, storage_partition), |
background_fetch_data_manager_(this) { |
DCHECK_CURRENTLY_ON(BrowserThread::UI); |
// TODO(harkness): BackgroundFetchContext should have |
@@ -32,19 +35,25 @@ 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) { |
+void BackgroundFetchContext::CreateRequest( |
+ const BatchRequest& batch_request, |
+ const std::vector<FetchRequest>& fetch_requests) { |
DCHECK_CURRENTLY_ON(BrowserThread::UI); |
Peter Beverloo
2017/02/24 02:05:15
qq: why UI?
harkness
2017/02/24 11:47:10
Left over from an initial plan. Once I move the Da
|
+ DCHECK_GE(1U, fetch_requests.size()); |
// Inform the data manager about the new download. |
- background_fetch_data_manager_.CreateRequest(fetch_request); |
+ BackgroundFetchDataManager::BatchData* batch_data = |
+ background_fetch_data_manager_.CreateRequest(batch_request, |
+ fetch_requests); |
+ DCHECK(batch_data); |
Peter Beverloo
2017/02/24 02:05:15
We shouldn't crash the entire browser when a Servi
harkness
2017/02/24 11:47:10
Good point, and the error logging is already done
|
- // TODO(harkness): Make the request to the download manager. |
+ background_fetch_batch_manager_.ProcessBatch(batch_request.guid(), |
+ batch_data); |
} |
} // namespace content |