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 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 loading_enabled_(true), | 96 loading_enabled_(true), |
97 started_to_load_count_(0), | 97 started_to_load_count_(0), |
98 restore_started_(restore_started) { | 98 restore_started_(restore_started) { |
99 stats_collector_ = new SessionRestoreStatsCollector( | 99 stats_collector_ = new SessionRestoreStatsCollector( |
100 restore_started, | 100 restore_started, |
101 base::MakeUnique< | 101 base::MakeUnique< |
102 SessionRestoreStatsCollector::UmaStatsReportingDelegate>()); | 102 SessionRestoreStatsCollector::UmaStatsReportingDelegate>()); |
103 shared_tab_loader_ = this; | 103 shared_tab_loader_ = this; |
104 this_retainer_ = this; | 104 this_retainer_ = this; |
105 base::MemoryCoordinatorClientRegistry::GetInstance()->Register(this); | 105 base::MemoryCoordinatorClientRegistry::GetInstance()->Register(this); |
106 for (auto& observer : SessionRestore::observers()) | |
107 observer.OnSessionRestoreStartedLoadingTabs(); | |
108 } | 106 } |
109 | 107 |
110 TabLoader::~TabLoader() { | 108 TabLoader::~TabLoader() { |
111 DCHECK(tabs_loading_.empty() && tabs_to_load_.empty()); | 109 DCHECK(tabs_loading_.empty() && tabs_to_load_.empty()); |
112 DCHECK(shared_tab_loader_ == this); | 110 DCHECK(shared_tab_loader_ == this); |
113 shared_tab_loader_ = nullptr; | 111 shared_tab_loader_ = nullptr; |
114 base::MemoryCoordinatorClientRegistry::GetInstance()->Unregister(this); | 112 base::MemoryCoordinatorClientRegistry::GetInstance()->Unregister(this); |
115 for (auto& observer : SessionRestore::observers()) | 113 for (auto& observer : SessionRestore::observers()) |
116 observer.OnSessionRestoreFinishedLoadingTabs(); | 114 observer.OnSessionRestoreFinishedLoadingTabs(); |
117 } | 115 } |
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
312 // memory pressure. | 310 // memory pressure. |
313 stats_collector_->DeferTab(tab); | 311 stats_collector_->DeferTab(tab); |
314 } | 312 } |
315 // By calling |LoadNextTab| explicitly, we make sure that the | 313 // By calling |LoadNextTab| explicitly, we make sure that the |
316 // |NOTIFICATION_SESSION_RESTORE_DONE| event gets sent. | 314 // |NOTIFICATION_SESSION_RESTORE_DONE| event gets sent. |
317 LoadNextTab(); | 315 LoadNextTab(); |
318 } | 316 } |
319 | 317 |
320 // static | 318 // static |
321 TabLoader* TabLoader::shared_tab_loader_ = nullptr; | 319 TabLoader* TabLoader::shared_tab_loader_ = nullptr; |
OLD | NEW |