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

Unified Diff: chrome/browser/android/offline_pages/recent_tab_helper.cc

Issue 2705453003: Last_n: disable on Svelte devices. (Closed)
Patch Set: Detect low end device through delegate; add pointer to default test delegate. 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
Index: chrome/browser/android/offline_pages/recent_tab_helper.cc
diff --git a/chrome/browser/android/offline_pages/recent_tab_helper.cc b/chrome/browser/android/offline_pages/recent_tab_helper.cc
index 1be59e3e1a62eaca49056769098d98b2ef67ff81..dd9ff36d2e485dee35a79150af482c2796426d46 100644
--- a/chrome/browser/android/offline_pages/recent_tab_helper.cc
+++ b/chrome/browser/android/offline_pages/recent_tab_helper.cc
@@ -13,6 +13,7 @@
#include "base/memory/ptr_util.h"
#include "base/metrics/histogram_macros.h"
#include "base/strings/string_number_conversions.h"
+#include "base/sys_info.h"
#include "base/threading/thread_task_runner_handle.h"
#include "base/time/time.h"
#include "chrome/browser/android/offline_pages/downloads/offline_page_notification_bridge.h"
@@ -35,7 +36,7 @@ DEFINE_WEB_CONTENTS_USER_DATA_KEY(offline_pages::RecentTabHelper);
namespace {
class DefaultDelegate: public offline_pages::RecentTabHelper::Delegate {
public:
- DefaultDelegate() {}
+ DefaultDelegate() : is_low_end_device_(base::SysInfo::IsLowEndDevice()) {}
// offline_pages::RecentTabHelper::Delegate
std::unique_ptr<offline_pages::OfflinePageArchiver> CreatePageArchiver(
@@ -49,6 +50,11 @@ class DefaultDelegate: public offline_pages::RecentTabHelper::Delegate {
bool GetTabId(content::WebContents* web_contents, int* tab_id) override {
return offline_pages::OfflinePageUtils::GetTabId(web_contents, tab_id);
}
+ bool IsLowEndDevice() override { return is_low_end_device_; }
+
+ private:
+ // Cached value of whether low end device.
+ bool is_low_end_device_;
};
} // namespace
@@ -212,7 +218,8 @@ void RecentTabHelper::DidFinishNavigation(
if (!can_save)
snapshot_controller_->Stop();
- last_n_listen_to_tab_hidden_ = can_save && IsOffliningRecentPagesEnabled();
+ last_n_listen_to_tab_hidden_ = can_save && !delegate_->IsLowEndDevice() &&
+ IsOffliningRecentPagesEnabled();
last_n_latest_saved_quality_ = PageQuality::POOR;
}

Powered by Google App Engine
This is Rietveld 408576698