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

Unified Diff: components/offline_pages/snapshot_controller.cc

Issue 1936613002: Implementing recent pages snapshot capture. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: clang is my friend Created 4 years, 7 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
Index: components/offline_pages/snapshot_controller.cc
diff --git a/components/offline_pages/snapshot_controller.cc b/components/offline_pages/snapshot_controller.cc
index b086e486c34a505e5adbfb7711486d462f9ea652..374b9f561119b3fcb9feadfe97d591ae6d7c8940 100644
--- a/components/offline_pages/snapshot_controller.cc
+++ b/components/offline_pages/snapshot_controller.cc
@@ -31,6 +31,8 @@ SnapshotController::SnapshotController(
SnapshotController::~SnapshotController() {}
void SnapshotController::Reset() {
+ // Cancel potentially delayed tasks that relate to the previous 'session'.
+ weak_ptr_factory_.InvalidateWeakPtrs();
state_ = State::kReady;
}
@@ -67,8 +69,8 @@ void SnapshotController::DocumentOnLoadCompletedInMainFrame() {
void SnapshotController::MaybeStartSnapshot() {
if (state_ != State::kReady)
return;
- if (client_->StartSnapshot())
- state_ = State::kSnapshotPending;
+ state_ = State::kSnapshotPending;
+ client_->StartSnapshot();
}
size_t SnapshotController::GetDelayAfterDocumentAvailableForTest() {
« no previous file with comments | « components/offline_pages/snapshot_controller.h ('k') | components/offline_pages/snapshot_controller_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698