| 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_pressure_monitor.h" | 10 #include "base/memory/memory_pressure_monitor.h" |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 } | 77 } |
| 78 | 78 |
| 79 TabLoader::TabLoader(base::TimeTicks restore_started) | 79 TabLoader::TabLoader(base::TimeTicks restore_started) |
| 80 : memory_pressure_listener_( | 80 : memory_pressure_listener_( |
| 81 base::Bind(&TabLoader::OnMemoryPressure, base::Unretained(this))), | 81 base::Bind(&TabLoader::OnMemoryPressure, base::Unretained(this))), |
| 82 force_load_delay_multiplier_(1), | 82 force_load_delay_multiplier_(1), |
| 83 loading_enabled_(true), | 83 loading_enabled_(true), |
| 84 restore_started_(restore_started) { | 84 restore_started_(restore_started) { |
| 85 stats_collector_ = new SessionRestoreStatsCollector( | 85 stats_collector_ = new SessionRestoreStatsCollector( |
| 86 restore_started, | 86 restore_started, |
| 87 base::WrapUnique( | 87 base::MakeUnique< |
| 88 new SessionRestoreStatsCollector::UmaStatsReportingDelegate())); | 88 SessionRestoreStatsCollector::UmaStatsReportingDelegate>()); |
| 89 shared_tab_loader_ = this; | 89 shared_tab_loader_ = this; |
| 90 this_retainer_ = this; | 90 this_retainer_ = this; |
| 91 } | 91 } |
| 92 | 92 |
| 93 TabLoader::~TabLoader() { | 93 TabLoader::~TabLoader() { |
| 94 DCHECK(tabs_loading_.empty() && tabs_to_load_.empty()); | 94 DCHECK(tabs_loading_.empty() && tabs_to_load_.empty()); |
| 95 DCHECK(shared_tab_loader_ == this); | 95 DCHECK(shared_tab_loader_ == this); |
| 96 shared_tab_loader_ = nullptr; | 96 shared_tab_loader_ = nullptr; |
| 97 } | 97 } |
| 98 | 98 |
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 268 // memory pressure. | 268 // memory pressure. |
| 269 stats_collector_->DeferTab(tab); | 269 stats_collector_->DeferTab(tab); |
| 270 } | 270 } |
| 271 // By calling |LoadNextTab| explicitly, we make sure that the | 271 // By calling |LoadNextTab| explicitly, we make sure that the |
| 272 // |NOTIFICATION_SESSION_RESTORE_DONE| event gets sent. | 272 // |NOTIFICATION_SESSION_RESTORE_DONE| event gets sent. |
| 273 LoadNextTab(); | 273 LoadNextTab(); |
| 274 } | 274 } |
| 275 | 275 |
| 276 // static | 276 // static |
| 277 TabLoader* TabLoader::shared_tab_loader_ = nullptr; | 277 TabLoader* TabLoader::shared_tab_loader_ = nullptr; |
| OLD | NEW |