| 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 <list> | 8 #include <list> |
| 9 #include <set> | 9 #include <set> |
| 10 | 10 |
| 11 #include "base/memory/memory_pressure_listener.h" | 11 #include "base/memory/memory_pressure_listener.h" |
| 12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
| 13 #include "base/timer/timer.h" | 13 #include "base/timer/timer.h" |
| 14 #include "chrome/browser/sessions/session_restore_delegate.h" | 14 #include "chrome/browser/sessions/session_restore_delegate.h" |
| 15 #include "chrome/browser/sessions/tab_loader_delegate.h" | 15 #include "chrome/browser/sessions/tab_loader_delegate.h" |
| 16 #include "content/public/browser/notification_observer.h" | 16 #include "content/public/browser/notification_observer.h" |
| 17 #include "content/public/browser/notification_registrar.h" | 17 #include "content/public/browser/notification_registrar.h" |
| 18 | 18 |
| 19 namespace content { | 19 namespace content { |
| 20 class NavigationController; | 20 class NavigationController; |
| 21 class RenderWidgetHost; | 21 class RenderWidgetHost; |
| 22 } | 22 } |
| 23 | 23 |
| 24 class SessionRestoreStatsCollector; |
| 25 |
| 24 // TabLoader is responsible for loading tabs after session restore has finished | 26 // TabLoader is responsible for loading tabs after session restore has finished |
| 25 // creating all the tabs. Tabs are loaded after a previously tab finishes | 27 // creating all the tabs. Tabs are loaded after a previously tab finishes |
| 26 // loading or a timeout is reached. If the timeout is reached before a tab | 28 // loading or a timeout is reached. If the timeout is reached before a tab |
| 27 // finishes loading the timeout delay is doubled. | 29 // finishes loading the timeout delay is doubled. |
| 28 // | 30 // |
| 29 // TabLoader keeps a reference to itself when it's loading. When it has finished | 31 // TabLoader keeps a reference to itself when it's loading. When it has finished |
| 30 // loading, it drops the reference. If another profile is restored while the | 32 // loading, it drops the reference. If another profile is restored while the |
| 31 // TabLoader is loading, it will schedule its tabs to get loaded by the same | 33 // TabLoader is loading, it will schedule its tabs to get loaded by the same |
| 32 // TabLoader. When doing the scheduling, it holds a reference to the TabLoader. | 34 // TabLoader. When doing the scheduling, it holds a reference to the TabLoader. |
| 33 // | 35 // |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 | 127 |
| 126 base::OneShotTimer<TabLoader> force_load_timer_; | 128 base::OneShotTimer<TabLoader> force_load_timer_; |
| 127 | 129 |
| 128 // The time the restore process started. | 130 // The time the restore process started. |
| 129 base::TimeTicks restore_started_; | 131 base::TimeTicks restore_started_; |
| 130 | 132 |
| 131 // For keeping TabLoader alive while it's loading even if no | 133 // For keeping TabLoader alive while it's loading even if no |
| 132 // SessionRestoreImpls reference it. | 134 // SessionRestoreImpls reference it. |
| 133 scoped_refptr<TabLoader> this_retainer_; | 135 scoped_refptr<TabLoader> this_retainer_; |
| 134 | 136 |
| 137 // The SessionRestoreStatsCollector associated with this TabLoader. This is |
| 138 // explicitly referenced so that it can be notified of deferred tab loads due |
| 139 // to memory pressure. |
| 140 scoped_refptr<SessionRestoreStatsCollector> stats_collector_; |
| 141 |
| 135 static TabLoader* shared_tab_loader_; | 142 static TabLoader* shared_tab_loader_; |
| 136 | 143 |
| 137 DISALLOW_COPY_AND_ASSIGN(TabLoader); | 144 DISALLOW_COPY_AND_ASSIGN(TabLoader); |
| 138 }; | 145 }; |
| 139 | 146 |
| 140 #endif // CHROME_BROWSER_SESSIONS_TAB_LOADER_H_ | 147 #endif // CHROME_BROWSER_SESSIONS_TAB_LOADER_H_ |
| OLD | NEW |