| 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 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 // Returns the auto-discardable state of the tab. When true, the tab is | 140 // Returns the auto-discardable state of the tab. When true, the tab is |
| 141 // eligible to be automatically discarded when critical memory pressure hits, | 141 // eligible to be automatically discarded when critical memory pressure hits, |
| 142 // otherwise the tab is ignored and will never be automatically discarded. | 142 // otherwise the tab is ignored and will never be automatically discarded. |
| 143 // Note that this property doesn't block the discarding of the tab via other | 143 // Note that this property doesn't block the discarding of the tab via other |
| 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 when a given renderer can suspend when it is backgrounded. |
| 151 bool CanSuspendBackgroundedRenderer(int render_process_id); |
| 152 |
| 150 // Returns true if |first| is considered less desirable to be killed than | 153 // Returns true if |first| is considered less desirable to be killed than |
| 151 // |second|. | 154 // |second|. |
| 152 static bool CompareTabStats(const TabStats& first, const TabStats& second); | 155 static bool CompareTabStats(const TabStats& first, const TabStats& second); |
| 153 | 156 |
| 154 // Returns a unique ID for a WebContents. Do not cast back to a pointer, as | 157 // 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. | 158 // the WebContents could be deleted if the user closed the tab. |
| 156 static int64_t IdFromWebContents(content::WebContents* web_contents); | 159 static int64_t IdFromWebContents(content::WebContents* web_contents); |
| 157 | 160 |
| 158 private: | 161 private: |
| 159 FRIEND_TEST_ALL_PREFIXES(TabManagerTest, AutoDiscardable); | 162 FRIEND_TEST_ALL_PREFIXES(TabManagerTest, AutoDiscardable); |
| (...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 379 | 382 |
| 380 // Weak pointer factory used for posting delayed tasks to task_runner_. | 383 // Weak pointer factory used for posting delayed tasks to task_runner_. |
| 381 base::WeakPtrFactory<TabManager> weak_ptr_factory_; | 384 base::WeakPtrFactory<TabManager> weak_ptr_factory_; |
| 382 | 385 |
| 383 DISALLOW_COPY_AND_ASSIGN(TabManager); | 386 DISALLOW_COPY_AND_ASSIGN(TabManager); |
| 384 }; | 387 }; |
| 385 | 388 |
| 386 } // namespace memory | 389 } // namespace memory |
| 387 | 390 |
| 388 #endif // CHROME_BROWSER_MEMORY_TAB_MANAGER_H_ | 391 #endif // CHROME_BROWSER_MEMORY_TAB_MANAGER_H_ |
| OLD | NEW |