| 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 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 237 // If |active_model| is true, consider its first tab as being active. | 237 // If |active_model| is true, consider its first tab as being active. |
| 238 void AddTabStats(const TabStripModel* model, | 238 void AddTabStats(const TabStripModel* model, |
| 239 bool is_app, | 239 bool is_app, |
| 240 bool active_model, | 240 bool active_model, |
| 241 TabStatsList* stats_list); | 241 TabStatsList* stats_list); |
| 242 | 242 |
| 243 // Callback for when |update_timer_| fires. Takes care of executing the tasks | 243 // Callback for when |update_timer_| fires. Takes care of executing the tasks |
| 244 // that need to be run periodically (see comment in implementation). | 244 // that need to be run periodically (see comment in implementation). |
| 245 void UpdateTimerCallback(); | 245 void UpdateTimerCallback(); |
| 246 | 246 |
| 247 // Goes through a list of checks to see if a tab is allowed to be purged and |
| 248 // suspended by purge+susend backgrounded tab mechanism. |
| 249 bool CanPurgeAndSuspendBackgroundedTab(int64_t target_web_contents_id) const; |
| 250 |
| 247 // Purges and suspends renderers in backgrounded tabs. | 251 // Purges and suspends renderers in backgrounded tabs. |
| 248 void PurgeAndSuspendBackgroundedTabs(); | 252 void PurgeAndSuspendBackgroundedTabs(); |
| 249 | 253 |
| 250 // Does the actual discard by destroying the WebContents in |model| at |index| | 254 // Does the actual discard by destroying the WebContents in |model| at |index| |
| 251 // and replacing it by an empty one. Returns the new WebContents or NULL if | 255 // and replacing it by an empty one. Returns the new WebContents or NULL if |
| 252 // the operation fails (return value used only in testing). | 256 // the operation fails (return value used only in testing). |
| 253 content::WebContents* DiscardWebContentsAt(int index, TabStripModel* model); | 257 content::WebContents* DiscardWebContentsAt(int index, TabStripModel* model); |
| 254 | 258 |
| 255 // Called by the memory pressure listener when the memory pressure rises. | 259 // Called by the memory pressure listener when the memory pressure rises. |
| 256 void OnMemoryPressure( | 260 void OnMemoryPressure( |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 379 | 383 |
| 380 // Weak pointer factory used for posting delayed tasks to task_runner_. | 384 // Weak pointer factory used for posting delayed tasks to task_runner_. |
| 381 base::WeakPtrFactory<TabManager> weak_ptr_factory_; | 385 base::WeakPtrFactory<TabManager> weak_ptr_factory_; |
| 382 | 386 |
| 383 DISALLOW_COPY_AND_ASSIGN(TabManager); | 387 DISALLOW_COPY_AND_ASSIGN(TabManager); |
| 384 }; | 388 }; |
| 385 | 389 |
| 386 } // namespace memory | 390 } // namespace memory |
| 387 | 391 |
| 388 #endif // CHROME_BROWSER_MEMORY_TAB_MANAGER_H_ | 392 #endif // CHROME_BROWSER_MEMORY_TAB_MANAGER_H_ |
| OLD | NEW |