Chromium Code Reviews| 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 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 92 | 92 |
| 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. Returns true if |
| 103 void DiscardTab(); | 103 // a tab is actually discarded. |
|
haraken
2017/03/07 08:04:57
the tab was
| |
| 104 bool DiscardTab(); | |
| 104 | 105 |
| 105 // Discards a tab with the given unique ID. The tab still exists in the | 106 // 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 | 107 // 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 | 108 // be found or cannot be discarded. Otherwise returns the new web_contents |
| 108 // of the discarded tab. | 109 // of the discarded tab. |
| 109 content::WebContents* DiscardTabById(int64_t target_web_contents_id); | 110 content::WebContents* DiscardTabById(int64_t target_web_contents_id); |
| 110 | 111 |
| 111 // Method used by the extensions API to discard tabs. If |contents| is null, | 112 // Method used by the extensions API to discard tabs. If |contents| is null, |
| 112 // discards the least important tab using DiscardTab(). Otherwise discards | 113 // discards the least important tab using DiscardTab(). Otherwise discards |
| 113 // the given contents. Returns the new web_contents or null if no tab | 114 // 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 | 427 |
| 427 // Weak pointer factory used for posting delayed tasks to task_runner_. | 428 // Weak pointer factory used for posting delayed tasks to task_runner_. |
| 428 base::WeakPtrFactory<TabManager> weak_ptr_factory_; | 429 base::WeakPtrFactory<TabManager> weak_ptr_factory_; |
| 429 | 430 |
| 430 DISALLOW_COPY_AND_ASSIGN(TabManager); | 431 DISALLOW_COPY_AND_ASSIGN(TabManager); |
| 431 }; | 432 }; |
| 432 | 433 |
| 433 } // namespace memory | 434 } // namespace memory |
| 434 | 435 |
| 435 #endif // CHROME_BROWSER_MEMORY_TAB_MANAGER_H_ | 436 #endif // CHROME_BROWSER_MEMORY_TAB_MANAGER_H_ |
| OLD | NEW |