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

Unified Diff: chrome/browser/android/offline_pages/background_loader_offliner.h

Issue 2744553005: [Offline Pages] Turn Offliner::Cancel into an async operation to resolve conflicting assumptions be… (Closed)
Patch Set: 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
« no previous file with comments | « no previous file | chrome/browser/android/offline_pages/background_loader_offliner.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/android/offline_pages/background_loader_offliner.h
diff --git a/chrome/browser/android/offline_pages/background_loader_offliner.h b/chrome/browser/android/offline_pages/background_loader_offliner.h
index b08473a17e35438cc4ff885e84b1599c8a51a2bf..4dcd598ba9599177f27d29f1c6240abe3ca5d467 100644
--- a/chrome/browser/android/offline_pages/background_loader_offliner.h
+++ b/chrome/browser/android/offline_pages/background_loader_offliner.h
@@ -38,7 +38,7 @@ class BackgroundLoaderOffliner : public Offliner,
bool LoadAndSave(const SavePageRequest& request,
const CompletionCallback& completion_callback,
const ProgressCallback& progress_callback) override;
- void Cancel() override;
+ void Cancel(const CancelCallback& callback) override;
bool HandleTimeout(const SavePageRequest& request) override;
// WebContentsObserver implementation.
@@ -69,6 +69,8 @@ class BackgroundLoaderOffliner : public Offliner,
// Called when application state has changed.
void OnApplicationStateChange(
base::android::ApplicationState application_state);
+ void HandleApplicationStateChangeCancel(const SavePageRequest& request,
+ int64_t offline_id);
std::unique_ptr<background_loader::BackgroundLoaderContents> loader_;
// Not owned.
@@ -83,6 +85,7 @@ class BackgroundLoaderOffliner : public Offliner,
std::unique_ptr<base::android::ApplicationStatusListener> app_listener_;
// Whether we are on a low-end device.
bool is_low_end_device_;
+
// Save state.
SaveState save_state_;
// Page load state.
@@ -90,6 +93,9 @@ class BackgroundLoaderOffliner : public Offliner,
// Seconds to delay before taking snapshot.
long page_delay_ms_;
+ // Callback for cancel.
+ CancelCallback cancel_callback_;
+
base::WeakPtrFactory<BackgroundLoaderOffliner> weak_ptr_factory_;
DISALLOW_COPY_AND_ASSIGN(BackgroundLoaderOffliner);
};
« no previous file with comments | « no previous file | chrome/browser/android/offline_pages/background_loader_offliner.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698