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

Unified Diff: chrome/browser/chromeos/memory/oom_priority_manager.h

Issue 11879029: CrOS: Prefer discarding internal web UI pages when out of memory (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix nit, rebase Created 7 years, 11 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/chromeos/memory/oom_priority_manager.h
diff --git a/chrome/browser/chromeos/memory/oom_priority_manager.h b/chrome/browser/chromeos/memory/oom_priority_manager.h
index bad0a40ce058a320fa31825ec284cab2465bff35..4eced049c519f1232679a9898db751abb710c679 100644
--- a/chrome/browser/chromeos/memory/oom_priority_manager.h
+++ b/chrome/browser/chromeos/memory/oom_priority_manager.h
@@ -19,6 +19,8 @@
#include "content/public/browser/notification_observer.h"
#include "content/public/browser/notification_registrar.h"
+class GURL;
+
namespace chromeos {
class LowMemoryObserver;
@@ -59,11 +61,13 @@ class OomPriorityManager : public content::NotificationObserver {
private:
FRIEND_TEST_ALL_PREFIXES(OomPriorityManagerTest, Comparator);
+ FRIEND_TEST_ALL_PREFIXES(OomPriorityManagerTest, IsReloadableUI);
struct TabStats {
TabStats();
~TabStats();
bool is_app; // browser window is an app
+ bool is_reloadable_ui; // Reloadable web UI page, like NTP or Settings.
bool is_pinned;
bool is_selected; // selected in the currently active browser window
bool is_discarded;
@@ -74,6 +78,10 @@ class OomPriorityManager : public content::NotificationObserver {
};
typedef std::vector<TabStats> TabStatsList;
+ // Returns true if the |url| represents an internal Chrome web UI page that
+ // can be easily reloaded and hence makes a good choice to discard.
+ static bool IsReloadableUI(const GURL& url);
+
// Discards a tab with the given unique ID. Returns true if discard occurred.
bool DiscardTabById(int64 target_web_contents_id);

Powered by Google App Engine
This is Rietveld 408576698