| 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/chrome_browser_main.h" | 5 #include "chrome/browser/chrome_browser_main.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/at_exit.h" | 11 #include "base/at_exit.h" |
| 12 #include "base/bind.h" | 12 #include "base/bind.h" |
| 13 #include "base/command_line.h" | 13 #include "base/command_line.h" |
| 14 #include "base/debug/trace_event.h" | 14 #include "base/debug/trace_event.h" |
| 15 #include "base/file_path.h" | 15 #include "base/file_path.h" |
| 16 #include "base/file_util.h" | 16 #include "base/file_util.h" |
| 17 #include "base/metrics/field_trial.h" | 17 #include "base/metrics/field_trial.h" |
| 18 #include "base/metrics/histogram.h" | 18 #include "base/metrics/histogram.h" |
| 19 #include "base/path_service.h" | 19 #include "base/path_service.h" |
| 20 #include "base/process_info.h" |
| 20 #include "base/process_util.h" | 21 #include "base/process_util.h" |
| 21 #include "base/string_number_conversions.h" | 22 #include "base/string_number_conversions.h" |
| 22 #include "base/string_piece.h" | 23 #include "base/string_piece.h" |
| 23 #include "base/string_split.h" | 24 #include "base/string_split.h" |
| 24 #include "base/string_util.h" | 25 #include "base/string_util.h" |
| 25 #include "base/stringprintf.h" | 26 #include "base/stringprintf.h" |
| 26 #include "base/sys_string_conversions.h" | 27 #include "base/sys_string_conversions.h" |
| 27 #include "base/threading/platform_thread.h" | 28 #include "base/threading/platform_thread.h" |
| 28 #include "base/time.h" | 29 #include "base/time.h" |
| 29 #include "base/utf_string_conversions.h" | 30 #include "base/utf_string_conversions.h" |
| (...skipping 1965 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1995 } | 1996 } |
| 1996 | 1997 |
| 1997 // Public members: | 1998 // Public members: |
| 1998 | 1999 |
| 1999 void ChromeBrowserMainParts::AddParts(ChromeBrowserMainExtraParts* parts) { | 2000 void ChromeBrowserMainParts::AddParts(ChromeBrowserMainExtraParts* parts) { |
| 2000 chrome_extra_parts_.push_back(parts); | 2001 chrome_extra_parts_.push_back(parts); |
| 2001 } | 2002 } |
| 2002 | 2003 |
| 2003 // Misc ------------------------------------------------------------------------ | 2004 // Misc ------------------------------------------------------------------------ |
| 2004 | 2005 |
| 2006 void RecordBrowserStartupTime() { |
| 2007 // CurrentProcessInfo::CreationTime() is currently only implemented on Mac and |
| 2008 // Windows. |
| 2009 #if defined(OS_MACOSX) || defined(OS_WIN) |
| 2010 const base::Time *process_creation_time = |
| 2011 base::CurrentProcessInfo::CreationTime(); |
| 2012 |
| 2013 if (!process_creation_time->is_null()) |
| 2014 RecordPreReadExperimentTime("Startup.BrowserMessageLoopStartTime", |
| 2015 base::Time::Now() - *process_creation_time); |
| 2016 #endif // OS_MACOSX || OS_WIN |
| 2017 } |
| 2018 |
| 2005 // This code is specific to the Windows-only PreReadExperiment field-trial. | 2019 // This code is specific to the Windows-only PreReadExperiment field-trial. |
| 2006 void RecordPreReadExperimentTime(const char* name, base::TimeDelta time) { | 2020 void RecordPreReadExperimentTime(const char* name, base::TimeDelta time) { |
| 2007 DCHECK(name != NULL); | 2021 DCHECK(name != NULL); |
| 2008 | 2022 |
| 2009 // This gets called with different histogram names, so we don't want to use | 2023 // This gets called with different histogram names, so we don't want to use |
| 2010 // the UMA_HISTOGRAM_CUSTOM_TIMES macro--it uses a static variable, and the | 2024 // the UMA_HISTOGRAM_CUSTOM_TIMES macro--it uses a static variable, and the |
| 2011 // first call wins. | 2025 // first call wins. |
| 2012 AddPreReadHistogramTime(name, time); | 2026 AddPreReadHistogramTime(name, time); |
| 2013 | 2027 |
| 2014 #if defined(OS_WIN) | 2028 #if defined(OS_WIN) |
| (...skipping 12 matching lines...) Expand all Loading... |
| 2027 if (base::win::GetVersion() <= base::win::VERSION_XP) | 2041 if (base::win::GetVersion() <= base::win::VERSION_XP) |
| 2028 uma_name += "_XP"; | 2042 uma_name += "_XP"; |
| 2029 | 2043 |
| 2030 uma_name += "_PreRead_"; | 2044 uma_name += "_PreRead_"; |
| 2031 uma_name += pre_read_percentage; | 2045 uma_name += pre_read_percentage; |
| 2032 AddPreReadHistogramTime(uma_name.c_str(), time); | 2046 AddPreReadHistogramTime(uma_name.c_str(), time); |
| 2033 } | 2047 } |
| 2034 #endif | 2048 #endif |
| 2035 #endif | 2049 #endif |
| 2036 } | 2050 } |
| OLD | NEW |