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 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 // Returns true if |contents| is currently discarded. | 93 // Returns true if |contents| is currently discarded. |
94 bool IsTabDiscarded(content::WebContents* contents) const; | 94 bool IsTabDiscarded(content::WebContents* contents) const; |
95 | 95 |
96 // Goes through a list of checks to see if a tab is allowed to be discarded by | 96 // Goes through a list of checks to see if a tab is allowed to be discarded by |
97 // the automatic tab discarding mechanism. Note that this is not used when | 97 // the automatic tab discarding mechanism. Note that this is not used when |
98 // discarding a particular tab from about:discards. | 98 // discarding a particular tab from about:discards. |
99 bool CanDiscardTab(int64_t target_web_contents_id) const; | 99 bool CanDiscardTab(int64_t target_web_contents_id) const; |
100 | 100 |
101 // Discards a tab to free the memory occupied by its renderer. The tab still | 101 // Discards a tab to free the memory occupied by its renderer. The tab still |
102 // exists in the tab-strip; clicking on it will reload it. | 102 // exists in the tab-strip; clicking on it will reload it. |
103 void DiscardTab(); | 103 bool DiscardTab(); |
104 | 104 |
105 // Discards a tab with the given unique ID. The tab still exists in the | 105 // Discards a tab with the given unique ID. The tab still exists in the |
106 // tab-strip; clicking on it will reload it. Returns null if the tab cannot | 106 // tab-strip; clicking on it will reload it. Returns null if the tab cannot |
107 // be found or cannot be discarded. Otherwise returns the new web_contents | 107 // be found or cannot be discarded. Otherwise returns the new web_contents |
108 // of the discarded tab. | 108 // of the discarded tab. |
109 content::WebContents* DiscardTabById(int64_t target_web_contents_id); | 109 content::WebContents* DiscardTabById(int64_t target_web_contents_id); |
110 | 110 |
111 // Method used by the extensions API to discard tabs. If |contents| is null, | 111 // Method used by the extensions API to discard tabs. If |contents| is null, |
112 // discards the least important tab using DiscardTab(). Otherwise discards | 112 // discards the least important tab using DiscardTab(). Otherwise discards |
113 // the given contents. Returns the new web_contents or null if no tab | 113 // the given contents. Returns the new web_contents or null if no tab |
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
426 | 426 |
427 // Weak pointer factory used for posting delayed tasks to task_runner_. | 427 // Weak pointer factory used for posting delayed tasks to task_runner_. |
428 base::WeakPtrFactory<TabManager> weak_ptr_factory_; | 428 base::WeakPtrFactory<TabManager> weak_ptr_factory_; |
429 | 429 |
430 DISALLOW_COPY_AND_ASSIGN(TabManager); | 430 DISALLOW_COPY_AND_ASSIGN(TabManager); |
431 }; | 431 }; |
432 | 432 |
433 } // namespace memory | 433 } // namespace memory |
434 | 434 |
435 #endif // CHROME_BROWSER_MEMORY_TAB_MANAGER_H_ | 435 #endif // CHROME_BROWSER_MEMORY_TAB_MANAGER_H_ |
OLD | NEW |