| Index: chrome/browser/android/offline_pages/background_loader_offliner.cc
|
| diff --git a/chrome/browser/android/offline_pages/background_loader_offliner.cc b/chrome/browser/android/offline_pages/background_loader_offliner.cc
|
| index 5e18f9ff775e7b475516983c5c80758c501e1a8c..4b5d23b335f9d913d671671ce9c45e3a682c79ba 100644
|
| --- a/chrome/browser/android/offline_pages/background_loader_offliner.cc
|
| +++ b/chrome/browser/android/offline_pages/background_loader_offliner.cc
|
| @@ -149,8 +149,8 @@ bool BackgroundLoaderOffliner::LoadAndSave(
|
| return false;
|
| }
|
|
|
| - if (!loader_)
|
| - ResetState();
|
| + ResetLoader();
|
| + AttachObservers();
|
|
|
| // Track copy of pending request.
|
| pending_request_.reset(new SavePageRequest(request));
|
| @@ -355,13 +355,16 @@ void BackgroundLoaderOffliner::ResetState() {
|
| snapshot_controller_.reset();
|
| page_load_state_ = SUCCESS;
|
| network_bytes_ = 0LL;
|
| - // TODO(chili): Remove after RequestCoordinator can handle multiple offliners.
|
| - // We reset the loader and observer after completion so loaders
|
| - // will not be re-used across different requests/tries. This is a temporary
|
| - // solution while there exists assumptions about the number of offliners
|
| - // there are.
|
| + content::WebContentsObserver::Observe(nullptr);
|
| + loader_.reset();
|
| +}
|
| +
|
| +void BackgroundLoaderOffliner::ResetLoader() {
|
| loader_.reset(
|
| new background_loader::BackgroundLoaderContents(browser_context_));
|
| +}
|
| +
|
| +void BackgroundLoaderOffliner::AttachObservers() {
|
| content::WebContents* contents = loader_->web_contents();
|
| content::WebContentsObserver::Observe(contents);
|
| OfflinerData::AddToWebContents(contents, this);
|
|
|