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

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

Issue 1867343002: [TabManager] [Merge M50] Protect tabs opened in background. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2661
Patch Set: Created 4 years, 8 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
« no previous file with comments | « no previous file | chrome/browser/memory/tab_manager.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 <set> 10 #include <set>
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 110
111 // Used to set the test TickClock, which then gets used by NowTicks(). See 111 // Used to set the test TickClock, which then gets used by NowTicks(). See
112 // |test_tick_clock_| for more details. 112 // |test_tick_clock_| for more details.
113 void set_test_tick_clock(base::TickClock* test_tick_clock); 113 void set_test_tick_clock(base::TickClock* test_tick_clock);
114 114
115 private: 115 private:
116 FRIEND_TEST_ALL_PREFIXES(TabManagerTest, ChildProcessNotifications); 116 FRIEND_TEST_ALL_PREFIXES(TabManagerTest, ChildProcessNotifications);
117 FRIEND_TEST_ALL_PREFIXES(TabManagerTest, Comparator); 117 FRIEND_TEST_ALL_PREFIXES(TabManagerTest, Comparator);
118 FRIEND_TEST_ALL_PREFIXES(TabManagerTest, DiscardedTabKeepsLastActiveTime); 118 FRIEND_TEST_ALL_PREFIXES(TabManagerTest, DiscardedTabKeepsLastActiveTime);
119 FRIEND_TEST_ALL_PREFIXES(TabManagerTest, DiscardWebContentsAt); 119 FRIEND_TEST_ALL_PREFIXES(TabManagerTest, DiscardWebContentsAt);
120 FRIEND_TEST_ALL_PREFIXES(TabManagerTest, InvalidOrEmptyURL);
120 FRIEND_TEST_ALL_PREFIXES(TabManagerTest, IsInternalPage); 121 FRIEND_TEST_ALL_PREFIXES(TabManagerTest, IsInternalPage);
121 FRIEND_TEST_ALL_PREFIXES(TabManagerTest, OomPressureListener); 122 FRIEND_TEST_ALL_PREFIXES(TabManagerTest, OomPressureListener);
122 FRIEND_TEST_ALL_PREFIXES(TabManagerTest, ProtectRecentlyUsedTabs); 123 FRIEND_TEST_ALL_PREFIXES(TabManagerTest, ProtectRecentlyUsedTabs);
124 FRIEND_TEST_ALL_PREFIXES(TabManagerTest, ProtectVideoTabs);
123 FRIEND_TEST_ALL_PREFIXES(TabManagerTest, ReloadDiscardedTabContextMenu); 125 FRIEND_TEST_ALL_PREFIXES(TabManagerTest, ReloadDiscardedTabContextMenu);
124 FRIEND_TEST_ALL_PREFIXES(TabManagerTest, TabManagerBasics); 126 FRIEND_TEST_ALL_PREFIXES(TabManagerTest, TabManagerBasics);
125 127
126 // The time that a renderer is given to react to a memory pressure 128 // The time that a renderer is given to react to a memory pressure
127 // notification before another renderer is also notified. This prevents all 129 // notification before another renderer is also notified. This prevents all
128 // renderers from receiving and acting upon notifications simultaneously, 130 // renderers from receiving and acting upon notifications simultaneously,
129 // which can quickly overload a system. Exposed for unittesting. 131 // which can quickly overload a system. Exposed for unittesting.
130 // NOTE: This value needs to be big enough to allow a process to get over the 132 // NOTE: This value needs to be big enough to allow a process to get over the
131 // hump in responding to memory pressure, so there aren't multiple processes 133 // hump in responding to memory pressure, so there aren't multiple processes
132 // fighting for CPU and worse, temporary memory, while trying to free things 134 // fighting for CPU and worse, temporary memory, while trying to free things
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 base::MemoryPressureListener::MemoryPressureLevel memory_pressure_level); 200 base::MemoryPressureListener::MemoryPressureLevel memory_pressure_level);
199 201
200 // TabStripModelObserver overrides. 202 // TabStripModelObserver overrides.
201 void TabChangedAt(content::WebContents* contents, 203 void TabChangedAt(content::WebContents* contents,
202 int index, 204 int index,
203 TabChangeType change_type) override; 205 TabChangeType change_type) override;
204 void ActiveTabChanged(content::WebContents* old_contents, 206 void ActiveTabChanged(content::WebContents* old_contents,
205 content::WebContents* new_contents, 207 content::WebContents* new_contents,
206 int index, 208 int index,
207 int reason) override; 209 int reason) override;
210 void TabInsertedAt(content::WebContents* contents,
211 int index,
212 bool foreground) override;
208 213
209 // Returns true if the tab is currently playing audio or has played audio 214 // Returns true if the tab is currently playing audio or has played audio
210 // recently, or if the tab is currently accessing the camera, microphone or 215 // recently, or if the tab is currently accessing the camera, microphone or
211 // mirroring the display. 216 // mirroring the display.
212 bool IsMediaTab(content::WebContents* contents) const; 217 bool IsMediaTab(content::WebContents* contents) const;
213 218
214 // Returns the WebContentsData associated with |contents|. Also takes care of 219 // Returns the WebContentsData associated with |contents|. Also takes care of
215 // creating one if needed. 220 // creating one if needed.
216 WebContentsData* GetWebContentsData(content::WebContents* contents) const; 221 WebContentsData* GetWebContentsData(content::WebContents* contents) const;
217 222
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
310 315
311 // Weak pointer factory used for posting delayed tasks to task_runner_. 316 // Weak pointer factory used for posting delayed tasks to task_runner_.
312 base::WeakPtrFactory<TabManager> weak_ptr_factory_; 317 base::WeakPtrFactory<TabManager> weak_ptr_factory_;
313 318
314 DISALLOW_COPY_AND_ASSIGN(TabManager); 319 DISALLOW_COPY_AND_ASSIGN(TabManager);
315 }; 320 };
316 321
317 } // namespace memory 322 } // namespace memory
318 323
319 #endif // CHROME_BROWSER_MEMORY_TAB_MANAGER_H_ 324 #endif // CHROME_BROWSER_MEMORY_TAB_MANAGER_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/memory/tab_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698