| 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 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 144 // methods (about:discards for instance). | 144 // methods (about:discards for instance). |
| 145 bool IsTabAutoDiscardable(content::WebContents* contents) const; | 145 bool IsTabAutoDiscardable(content::WebContents* contents) const; |
| 146 | 146 |
| 147 // Sets/clears the auto-discardable state of the tab. | 147 // Sets/clears the auto-discardable state of the tab. |
| 148 void SetTabAutoDiscardableState(content::WebContents* contents, bool state); | 148 void SetTabAutoDiscardableState(content::WebContents* contents, bool state); |
| 149 | 149 |
| 150 // Returns true if |first| is considered less desirable to be killed than | 150 // Returns true if |first| is considered less desirable to be killed than |
| 151 // |second|. | 151 // |second|. |
| 152 static bool CompareTabStats(const TabStats& first, const TabStats& second); | 152 static bool CompareTabStats(const TabStats& first, const TabStats& second); |
| 153 | 153 |
| 154 // Returns a unique ID for a WebContents. Do not cast back to a pointer, as |
| 155 // the WebContents could be deleted if the user closed the tab. |
| 156 static int64_t IdFromWebContents(content::WebContents* web_contents); |
| 157 |
| 154 private: | 158 private: |
| 155 FRIEND_TEST_ALL_PREFIXES(TabManagerTest, AutoDiscardable); | 159 FRIEND_TEST_ALL_PREFIXES(TabManagerTest, AutoDiscardable); |
| 156 FRIEND_TEST_ALL_PREFIXES(TabManagerTest, CanOnlyDiscardOnce); | 160 FRIEND_TEST_ALL_PREFIXES(TabManagerTest, CanOnlyDiscardOnce); |
| 157 FRIEND_TEST_ALL_PREFIXES(TabManagerTest, ChildProcessNotifications); | 161 FRIEND_TEST_ALL_PREFIXES(TabManagerTest, ChildProcessNotifications); |
| 158 FRIEND_TEST_ALL_PREFIXES(TabManagerTest, Comparator); | 162 FRIEND_TEST_ALL_PREFIXES(TabManagerTest, Comparator); |
| 159 FRIEND_TEST_ALL_PREFIXES(TabManagerTest, DiscardedTabKeepsLastActiveTime); | 163 FRIEND_TEST_ALL_PREFIXES(TabManagerTest, DiscardedTabKeepsLastActiveTime); |
| 160 FRIEND_TEST_ALL_PREFIXES(TabManagerTest, DiscardWebContentsAt); | 164 FRIEND_TEST_ALL_PREFIXES(TabManagerTest, DiscardWebContentsAt); |
| 161 FRIEND_TEST_ALL_PREFIXES(TabManagerTest, InvalidOrEmptyURL); | 165 FRIEND_TEST_ALL_PREFIXES(TabManagerTest, InvalidOrEmptyURL); |
| 162 FRIEND_TEST_ALL_PREFIXES(TabManagerTest, IsInternalPage); | 166 FRIEND_TEST_ALL_PREFIXES(TabManagerTest, IsInternalPage); |
| 163 FRIEND_TEST_ALL_PREFIXES(TabManagerTest, OomPressureListener); | 167 FRIEND_TEST_ALL_PREFIXES(TabManagerTest, OomPressureListener); |
| (...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 374 | 378 |
| 375 // Weak pointer factory used for posting delayed tasks to task_runner_. | 379 // Weak pointer factory used for posting delayed tasks to task_runner_. |
| 376 base::WeakPtrFactory<TabManager> weak_ptr_factory_; | 380 base::WeakPtrFactory<TabManager> weak_ptr_factory_; |
| 377 | 381 |
| 378 DISALLOW_COPY_AND_ASSIGN(TabManager); | 382 DISALLOW_COPY_AND_ASSIGN(TabManager); |
| 379 }; | 383 }; |
| 380 | 384 |
| 381 } // namespace memory | 385 } // namespace memory |
| 382 | 386 |
| 383 #endif // CHROME_BROWSER_MEMORY_TAB_MANAGER_H_ | 387 #endif // CHROME_BROWSER_MEMORY_TAB_MANAGER_H_ |
| OLD | NEW |