OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/session_restore.h" | 5 #include "chrome/browser/sessions/session_restore.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <list> | 8 #include <list> |
9 #include <set> | 9 #include <set> |
10 #include <string> | 10 #include <string> |
11 | 11 |
12 #include "base/bind.h" | 12 #include "base/bind.h" |
13 #include "base/bind_helpers.h" | 13 #include "base/bind_helpers.h" |
14 #include "base/callback.h" | 14 #include "base/callback.h" |
15 #include "base/command_line.h" | 15 #include "base/command_line.h" |
16 #include "base/memory/scoped_ptr.h" | 16 #include "base/memory/scoped_ptr.h" |
17 #include "base/metrics/histogram.h" | 17 #include "base/metrics/histogram.h" |
18 #include "base/platform_file.h" | 18 #include "base/platform_file.h" |
19 #include "base/stl_util.h" | 19 #include "base/stl_util.h" |
20 #include "base/stringprintf.h" | 20 #include "base/stringprintf.h" |
21 #include "chrome/browser/browser_process.h" | 21 #include "chrome/browser/browser_process.h" |
22 #include "chrome/browser/extensions/extension_service.h" | 22 #include "chrome/browser/extensions/extension_service.h" |
23 #include "chrome/browser/performance_monitor/startup_timer.h" | |
23 #include "chrome/browser/profiles/profile.h" | 24 #include "chrome/browser/profiles/profile.h" |
24 #include "chrome/browser/sessions/session_service.h" | 25 #include "chrome/browser/sessions/session_service.h" |
25 #include "chrome/browser/sessions/session_service_factory.h" | 26 #include "chrome/browser/sessions/session_service_factory.h" |
26 #include "chrome/browser/sessions/session_types.h" | 27 #include "chrome/browser/sessions/session_types.h" |
27 #include "chrome/browser/ui/browser.h" | 28 #include "chrome/browser/ui/browser.h" |
28 #include "chrome/browser/ui/browser_finder.h" | 29 #include "chrome/browser/ui/browser_finder.h" |
29 #include "chrome/browser/ui/browser_navigator.h" | 30 #include "chrome/browser/ui/browser_navigator.h" |
30 #include "chrome/browser/ui/browser_tabrestore.h" | 31 #include "chrome/browser/ui/browser_tabrestore.h" |
31 #include "chrome/browser/ui/browser_tabstrip.h" | 32 #include "chrome/browser/ui/browser_tabstrip.h" |
32 #include "chrome/browser/ui/browser_window.h" | 33 #include "chrome/browser/ui/browser_window.h" |
(...skipping 400 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
433 ++tab_count_; | 434 ++tab_count_; |
434 } | 435 } |
435 | 436 |
436 void TabLoader::HandleTabClosedOrLoaded(NavigationController* tab) { | 437 void TabLoader::HandleTabClosedOrLoaded(NavigationController* tab) { |
437 RemoveTab(tab); | 438 RemoveTab(tab); |
438 if (loading_) | 439 if (loading_) |
439 LoadNextTab(); | 440 LoadNextTab(); |
440 if (tabs_loading_.empty() && tabs_to_load_.empty()) { | 441 if (tabs_loading_.empty() && tabs_to_load_.empty()) { |
441 base::TimeDelta time_to_load = | 442 base::TimeDelta time_to_load = |
442 base::TimeTicks::Now() - restore_started_; | 443 base::TimeTicks::Now() - restore_started_; |
444 performance_monitor::StartupTimer::SetElapsedSessionRestoreTime( | |
sky
2012/08/07 19:48:04
What happens if this is invoked multiple times?
Devlin
2012/08/07 22:51:22
Whoops, forgot that session restores can happen mu
| |
445 time_to_load); | |
443 UMA_HISTOGRAM_CUSTOM_TIMES( | 446 UMA_HISTOGRAM_CUSTOM_TIMES( |
444 "SessionRestore.AllTabsLoaded", | 447 "SessionRestore.AllTabsLoaded", |
445 time_to_load, | 448 time_to_load, |
446 base::TimeDelta::FromMilliseconds(10), | 449 base::TimeDelta::FromMilliseconds(10), |
447 base::TimeDelta::FromSeconds(100), | 450 base::TimeDelta::FromSeconds(100), |
448 100); | 451 100); |
449 // Record a time for the number of tabs, to help track down contention. | 452 // Record a time for the number of tabs, to help track down contention. |
450 std::string time_for_count = | 453 std::string time_for_count = |
451 base::StringPrintf("SessionRestore.AllTabsLoaded_%d", tab_count_); | 454 base::StringPrintf("SessionRestore.AllTabsLoaded_%d", tab_count_); |
452 base::Histogram* counter_for_count = | 455 base::Histogram* counter_for_count = |
(...skipping 637 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1090 if (active_session_restorers == NULL) | 1093 if (active_session_restorers == NULL) |
1091 return false; | 1094 return false; |
1092 for (std::set<SessionRestoreImpl*>::const_iterator it = | 1095 for (std::set<SessionRestoreImpl*>::const_iterator it = |
1093 active_session_restorers->begin(); | 1096 active_session_restorers->begin(); |
1094 it != active_session_restorers->end(); ++it) { | 1097 it != active_session_restorers->end(); ++it) { |
1095 if ((*it)->profile() == profile) | 1098 if ((*it)->profile() == profile) |
1096 return true; | 1099 return true; |
1097 } | 1100 } |
1098 return false; | 1101 return false; |
1099 } | 1102 } |
OLD | NEW |