| 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_SESSION_RESTORE_STATS_COLLECTOR_H_ | 5 #ifndef CHROME_BROWSER_SESSIONS_SESSION_RESTORE_STATS_COLLECTOR_H_ |
| 6 #define CHROME_BROWSER_SESSIONS_SESSION_RESTORE_STATS_COLLECTOR_H_ | 6 #define CHROME_BROWSER_SESSIONS_SESSION_RESTORE_STATS_COLLECTOR_H_ |
| 7 | 7 |
| 8 #include <set> | 8 #include <set> |
| 9 | 9 |
| 10 #include "base/callback_list.h" | 10 #include "base/callback_list.h" |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 class SessionRestoreStatsCollector | 23 class SessionRestoreStatsCollector |
| 24 : public content::NotificationObserver, | 24 : public content::NotificationObserver, |
| 25 public base::RefCounted<SessionRestoreStatsCollector> { | 25 public base::RefCounted<SessionRestoreStatsCollector> { |
| 26 public: | 26 public: |
| 27 // Called to start tracking tabs. If a restore is already occuring, the tabs | 27 // Called to start tracking tabs. If a restore is already occuring, the tabs |
| 28 // are added to the existing list of tracked tabs. | 28 // are added to the existing list of tracked tabs. |
| 29 static void TrackTabs( | 29 static void TrackTabs( |
| 30 const std::vector<SessionRestoreDelegate::RestoredTab>& tabs, | 30 const std::vector<SessionRestoreDelegate::RestoredTab>& tabs, |
| 31 const base::TimeTicks& restore_started); | 31 const base::TimeTicks& restore_started); |
| 32 | 32 |
| 33 // Called to start tracking only active tabs. If a restore is already |
| 34 // occuring, the tabs are added to the existing list of tracked tabs. |
| 35 static void TrackActiveTabs( |
| 36 const std::vector<SessionRestoreDelegate::RestoredTab>& tabs, |
| 37 const base::TimeTicks& restore_started); |
| 38 |
| 33 private: | 39 private: |
| 34 friend class base::RefCounted<SessionRestoreStatsCollector>; | 40 friend class base::RefCounted<SessionRestoreStatsCollector>; |
| 35 | 41 |
| 36 using RenderWidgetHostSet = std::set<content::RenderWidgetHost*>; | 42 using RenderWidgetHostSet = std::set<content::RenderWidgetHost*>; |
| 37 | 43 |
| 38 explicit SessionRestoreStatsCollector(const base::TimeTicks& restore_started); | 44 explicit SessionRestoreStatsCollector(const base::TimeTicks& restore_started); |
| 39 ~SessionRestoreStatsCollector() override; | 45 ~SessionRestoreStatsCollector() override; |
| 40 | 46 |
| 41 // NotificationObserver method. | 47 // NotificationObserver method. |
| 42 void Observe(int type, | 48 void Observe(int type, |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 scoped_refptr<SessionRestoreStatsCollector> this_retainer_; | 93 scoped_refptr<SessionRestoreStatsCollector> this_retainer_; |
| 88 | 94 |
| 89 // The shared SessionRestoreNotifier instance for all SessionRestores running | 95 // The shared SessionRestoreNotifier instance for all SessionRestores running |
| 90 // at this time. | 96 // at this time. |
| 91 static SessionRestoreStatsCollector* shared_collector_; | 97 static SessionRestoreStatsCollector* shared_collector_; |
| 92 | 98 |
| 93 DISALLOW_COPY_AND_ASSIGN(SessionRestoreStatsCollector); | 99 DISALLOW_COPY_AND_ASSIGN(SessionRestoreStatsCollector); |
| 94 }; | 100 }; |
| 95 | 101 |
| 96 #endif // CHROME_BROWSER_SESSIONS_SESSION_RESTORE_STATS_COLLECTOR_H_ | 102 #endif // CHROME_BROWSER_SESSIONS_SESSION_RESTORE_STATS_COLLECTOR_H_ |
| OLD | NEW |