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 // The initial value was chosen because most of users activate backgrounded | |
183 // tabs within 30 minutes. (c.f. Tabs.StateTransfer.Time_Inactive_Active) | |
184 static const int kDefaultTimeToFirstPurgeInSeconds = 1800; | |
Wez
2017/02/22 01:25:10
nit: base::TimeDelta now has constexpr FromSeconds
tasak
2017/02/22 04:18:46
Done.
| |
185 | |
181 // This is needed so WebContentsData can call OnDiscardedStateChange, and | 186 // This is needed so WebContentsData can call OnDiscardedStateChange, and |
182 // can use PurgeAndSuspendState. | 187 // can use PurgeAndSuspendState. |
183 friend class WebContentsData; | 188 friend class WebContentsData; |
184 | 189 |
185 // Called by WebContentsData whenever the discard state of a WebContents | 190 // Called by WebContentsData whenever the discard state of a WebContents |
186 // changes, so that observers can be informed. | 191 // changes, so that observers can be informed. |
187 void OnDiscardedStateChange(content::WebContents* contents, | 192 void OnDiscardedStateChange(content::WebContents* contents, |
188 bool is_discarded); | 193 bool is_discarded); |
189 | 194 |
190 // Called by WebContentsData whenever the auto-discardable state of a | 195 // Called by WebContentsData whenever the auto-discardable state of a |
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
420 | 425 |
421 // Weak pointer factory used for posting delayed tasks to task_runner_. | 426 // Weak pointer factory used for posting delayed tasks to task_runner_. |
422 base::WeakPtrFactory<TabManager> weak_ptr_factory_; | 427 base::WeakPtrFactory<TabManager> weak_ptr_factory_; |
423 | 428 |
424 DISALLOW_COPY_AND_ASSIGN(TabManager); | 429 DISALLOW_COPY_AND_ASSIGN(TabManager); |
425 }; | 430 }; |
426 | 431 |
427 } // namespace memory | 432 } // namespace memory |
428 | 433 |
429 #endif // CHROME_BROWSER_MEMORY_TAB_MANAGER_H_ | 434 #endif // CHROME_BROWSER_MEMORY_TAB_MANAGER_H_ |
OLD | NEW |