| 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 #include "chrome/browser/sessions/tab_loader.h" | 5 #include "chrome/browser/sessions/tab_loader.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/memory/memory_coordinator_client_registry.h" | 10 #include "base/memory/memory_coordinator_client_registry.h" |
| (...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 236 } | 236 } |
| 237 | 237 |
| 238 void TabLoader::HandleTabClosedOrLoaded(NavigationController* controller) { | 238 void TabLoader::HandleTabClosedOrLoaded(NavigationController* controller) { |
| 239 RemoveTab(controller); | 239 RemoveTab(controller); |
| 240 if (delegate_) | 240 if (delegate_) |
| 241 LoadNextTab(); | 241 LoadNextTab(); |
| 242 } | 242 } |
| 243 | 243 |
| 244 bool TabLoader::ShouldStopLoadingTabs() const { | 244 bool TabLoader::ShouldStopLoadingTabs() const { |
| 245 if (base::FeatureList::IsEnabled(features::kMemoryCoordinator)) | 245 if (base::FeatureList::IsEnabled(features::kMemoryCoordinator)) |
| 246 return base::MemoryCoordinatorProxy::GetInstance()->GetCurrentMemoryState() | 246 return base::MemoryCoordinatorProxy::GetInstance()->GetLocalMemoryState() |
| 247 != base::MemoryState::NORMAL; | 247 != base::MemoryState::NORMAL; |
| 248 if (base::MemoryPressureMonitor::Get()) { | 248 if (base::MemoryPressureMonitor::Get()) { |
| 249 return base::MemoryPressureMonitor::Get()->GetCurrentPressureLevel() != | 249 return base::MemoryPressureMonitor::Get()->GetCurrentPressureLevel() != |
| 250 base::MemoryPressureListener::MEMORY_PRESSURE_LEVEL_NONE; | 250 base::MemoryPressureListener::MEMORY_PRESSURE_LEVEL_NONE; |
| 251 } | 251 } |
| 252 return false; | 252 return false; |
| 253 } | 253 } |
| 254 | 254 |
| 255 void TabLoader::OnMemoryPressure( | 255 void TabLoader::OnMemoryPressure( |
| 256 base::MemoryPressureListener::MemoryPressureLevel memory_pressure_level) { | 256 base::MemoryPressureListener::MemoryPressureLevel memory_pressure_level) { |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 291 // memory pressure. | 291 // memory pressure. |
| 292 stats_collector_->DeferTab(tab); | 292 stats_collector_->DeferTab(tab); |
| 293 } | 293 } |
| 294 // By calling |LoadNextTab| explicitly, we make sure that the | 294 // By calling |LoadNextTab| explicitly, we make sure that the |
| 295 // |NOTIFICATION_SESSION_RESTORE_DONE| event gets sent. | 295 // |NOTIFICATION_SESSION_RESTORE_DONE| event gets sent. |
| 296 LoadNextTab(); | 296 LoadNextTab(); |
| 297 } | 297 } |
| 298 | 298 |
| 299 // static | 299 // static |
| 300 TabLoader* TabLoader::shared_tab_loader_ = nullptr; | 300 TabLoader* TabLoader::shared_tab_loader_ = nullptr; |
| OLD | NEW |