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/debug/alias.h" | 16 #include "base/debug/alias.h" |
17 #include "base/memory/scoped_ptr.h" | 17 #include "base/memory/scoped_ptr.h" |
18 #include "base/memory/scoped_vector.h" | 18 #include "base/memory/scoped_vector.h" |
19 #include "base/metrics/histogram.h" | 19 #include "base/metrics/histogram.h" |
20 #include "base/run_loop.h" | 20 #include "base/run_loop.h" |
21 #include "base/stl_util.h" | 21 #include "base/stl_util.h" |
22 #include "base/strings/stringprintf.h" | 22 #include "base/strings/stringprintf.h" |
23 #include "base/task/cancelable_task_tracker.h" | 23 #include "base/task/cancelable_task_tracker.h" |
24 #include "chrome/browser/browser_process.h" | 24 #include "chrome/browser/browser_process.h" |
25 #include "chrome/browser/chrome_notification_types.h" | 25 #include "chrome/browser/chrome_notification_types.h" |
26 #include "chrome/browser/performance_monitor/startup_timer.h" | |
27 #include "chrome/browser/profiles/profile.h" | 26 #include "chrome/browser/profiles/profile.h" |
28 #include "chrome/browser/search/search.h" | 27 #include "chrome/browser/search/search.h" |
29 #include "chrome/browser/sessions/session_service.h" | 28 #include "chrome/browser/sessions/session_service.h" |
30 #include "chrome/browser/sessions/session_service_factory.h" | 29 #include "chrome/browser/sessions/session_service_factory.h" |
31 #include "chrome/browser/sessions/session_types.h" | 30 #include "chrome/browser/sessions/session_types.h" |
32 #include "chrome/browser/ui/browser.h" | 31 #include "chrome/browser/ui/browser.h" |
33 #include "chrome/browser/ui/browser_finder.h" | 32 #include "chrome/browser/ui/browser_finder.h" |
34 #include "chrome/browser/ui/browser_navigator.h" | 33 #include "chrome/browser/ui/browser_navigator.h" |
35 #include "chrome/browser/ui/browser_tabrestore.h" | 34 #include "chrome/browser/ui/browser_tabrestore.h" |
36 #include "chrome/browser/ui/browser_tabstrip.h" | 35 #include "chrome/browser/ui/browser_tabstrip.h" |
(...skipping 417 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
454 ++tab_count_; | 453 ++tab_count_; |
455 } | 454 } |
456 | 455 |
457 void TabLoader::HandleTabClosedOrLoaded(NavigationController* tab) { | 456 void TabLoader::HandleTabClosedOrLoaded(NavigationController* tab) { |
458 RemoveTab(tab); | 457 RemoveTab(tab); |
459 if (loading_) | 458 if (loading_) |
460 LoadNextTab(); | 459 LoadNextTab(); |
461 if (tabs_loading_.empty() && tabs_to_load_.empty()) { | 460 if (tabs_loading_.empty() && tabs_to_load_.empty()) { |
462 base::TimeDelta time_to_load = | 461 base::TimeDelta time_to_load = |
463 base::TimeTicks::Now() - restore_started_; | 462 base::TimeTicks::Now() - restore_started_; |
464 performance_monitor::StartupTimer::SetElapsedSessionRestoreTime( | |
465 time_to_load); | |
466 UMA_HISTOGRAM_CUSTOM_TIMES( | 463 UMA_HISTOGRAM_CUSTOM_TIMES( |
467 "SessionRestore.AllTabsLoaded", | 464 "SessionRestore.AllTabsLoaded", |
468 time_to_load, | 465 time_to_load, |
469 base::TimeDelta::FromMilliseconds(10), | 466 base::TimeDelta::FromMilliseconds(10), |
470 base::TimeDelta::FromSeconds(100), | 467 base::TimeDelta::FromSeconds(100), |
471 100); | 468 100); |
472 // Record a time for the number of tabs, to help track down contention. | 469 // Record a time for the number of tabs, to help track down contention. |
473 std::string time_for_count = | 470 std::string time_for_count = |
474 base::StringPrintf("SessionRestore.AllTabsLoaded_%d", tab_count_); | 471 base::StringPrintf("SessionRestore.AllTabsLoaded_%d", tab_count_); |
475 base::HistogramBase* counter_for_count = | 472 base::HistogramBase* counter_for_count = |
(...skipping 816 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1292 if (!active_session_restorers) | 1289 if (!active_session_restorers) |
1293 return false; | 1290 return false; |
1294 for (std::set<SessionRestoreImpl*>::const_iterator it = | 1291 for (std::set<SessionRestoreImpl*>::const_iterator it = |
1295 active_session_restorers->begin(); | 1292 active_session_restorers->begin(); |
1296 it != active_session_restorers->end(); ++it) { | 1293 it != active_session_restorers->end(); ++it) { |
1297 if ((*it)->synchronous()) | 1294 if ((*it)->synchronous()) |
1298 return true; | 1295 return true; |
1299 } | 1296 } |
1300 return false; | 1297 return false; |
1301 } | 1298 } |
OLD | NEW |