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

Side by Side Diff: chrome/browser/memory/tab_manager.h

Issue 2167843004: Discardable property support on TabManager (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CHROME_BROWSER_MEMORY_TAB_MANAGER_H_ 5 #ifndef CHROME_BROWSER_MEMORY_TAB_MANAGER_H_
6 #define CHROME_BROWSER_MEMORY_TAB_MANAGER_H_ 6 #define CHROME_BROWSER_MEMORY_TAB_MANAGER_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <memory> 10 #include <memory>
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 void set_test_tick_clock(base::TickClock* test_tick_clock); 121 void set_test_tick_clock(base::TickClock* test_tick_clock);
122 122
123 // Returns the list of the stats for all renderers. Must be called on the UI 123 // Returns the list of the stats for all renderers. Must be called on the UI
124 // thread. 124 // thread.
125 TabStatsList GetUnsortedTabStats(); 125 TabStatsList GetUnsortedTabStats();
126 126
127 // Add/remove observers. 127 // Add/remove observers.
128 void AddObserver(TabManagerObserver* observer); 128 void AddObserver(TabManagerObserver* observer);
129 void RemoveObserver(TabManagerObserver* observer); 129 void RemoveObserver(TabManagerObserver* observer);
130 130
131 // Returns true if the tab is auto discardable by auto discarding feature.
Georges Khalil 2016/07/22 15:07:57 nit: reword the comment Returns the auto discarda
Anderson Silva 2016/07/22 15:34:51 Done.
132 bool IsTabAutoDiscardable(content::WebContents* contents) const;
133
134 // Sets/clears the AutoDiscardable state of the tab.
135 void SetTabAutoDiscardableState(content::WebContents* contents, bool state);
Georges Khalil 2016/07/22 15:07:57 nit: s/AutoDiscardable/auto discardable
Anderson Silva 2016/07/22 15:34:51 Done.
136
131 private: 137 private:
132 FRIEND_TEST_ALL_PREFIXES(TabManagerTest, CanOnlyDiscardOnce); 138 FRIEND_TEST_ALL_PREFIXES(TabManagerTest, CanOnlyDiscardOnce);
133 FRIEND_TEST_ALL_PREFIXES(TabManagerTest, ChildProcessNotifications); 139 FRIEND_TEST_ALL_PREFIXES(TabManagerTest, ChildProcessNotifications);
134 FRIEND_TEST_ALL_PREFIXES(TabManagerTest, Comparator); 140 FRIEND_TEST_ALL_PREFIXES(TabManagerTest, Comparator);
135 FRIEND_TEST_ALL_PREFIXES(TabManagerTest, DiscardedTabKeepsLastActiveTime); 141 FRIEND_TEST_ALL_PREFIXES(TabManagerTest, DiscardedTabKeepsLastActiveTime);
136 FRIEND_TEST_ALL_PREFIXES(TabManagerTest, DiscardWebContentsAt); 142 FRIEND_TEST_ALL_PREFIXES(TabManagerTest, DiscardWebContentsAt);
137 FRIEND_TEST_ALL_PREFIXES(TabManagerTest, InvalidOrEmptyURL); 143 FRIEND_TEST_ALL_PREFIXES(TabManagerTest, InvalidOrEmptyURL);
138 FRIEND_TEST_ALL_PREFIXES(TabManagerTest, IsInternalPage); 144 FRIEND_TEST_ALL_PREFIXES(TabManagerTest, IsInternalPage);
139 FRIEND_TEST_ALL_PREFIXES(TabManagerTest, OomPressureListener); 145 FRIEND_TEST_ALL_PREFIXES(TabManagerTest, OomPressureListener);
140 FRIEND_TEST_ALL_PREFIXES(TabManagerTest, ProtectPDFPages); 146 FRIEND_TEST_ALL_PREFIXES(TabManagerTest, ProtectPDFPages);
141 FRIEND_TEST_ALL_PREFIXES(TabManagerTest, ProtectRecentlyUsedTabs); 147 FRIEND_TEST_ALL_PREFIXES(TabManagerTest, ProtectRecentlyUsedTabs);
142 FRIEND_TEST_ALL_PREFIXES(TabManagerTest, ProtectVideoTabs); 148 FRIEND_TEST_ALL_PREFIXES(TabManagerTest, ProtectVideoTabs);
143 FRIEND_TEST_ALL_PREFIXES(TabManagerTest, ReloadDiscardedTabContextMenu); 149 FRIEND_TEST_ALL_PREFIXES(TabManagerTest, ReloadDiscardedTabContextMenu);
144 FRIEND_TEST_ALL_PREFIXES(TabManagerTest, TabManagerBasics); 150 FRIEND_TEST_ALL_PREFIXES(TabManagerTest, TabManagerBasics);
145 151
146 // This is needed so WebContentsData can call OnDiscardedStateChange. 152 // This is needed so WebContentsData can call OnDiscardedStateChange.
147 friend class WebContensData; 153 friend class WebContensData;
148 154
149 // Called by WebContentsData whenever the discard state of a WebContents 155 // Called by WebContentsData whenever the discard state of a WebContents
150 // changes, so that observers can be informed. 156 // changes, so that observers can be informed.
151 void OnDiscardedStateChange(content::WebContents* contents, 157 void OnDiscardedStateChange(content::WebContents* contents,
152 bool is_discarded); 158 bool is_discarded);
153 159
160 // Called by WebContentsData whenever the AutoDiscardable state of a
161 // WebContents
Georges Khalil 2016/07/22 15:07:57 nit: line ending. nit: s/AutoDiscardable/auto disc
Anderson Silva 2016/07/22 15:34:51 Done.
162 // changes, so that observers can be informed.
163 void OnAutoDiscardableStateChange(content::WebContents* contents,
164 bool is_auto_discardable);
165
154 // The time that a renderer is given to react to a memory pressure 166 // The time that a renderer is given to react to a memory pressure
155 // notification before another renderer is also notified. This prevents all 167 // notification before another renderer is also notified. This prevents all
156 // renderers from receiving and acting upon notifications simultaneously, 168 // renderers from receiving and acting upon notifications simultaneously,
157 // which can quickly overload a system. Exposed for unittesting. 169 // which can quickly overload a system. Exposed for unittesting.
158 // NOTE: This value needs to be big enough to allow a process to get over the 170 // NOTE: This value needs to be big enough to allow a process to get over the
159 // hump in responding to memory pressure, so there aren't multiple processes 171 // hump in responding to memory pressure, so there aren't multiple processes
160 // fighting for CPU and worse, temporary memory, while trying to free things 172 // fighting for CPU and worse, temporary memory, while trying to free things
161 // up. Similarly, it shouldn't be too large otherwise it will take too long 173 // up. Similarly, it shouldn't be too large otherwise it will take too long
162 // for the entire system to respond. Ideally, there would be a callback from a 174 // for the entire system to respond. Ideally, there would be a callback from a
163 // child process indicating that the message has been handled. In the meantime 175 // child process indicating that the message has been handled. In the meantime
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
348 360
349 // Weak pointer factory used for posting delayed tasks to task_runner_. 361 // Weak pointer factory used for posting delayed tasks to task_runner_.
350 base::WeakPtrFactory<TabManager> weak_ptr_factory_; 362 base::WeakPtrFactory<TabManager> weak_ptr_factory_;
351 363
352 DISALLOW_COPY_AND_ASSIGN(TabManager); 364 DISALLOW_COPY_AND_ASSIGN(TabManager);
353 }; 365 };
354 366
355 } // namespace memory 367 } // namespace memory
356 368
357 #endif // CHROME_BROWSER_MEMORY_TAB_MANAGER_H_ 369 #endif // CHROME_BROWSER_MEMORY_TAB_MANAGER_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/memory/tab_manager.cc » ('j') | chrome/browser/memory/tab_manager_observer.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698