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

Unified Diff: chrome/browser/memory/tab_manager.h

Issue 2153943002: Implementing TabManager extensions API Discard Function. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: testcases Created 4 years, 5 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/memory/tab_manager.h
diff --git a/chrome/browser/memory/tab_manager.h b/chrome/browser/memory/tab_manager.h
index cd5c3480417bf76976c8a3849ae4d0e5fe6c5057..7719fbbb54fa375775961903e87d1b27e83db4f7 100644
--- a/chrome/browser/memory/tab_manager.h
+++ b/chrome/browser/memory/tab_manager.h
@@ -108,6 +108,10 @@ class TabManager : public TabStripModelObserver {
// that got discarded. This value is mostly useful during testing.
content::WebContents* DiscardTabById(int64_t target_web_contents_id);
+ // If |contents| is null, discards the least important tab using DiscardTab().
Georges Khalil 2016/07/19 19:39:45 Start comment by explaining that this is the funct
Anderson Silva 2016/07/19 20:28:42 Done.
+ // Otherwise discards the given contents.
+ content::WebContents* DiscardTabByExtension(content::WebContents* contents);
+
// Log memory statistics for the running processes, then discards a tab.
// Tab discard happens sometime later, as collecting the statistics touches
// multiple threads and takes time.
@@ -128,6 +132,9 @@ class TabManager : public TabStripModelObserver {
void AddObserver(TabManagerObserver* observer);
void RemoveObserver(TabManagerObserver* observer);
+ // Used in tets to change the protection time of the tabs.
Georges Khalil 2016/07/19 19:39:45 nit: tets -> tests.
+ void set_minimum_protection_time_for_tests(unsigned int time_seconds);
Georges Khalil 2016/07/19 19:39:45 This should take a base::TimeDelta so there's no c
Anderson Silva 2016/07/19 20:28:42 Done.
+
private:
FRIEND_TEST_ALL_PREFIXES(TabManagerTest, CanOnlyDiscardOnce);
FRIEND_TEST_ALL_PREFIXES(TabManagerTest, ChildProcessNotifications);
@@ -257,7 +264,7 @@ class TabManager : public TabStripModelObserver {
void DoChildProcessDispatch();
// Implementation of DiscardTab.
Georges Khalil 2016/07/19 19:39:45 Add comment about return value.
- bool DiscardTabImpl();
+ content::WebContents* DiscardTabImpl();
// Returns true if tabs can be discarded only once.
bool CanOnlyDiscardOnce();

Powered by Google App Engine
This is Rietveld 408576698