| 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 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 188 // If |active_model| is true, consider its first tab as being active. | 188 // If |active_model| is true, consider its first tab as being active. |
| 189 void AddTabStats(const TabStripModel* model, | 189 void AddTabStats(const TabStripModel* model, |
| 190 bool is_app, | 190 bool is_app, |
| 191 bool active_model, | 191 bool active_model, |
| 192 TabStatsList* stats_list); | 192 TabStatsList* stats_list); |
| 193 | 193 |
| 194 // Callback for when |update_timer_| fires. Takes care of executing the tasks | 194 // Callback for when |update_timer_| fires. Takes care of executing the tasks |
| 195 // that need to be run periodically (see comment in implementation). | 195 // that need to be run periodically (see comment in implementation). |
| 196 void UpdateTimerCallback(); | 196 void UpdateTimerCallback(); |
| 197 | 197 |
| 198 // Purges and suspends renderers in backgrounded tabs. |
| 199 void PurgeAndSuspendBackgroundedTabs(); |
| 200 |
| 198 // Does the actual discard by destroying the WebContents in |model| at |index| | 201 // Does the actual discard by destroying the WebContents in |model| at |index| |
| 199 // and replacing it by an empty one. Returns the new WebContents or NULL if | 202 // and replacing it by an empty one. Returns the new WebContents or NULL if |
| 200 // the operation fails (return value used only in testing). | 203 // the operation fails (return value used only in testing). |
| 201 content::WebContents* DiscardWebContentsAt(int index, TabStripModel* model); | 204 content::WebContents* DiscardWebContentsAt(int index, TabStripModel* model); |
| 202 | 205 |
| 203 // Called by the memory pressure listener when the memory pressure rises. | 206 // Called by the memory pressure listener when the memory pressure rises. |
| 204 void OnMemoryPressure( | 207 void OnMemoryPressure( |
| 205 base::MemoryPressureListener::MemoryPressureLevel memory_pressure_level); | 208 base::MemoryPressureListener::MemoryPressureLevel memory_pressure_level); |
| 206 | 209 |
| 207 // TabStripModelObserver overrides. | 210 // TabStripModelObserver overrides. |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 323 | 326 |
| 324 // Weak pointer factory used for posting delayed tasks to task_runner_. | 327 // Weak pointer factory used for posting delayed tasks to task_runner_. |
| 325 base::WeakPtrFactory<TabManager> weak_ptr_factory_; | 328 base::WeakPtrFactory<TabManager> weak_ptr_factory_; |
| 326 | 329 |
| 327 DISALLOW_COPY_AND_ASSIGN(TabManager); | 330 DISALLOW_COPY_AND_ASSIGN(TabManager); |
| 328 }; | 331 }; |
| 329 | 332 |
| 330 } // namespace memory | 333 } // namespace memory |
| 331 | 334 |
| 332 #endif // CHROME_BROWSER_MEMORY_TAB_MANAGER_H_ | 335 #endif // CHROME_BROWSER_MEMORY_TAB_MANAGER_H_ |
| OLD | NEW |