| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_SESSIONS_TAB_LOADER_H_ | 5 #ifndef CHROME_BROWSER_SESSIONS_TAB_LOADER_H_ |
| 6 #define CHROME_BROWSER_SESSIONS_TAB_LOADER_H_ | 6 #define CHROME_BROWSER_SESSIONS_TAB_LOADER_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 | 9 |
| 10 #include <list> | 10 #include <list> |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 // React to memory pressure by stopping to load any more tabs. | 118 // React to memory pressure by stopping to load any more tabs. |
| 119 void OnMemoryPressure( | 119 void OnMemoryPressure( |
| 120 base::MemoryPressureListener::MemoryPressureLevel memory_pressure_level); | 120 base::MemoryPressureListener::MemoryPressureLevel memory_pressure_level); |
| 121 | 121 |
| 122 // base::MemoryCoordinatorClient implementation: | 122 // base::MemoryCoordinatorClient implementation: |
| 123 void OnMemoryStateChange(base::MemoryState state) override; | 123 void OnMemoryStateChange(base::MemoryState state) override; |
| 124 | 124 |
| 125 // Stops loading tabs to purge memory by stopping to load any more tabs. | 125 // Stops loading tabs to purge memory by stopping to load any more tabs. |
| 126 void StopLoadingTabs(); | 126 void StopLoadingTabs(); |
| 127 | 127 |
| 128 // Signal the start and end of session restore to the tab manager. |
| 129 static void MarkSessionRestoreStarted(); |
| 130 static void MarkSessionRestoreEnded(); |
| 131 |
| 128 // Limit the number of loaded tabs. | 132 // Limit the number of loaded tabs. |
| 129 // Value of 0 restores default behavior. In test mode command line flags and | 133 // Value of 0 restores default behavior. In test mode command line flags and |
| 130 // free memory size are not taken into account. | 134 // free memory size are not taken into account. |
| 131 static void SetMaxLoadedTabCountForTest(size_t value); | 135 static void SetMaxLoadedTabCountForTest(size_t value); |
| 132 | 136 |
| 133 std::unique_ptr<TabLoaderDelegate> delegate_; | 137 std::unique_ptr<TabLoaderDelegate> delegate_; |
| 134 | 138 |
| 135 // Listens for system under memory pressure notifications and stops loading | 139 // Listens for system under memory pressure notifications and stops loading |
| 136 // of tabs when we start running out of memory. | 140 // of tabs when we start running out of memory. |
| 137 base::MemoryPressureListener memory_pressure_listener_; | 141 base::MemoryPressureListener memory_pressure_listener_; |
| (...skipping 30 matching lines...) Expand all Loading... |
| 168 // explicitly referenced so that it can be notified of deferred tab loads due | 172 // explicitly referenced so that it can be notified of deferred tab loads due |
| 169 // to memory pressure. | 173 // to memory pressure. |
| 170 scoped_refptr<SessionRestoreStatsCollector> stats_collector_; | 174 scoped_refptr<SessionRestoreStatsCollector> stats_collector_; |
| 171 | 175 |
| 172 static TabLoader* shared_tab_loader_; | 176 static TabLoader* shared_tab_loader_; |
| 173 | 177 |
| 174 DISALLOW_COPY_AND_ASSIGN(TabLoader); | 178 DISALLOW_COPY_AND_ASSIGN(TabLoader); |
| 175 }; | 179 }; |
| 176 | 180 |
| 177 #endif // CHROME_BROWSER_SESSIONS_TAB_LOADER_H_ | 181 #endif // CHROME_BROWSER_SESSIONS_TAB_LOADER_H_ |
| OLD | NEW |