| 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 11e58e55e29e346b3f6401a6ff88453894faa52f..f27666efc7abae886b1838eaba08b7b4ed69fa96 100644
|
| --- a/content/browser/background_fetch/background_fetch_context.cc
|
| +++ b/content/browser/background_fetch/background_fetch_context.cc
|
| @@ -44,14 +44,18 @@ BackgroundFetchContext::BackgroundFetchContext(
|
| event_dispatcher_(base::MakeUnique<BackgroundFetchEventDispatcher>(
|
| std::move(service_worker_context))) {
|
| DCHECK_CURRENTLY_ON(BrowserThread::UI);
|
| - request_context_ =
|
| - make_scoped_refptr(storage_partition->GetURLRequestContext());
|
| }
|
|
|
| BackgroundFetchContext::~BackgroundFetchContext() {
|
| DCHECK_CURRENTLY_ON(BrowserThread::UI);
|
| }
|
|
|
| +void BackgroundFetchContext::InitializeOnIOThread(
|
| + scoped_refptr<net::URLRequestContextGetter> request_context_getter) {
|
| + DCHECK_CURRENTLY_ON(BrowserThread::IO);
|
| + request_context_getter_ = request_context_getter;
|
| +}
|
| +
|
| void BackgroundFetchContext::Shutdown() {
|
| DCHECK_CURRENTLY_ON(BrowserThread::UI);
|
| BrowserThread::PostTask(
|
| @@ -146,12 +150,12 @@ void BackgroundFetchContext::CreateController(
|
| std::unique_ptr<BackgroundFetchJobController> controller =
|
| base::MakeUnique<BackgroundFetchJobController>(
|
| registration_id, options, data_manager_.get(), browser_context_,
|
| - request_context_,
|
| + request_context_getter_,
|
| base::BindOnce(&BackgroundFetchContext::DidCompleteJob, this));
|
|
|
| // TODO(peter): We should actually be able to use Background Fetch in layout
|
| // tests. That requires a download manager and a request context.
|
| - if (request_context_) {
|
| + if (request_context_getter_) {
|
| // Start fetching the |initial_requests| immediately. At some point in the
|
| // future we may want a more elaborate scheduling mechanism here.
|
| controller->Start(std::move(initial_requests));
|
|
|