| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 Loading... |
| 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_ |
| OLD | NEW |