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

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

Issue 2715433006: [Offline Pages] Turn Offliner::Cancel into an async operation to resolve conflicting assumptions (Closed)
Patch Set: forgot to init 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
« 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 95efc424960a3e01e87fd1b4fd6e0bc771749f71..efb3dfb6bff31b3bfd4692b614b002b217d6decd 100644
--- a/chrome/browser/android/offline_pages/background_loader_offliner.h
+++ b/chrome/browser/android/offline_pages/background_loader_offliner.h
@@ -37,7 +37,7 @@ class BackgroundLoaderOffliner : public Offliner,
// Offliner implementation.
bool LoadAndSave(const SavePageRequest& request,
const CompletionCallback& callback) override;
- void Cancel() override;
+ void Cancel(const CancelCallback& callback) override;
bool HandleTimeout(const SavePageRequest& request) override;
// WebContentsObserver implementation.
@@ -68,6 +68,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.
@@ -82,6 +84,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.
@@ -89,6 +92,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