| 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/metrics/thread_watcher.h" | 5 #include "chrome/browser/metrics/thread_watcher.h" |
| 6 | 6 |
| 7 #include <math.h> // ceil | 7 #include <math.h> // ceil |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| (...skipping 892 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 903 // without crashing and in debug mode we break into the debugger. | 903 // without crashing and in debug mode we break into the debugger. |
| 904 virtual void Alarm() OVERRIDE { | 904 virtual void Alarm() OVERRIDE { |
| 905 #if !defined(NDEBUG) | 905 #if !defined(NDEBUG) |
| 906 StartupCrash(); | 906 StartupCrash(); |
| 907 return; | 907 return; |
| 908 #elif !defined(OS_ANDROID) | 908 #elif !defined(OS_ANDROID) |
| 909 WatchDogThread::PostTask(FROM_HERE, base::Bind(&StartupCrash)); | 909 WatchDogThread::PostTask(FROM_HERE, base::Bind(&StartupCrash)); |
| 910 return; | 910 return; |
| 911 #else // Android release: gather stats to figure out when to crash. | 911 #else // Android release: gather stats to figure out when to crash. |
| 912 // TODO(rtenneti): Delete this code, after getting data. | 912 // TODO(rtenneti): Delete this code, after getting data. |
| 913 UMA_HISTOGRAM_TIMES("StartupTimebomm.Alarm.TimeDuration", | 913 UMA_HISTOGRAM_TIMES("StartupTimeBomb.Alarm.TimeDuration", |
| 914 base::Time::Now() - start_time_clock_); | 914 base::Time::Now() - start_time_clock_); |
| 915 UMA_HISTOGRAM_TIMES("StartupTimebomm.Alarm.TimeTicksDuration", | 915 UMA_HISTOGRAM_TIMES("StartupTimeBomb.Alarm.TimeTicksDuration", |
| 916 base::TimeTicks::Now() - start_time_monotonic_); | 916 base::TimeTicks::Now() - start_time_monotonic_); |
| 917 if (base::TimeTicks::IsThreadNowSupported()) { | 917 if (base::TimeTicks::IsThreadNowSupported()) { |
| 918 UMA_HISTOGRAM_TIMES( | 918 UMA_HISTOGRAM_TIMES( |
| 919 "StartupTimebomm.Alarm.ThreadNowDuration", | 919 "StartupTimeBomb.Alarm.ThreadNowDuration", |
| 920 base::TimeTicks::ThreadNow() - start_time_thread_now_); | 920 base::TimeTicks::ThreadNow() - start_time_thread_now_); |
| 921 } | 921 } |
| 922 return; | 922 return; |
| 923 #endif // OS_ANDROID | 923 #endif // OS_ANDROID |
| 924 } | 924 } |
| 925 | 925 |
| 926 private: | 926 private: |
| 927 #if defined(OS_ANDROID) | 927 #if defined(OS_ANDROID) |
| 928 // TODO(rtenneti): Delete this code, after getting data. | 928 // TODO(rtenneti): Delete this code, after getting data. |
| 929 base::Time start_time_clock_; | 929 base::Time start_time_clock_; |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1050 | 1050 |
| 1051 #if defined(OS_WIN) | 1051 #if defined(OS_WIN) |
| 1052 // On Windows XP, give twice the time for shutdown. | 1052 // On Windows XP, give twice the time for shutdown. |
| 1053 if (base::win::GetVersion() <= base::win::VERSION_XP) | 1053 if (base::win::GetVersion() <= base::win::VERSION_XP) |
| 1054 actual_duration *= 2; | 1054 actual_duration *= 2; |
| 1055 #endif | 1055 #endif |
| 1056 | 1056 |
| 1057 shutdown_watchdog_ = new ShutdownWatchDogThread(actual_duration); | 1057 shutdown_watchdog_ = new ShutdownWatchDogThread(actual_duration); |
| 1058 shutdown_watchdog_->Arm(); | 1058 shutdown_watchdog_->Arm(); |
| 1059 } | 1059 } |
| OLD | NEW |