| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 <vector> | 10 #include <vector> |
| 11 | 11 |
| 12 #include "base/callback.h" | 12 #include "base/callback.h" |
| 13 #include "base/command_line.h" | 13 #include "base/command_line.h" |
| 14 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
| 15 #include "base/metrics/histogram.h" | 15 #include "base/metrics/histogram.h" |
| 16 #include "base/stl_util-inl.h" | 16 #include "base/stl_util-inl.h" |
| 17 #include "base/string_util.h" | 17 #include "base/stringprintf.h" |
| 18 #include "chrome/browser/extensions/extension_service.h" | 18 #include "chrome/browser/extensions/extension_service.h" |
| 19 #include "chrome/browser/profiles/profile.h" | 19 #include "chrome/browser/profiles/profile.h" |
| 20 #include "chrome/browser/sessions/session_service.h" | 20 #include "chrome/browser/sessions/session_service.h" |
| 21 #include "chrome/browser/sessions/session_service_factory.h" | 21 #include "chrome/browser/sessions/session_service_factory.h" |
| 22 #include "chrome/browser/sessions/session_types.h" | 22 #include "chrome/browser/sessions/session_types.h" |
| 23 #include "chrome/browser/tabs/tab_strip_model.h" | 23 #include "chrome/browser/tabs/tab_strip_model.h" |
| 24 #include "chrome/browser/ui/browser.h" | 24 #include "chrome/browser/ui/browser.h" |
| 25 #include "chrome/browser/ui/browser_list.h" | 25 #include "chrome/browser/ui/browser_list.h" |
| 26 #include "chrome/browser/ui/browser_navigator.h" | 26 #include "chrome/browser/ui/browser_navigator.h" |
| 27 #include "chrome/browser/ui/browser_window.h" | 27 #include "chrome/browser/ui/browser_window.h" |
| (...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 293 base::TimeTicks::Now() - restore_started_; | 293 base::TimeTicks::Now() - restore_started_; |
| 294 UMA_HISTOGRAM_CUSTOM_TIMES( | 294 UMA_HISTOGRAM_CUSTOM_TIMES( |
| 295 "SessionRestore.FirstTabPainted", | 295 "SessionRestore.FirstTabPainted", |
| 296 time_to_paint, | 296 time_to_paint, |
| 297 base::TimeDelta::FromMilliseconds(10), | 297 base::TimeDelta::FromMilliseconds(10), |
| 298 base::TimeDelta::FromSeconds(100), | 298 base::TimeDelta::FromSeconds(100), |
| 299 100); | 299 100); |
| 300 // Record a time for the number of tabs, to help track down | 300 // Record a time for the number of tabs, to help track down |
| 301 // contention. | 301 // contention. |
| 302 std::string time_for_count = | 302 std::string time_for_count = |
| 303 StringPrintf("SessionRestore.FirstTabPainted_%d", tab_count_); | 303 base::StringPrintf("SessionRestore.FirstTabPainted_%d", |
| 304 tab_count_); |
| 304 base::Histogram* counter_for_count = | 305 base::Histogram* counter_for_count = |
| 305 base::Histogram::FactoryTimeGet( | 306 base::Histogram::FactoryTimeGet( |
| 306 time_for_count, | 307 time_for_count, |
| 307 base::TimeDelta::FromMilliseconds(10), | 308 base::TimeDelta::FromMilliseconds(10), |
| 308 base::TimeDelta::FromSeconds(100), | 309 base::TimeDelta::FromSeconds(100), |
| 309 100, | 310 100, |
| 310 base::Histogram::kUmaTargetedHistogramFlag); | 311 base::Histogram::kUmaTargetedHistogramFlag); |
| 311 counter_for_count->AddTime(time_to_paint); | 312 counter_for_count->AddTime(time_to_paint); |
| 312 } else if (render_widget_hosts_loading_.find(render_widget_host) == | 313 } else if (render_widget_hosts_loading_.find(render_widget_host) == |
| 313 render_widget_hosts_loading_.end()) { | 314 render_widget_hosts_loading_.end()) { |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 381 base::TimeDelta time_to_load = | 382 base::TimeDelta time_to_load = |
| 382 base::TimeTicks::Now() - restore_started_; | 383 base::TimeTicks::Now() - restore_started_; |
| 383 UMA_HISTOGRAM_CUSTOM_TIMES( | 384 UMA_HISTOGRAM_CUSTOM_TIMES( |
| 384 "SessionRestore.AllTabsLoaded", | 385 "SessionRestore.AllTabsLoaded", |
| 385 time_to_load, | 386 time_to_load, |
| 386 base::TimeDelta::FromMilliseconds(10), | 387 base::TimeDelta::FromMilliseconds(10), |
| 387 base::TimeDelta::FromSeconds(100), | 388 base::TimeDelta::FromSeconds(100), |
| 388 100); | 389 100); |
| 389 // Record a time for the number of tabs, to help track down contention. | 390 // Record a time for the number of tabs, to help track down contention. |
| 390 std::string time_for_count = | 391 std::string time_for_count = |
| 391 StringPrintf("SessionRestore.AllTabsLoaded_%d", tab_count_); | 392 base::StringPrintf("SessionRestore.AllTabsLoaded_%d", tab_count_); |
| 392 base::Histogram* counter_for_count = | 393 base::Histogram* counter_for_count = |
| 393 base::Histogram::FactoryTimeGet( | 394 base::Histogram::FactoryTimeGet( |
| 394 time_for_count, | 395 time_for_count, |
| 395 base::TimeDelta::FromMilliseconds(10), | 396 base::TimeDelta::FromMilliseconds(10), |
| 396 base::TimeDelta::FromSeconds(100), | 397 base::TimeDelta::FromSeconds(100), |
| 397 100, | 398 100, |
| 398 base::Histogram::kUmaTargetedHistogramFlag); | 399 base::Histogram::kUmaTargetedHistogramFlag); |
| 399 counter_for_count->AddTime(time_to_load); | 400 counter_for_count->AddTime(time_to_load); |
| 400 } | 401 } |
| 401 } | 402 } |
| (...skipping 440 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 842 Browser* SessionRestore::RestoreSessionSynchronously( | 843 Browser* SessionRestore::RestoreSessionSynchronously( |
| 843 Profile* profile, | 844 Profile* profile, |
| 844 const std::vector<GURL>& urls_to_open) { | 845 const std::vector<GURL>& urls_to_open) { |
| 845 return Restore(profile, NULL, true, false, true, urls_to_open); | 846 return Restore(profile, NULL, true, false, true, urls_to_open); |
| 846 } | 847 } |
| 847 | 848 |
| 848 // static | 849 // static |
| 849 bool SessionRestore::IsRestoring() { | 850 bool SessionRestore::IsRestoring() { |
| 850 return restoring; | 851 return restoring; |
| 851 } | 852 } |
| OLD | NEW |