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

Unified Diff: components/offline_pages/offline_page_model.cc

Issue 1764843003: Enable offline pages feature on trunk by default (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix Created 4 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 | « components/offline_pages/offline_page_feature.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/offline_pages/offline_page_model.cc
diff --git a/components/offline_pages/offline_page_model.cc b/components/offline_pages/offline_page_model.cc
index 7f4b60c139732de21e127b328f02147cd22f4c43..4808c3b89eacb8f4d4e336aa8a93558b4153b92b 100644
--- a/components/offline_pages/offline_page_model.cc
+++ b/components/offline_pages/offline_page_model.cc
@@ -284,7 +284,14 @@ void OfflinePageModel::ClearAll(const base::Closure& callback) {
}
bool OfflinePageModel::HasOfflinePages() const {
- DCHECK(is_loaded_);
+ // Since offline pages feature is enabled by default,
+ // NetErrorTabHelper::SetHasOfflinePages might call this before the model is
+ // fully loaded. To address this, we need to switch to asynchonous model
+ // (crbug.com/589526). But for now, we just bail out to work around the test
+ // issue.
+ if (!is_loaded_)
+ return false;
+
// Check that at least one page is not marked for deletion. Because we have
// pages marked for deletion, we cannot simply invert result of |empty()|.
for (const auto& id_page_pair : offline_pages_) {
« no previous file with comments | « components/offline_pages/offline_page_feature.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698