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

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 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 private: 131 private:
132 FRIEND_TEST_ALL_PREFIXES(TabManagerObserverTest, OnDiscardableStateChange);
Georges Khalil 2016/07/21 20:51:51 Add Is/Set TabDiscardable functions, and no need f
Anderson Silva 2016/07/21 21:14:49 Done.
132 FRIEND_TEST_ALL_PREFIXES(TabManagerTest, CanOnlyDiscardOnce); 133 FRIEND_TEST_ALL_PREFIXES(TabManagerTest, CanOnlyDiscardOnce);
133 FRIEND_TEST_ALL_PREFIXES(TabManagerTest, ChildProcessNotifications); 134 FRIEND_TEST_ALL_PREFIXES(TabManagerTest, ChildProcessNotifications);
134 FRIEND_TEST_ALL_PREFIXES(TabManagerTest, Comparator); 135 FRIEND_TEST_ALL_PREFIXES(TabManagerTest, Comparator);
135 FRIEND_TEST_ALL_PREFIXES(TabManagerTest, DiscardedTabKeepsLastActiveTime); 136 FRIEND_TEST_ALL_PREFIXES(TabManagerTest, DiscardedTabKeepsLastActiveTime);
136 FRIEND_TEST_ALL_PREFIXES(TabManagerTest, DiscardWebContentsAt); 137 FRIEND_TEST_ALL_PREFIXES(TabManagerTest, DiscardWebContentsAt);
137 FRIEND_TEST_ALL_PREFIXES(TabManagerTest, InvalidOrEmptyURL); 138 FRIEND_TEST_ALL_PREFIXES(TabManagerTest, InvalidOrEmptyURL);
138 FRIEND_TEST_ALL_PREFIXES(TabManagerTest, IsInternalPage); 139 FRIEND_TEST_ALL_PREFIXES(TabManagerTest, IsInternalPage);
139 FRIEND_TEST_ALL_PREFIXES(TabManagerTest, OomPressureListener); 140 FRIEND_TEST_ALL_PREFIXES(TabManagerTest, OomPressureListener);
140 FRIEND_TEST_ALL_PREFIXES(TabManagerTest, ProtectPDFPages); 141 FRIEND_TEST_ALL_PREFIXES(TabManagerTest, ProtectPDFPages);
141 FRIEND_TEST_ALL_PREFIXES(TabManagerTest, ProtectRecentlyUsedTabs); 142 FRIEND_TEST_ALL_PREFIXES(TabManagerTest, ProtectRecentlyUsedTabs);
142 FRIEND_TEST_ALL_PREFIXES(TabManagerTest, ProtectVideoTabs); 143 FRIEND_TEST_ALL_PREFIXES(TabManagerTest, ProtectVideoTabs);
143 FRIEND_TEST_ALL_PREFIXES(TabManagerTest, ReloadDiscardedTabContextMenu); 144 FRIEND_TEST_ALL_PREFIXES(TabManagerTest, ReloadDiscardedTabContextMenu);
144 FRIEND_TEST_ALL_PREFIXES(TabManagerTest, TabManagerBasics); 145 FRIEND_TEST_ALL_PREFIXES(TabManagerTest, TabManagerBasics);
145 146
146 // This is needed so WebContentsData can call OnDiscardedStateChange. 147 // This is needed so WebContentsData can call OnDiscardedStateChange.
147 friend class WebContensData; 148 friend class WebContensData;
148 149
149 // Called by WebContentsData whenever the discard state of a WebContents 150 // Called by WebContentsData whenever the discard state of a WebContents
150 // changes, so that observers can be informed. 151 // changes, so that observers can be informed.
151 void OnDiscardedStateChange(content::WebContents* contents, 152 void OnDiscardedStateChange(content::WebContents* contents,
152 bool is_discarded); 153 bool is_discarded);
153 154
155 // Called by WebContentsData whenever the discardable state of a WebContents
156 // changes, so that observers can be informed.
157 void OnDiscardableStateChange(content::WebContents* contents,
158 bool is_discardable);
159
154 // The time that a renderer is given to react to a memory pressure 160 // The time that a renderer is given to react to a memory pressure
155 // notification before another renderer is also notified. This prevents all 161 // notification before another renderer is also notified. This prevents all
156 // renderers from receiving and acting upon notifications simultaneously, 162 // renderers from receiving and acting upon notifications simultaneously,
157 // which can quickly overload a system. Exposed for unittesting. 163 // 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 164 // 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 165 // 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 166 // 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 167 // 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 168 // 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 169 // 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 354
349 // Weak pointer factory used for posting delayed tasks to task_runner_. 355 // Weak pointer factory used for posting delayed tasks to task_runner_.
350 base::WeakPtrFactory<TabManager> weak_ptr_factory_; 356 base::WeakPtrFactory<TabManager> weak_ptr_factory_;
351 357
352 DISALLOW_COPY_AND_ASSIGN(TabManager); 358 DISALLOW_COPY_AND_ASSIGN(TabManager);
353 }; 359 };
354 360
355 } // namespace memory 361 } // namespace memory
356 362
357 #endif // CHROME_BROWSER_MEMORY_TAB_MANAGER_H_ 363 #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_web_contents_data.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698