Chromium Code Reviews| 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 <memory> | 10 #include <memory> |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 171 FRIEND_TEST_ALL_PREFIXES(TabManagerTest, InvalidOrEmptyURL); | 171 FRIEND_TEST_ALL_PREFIXES(TabManagerTest, InvalidOrEmptyURL); |
| 172 FRIEND_TEST_ALL_PREFIXES(TabManagerTest, IsInternalPage); | 172 FRIEND_TEST_ALL_PREFIXES(TabManagerTest, IsInternalPage); |
| 173 FRIEND_TEST_ALL_PREFIXES(TabManagerTest, OomPressureListener); | 173 FRIEND_TEST_ALL_PREFIXES(TabManagerTest, OomPressureListener); |
| 174 FRIEND_TEST_ALL_PREFIXES(TabManagerTest, ProtectPDFPages); | 174 FRIEND_TEST_ALL_PREFIXES(TabManagerTest, ProtectPDFPages); |
| 175 FRIEND_TEST_ALL_PREFIXES(TabManagerTest, ProtectRecentlyUsedTabs); | 175 FRIEND_TEST_ALL_PREFIXES(TabManagerTest, ProtectRecentlyUsedTabs); |
| 176 FRIEND_TEST_ALL_PREFIXES(TabManagerTest, ProtectVideoTabs); | 176 FRIEND_TEST_ALL_PREFIXES(TabManagerTest, ProtectVideoTabs); |
| 177 FRIEND_TEST_ALL_PREFIXES(TabManagerTest, ReloadDiscardedTabContextMenu); | 177 FRIEND_TEST_ALL_PREFIXES(TabManagerTest, ReloadDiscardedTabContextMenu); |
| 178 FRIEND_TEST_ALL_PREFIXES(TabManagerTest, TabManagerBasics); | 178 FRIEND_TEST_ALL_PREFIXES(TabManagerTest, TabManagerBasics); |
| 179 FRIEND_TEST_ALL_PREFIXES(TabManagerWebContentsDataTest, PurgeAndSuspendState); | 179 FRIEND_TEST_ALL_PREFIXES(TabManagerWebContentsDataTest, PurgeAndSuspendState); |
| 180 | 180 |
| 181 // The time of the first purging after a renderer is backgrounded. | |
| 182 // There is no strong reason why its default value is 30 minutes. | |
|
Wez
2017/02/17 19:03:14
nit: No need to say "no strong reason"; sufficient
tasak
2017/02/20 07:07:15
Done.
| |
| 183 // At least, the value should not be small, because quickly purging memory | |
| 184 // makes it slower to switch tabs. | |
| 185 static const int kDefaultTimeToFirstSuspensionSeconds = 1800; | |
|
Wez
2017/02/17 19:03:14
Note that you'll also need to fix this in the Finc
Wez
2017/02/17 19:03:14
nit: I'd suggest using "Suspend" rather than "Susp
tasak
2017/02/20 07:07:15
Done.
tasak
2017/02/20 07:07:15
Acknowledged.
| |
| 186 | |
| 181 // This is needed so WebContentsData can call OnDiscardedStateChange, and | 187 // This is needed so WebContentsData can call OnDiscardedStateChange, and |
| 182 // can use PurgeAndSuspendState. | 188 // can use PurgeAndSuspendState. |
| 183 friend class WebContentsData; | 189 friend class WebContentsData; |
| 184 | 190 |
| 185 // Called by WebContentsData whenever the discard state of a WebContents | 191 // Called by WebContentsData whenever the discard state of a WebContents |
| 186 // changes, so that observers can be informed. | 192 // changes, so that observers can be informed. |
| 187 void OnDiscardedStateChange(content::WebContents* contents, | 193 void OnDiscardedStateChange(content::WebContents* contents, |
| 188 bool is_discarded); | 194 bool is_discarded); |
| 189 | 195 |
| 190 // Called by WebContentsData whenever the auto-discardable state of a | 196 // Called by WebContentsData whenever the auto-discardable state of a |
| (...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 420 | 426 |
| 421 // Weak pointer factory used for posting delayed tasks to task_runner_. | 427 // Weak pointer factory used for posting delayed tasks to task_runner_. |
| 422 base::WeakPtrFactory<TabManager> weak_ptr_factory_; | 428 base::WeakPtrFactory<TabManager> weak_ptr_factory_; |
| 423 | 429 |
| 424 DISALLOW_COPY_AND_ASSIGN(TabManager); | 430 DISALLOW_COPY_AND_ASSIGN(TabManager); |
| 425 }; | 431 }; |
| 426 | 432 |
| 427 } // namespace memory | 433 } // namespace memory |
| 428 | 434 |
| 429 #endif // CHROME_BROWSER_MEMORY_TAB_MANAGER_H_ | 435 #endif // CHROME_BROWSER_MEMORY_TAB_MANAGER_H_ |
| OLD | NEW |