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

Unified Diff: components/offline_pages/core/downloads/download_ui_adapter.cc

Issue 2700773003: [Offline Pages] Download UI: Remove all observers when clearing cache. (Closed)
Patch Set: 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 | components/offline_pages/core/downloads/download_ui_adapter_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/offline_pages/core/downloads/download_ui_adapter.cc
diff --git a/components/offline_pages/core/downloads/download_ui_adapter.cc b/components/offline_pages/core/downloads/download_ui_adapter.cc
index 118efd999d448fbfa05af0708044a97edab37698..bfc4526f042d79150909c6d5a2646569eaa5a38b 100644
--- a/components/offline_pages/core/downloads/download_ui_adapter.cc
+++ b/components/offline_pages/core/downloads/download_ui_adapter.cc
@@ -203,8 +203,10 @@ void DownloadUIAdapter::LoadCache() {
void DownloadUIAdapter::ClearCache() {
// Once loaded, this class starts to observe the model. Only remove observer
// if it was added.
- if (state_ == State::LOADED)
+ if (state_ == State::LOADED) {
model_->RemoveObserver(this);
+ request_coordinator_->RemoveObserver(this);
+ }
items_.clear();
state_ = State::NOT_LOADED;
}
« no previous file with comments | « no previous file | components/offline_pages/core/downloads/download_ui_adapter_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698