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/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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 } | 48 } |
49 | 49 |
50 void ThreadUnresponsive_WEBKIT() { | 50 void ThreadUnresponsive_WEBKIT() { |
51 CHECK(false); | 51 CHECK(false); |
52 } | 52 } |
53 | 53 |
54 void ThreadUnresponsive_FILE() { | 54 void ThreadUnresponsive_FILE() { |
55 CHECK(false); | 55 CHECK(false); |
56 } | 56 } |
57 | 57 |
| 58 void ThreadUnresponsive_FILE_USER_BLOCKING() { |
| 59 CHECK(false); |
| 60 } |
| 61 |
58 void ThreadUnresponsive_PROCESS_LAUNCHER() { | 62 void ThreadUnresponsive_PROCESS_LAUNCHER() { |
59 CHECK(false); | 63 CHECK(false); |
60 } | 64 } |
61 | 65 |
62 void ThreadUnresponsive_CACHE() { | 66 void ThreadUnresponsive_CACHE() { |
63 CHECK(false); | 67 CHECK(false); |
64 } | 68 } |
65 | 69 |
66 void ThreadUnresponsive_IO() { | 70 void ThreadUnresponsive_IO() { |
67 CHECK(false); | 71 CHECK(false); |
(...skipping 13 matching lines...) Expand all Loading... |
81 | 85 |
82 switch (thread_id) { | 86 switch (thread_id) { |
83 case BrowserThread::UI: | 87 case BrowserThread::UI: |
84 return ThreadUnresponsive_UI(); | 88 return ThreadUnresponsive_UI(); |
85 case BrowserThread::DB: | 89 case BrowserThread::DB: |
86 return ThreadUnresponsive_DB(); | 90 return ThreadUnresponsive_DB(); |
87 case BrowserThread::WEBKIT: | 91 case BrowserThread::WEBKIT: |
88 return ThreadUnresponsive_WEBKIT(); | 92 return ThreadUnresponsive_WEBKIT(); |
89 case BrowserThread::FILE: | 93 case BrowserThread::FILE: |
90 return ThreadUnresponsive_FILE(); | 94 return ThreadUnresponsive_FILE(); |
| 95 case BrowserThread::FILE_USER_BLOCKING: |
| 96 return ThreadUnresponsive_FILE_USER_BLOCKING(); |
91 case BrowserThread::PROCESS_LAUNCHER: | 97 case BrowserThread::PROCESS_LAUNCHER: |
92 return ThreadUnresponsive_PROCESS_LAUNCHER(); | 98 return ThreadUnresponsive_PROCESS_LAUNCHER(); |
93 case BrowserThread::CACHE: | 99 case BrowserThread::CACHE: |
94 return ThreadUnresponsive_CACHE(); | 100 return ThreadUnresponsive_CACHE(); |
95 case BrowserThread::IO: | 101 case BrowserThread::IO: |
96 return ThreadUnresponsive_IO(); | 102 return ThreadUnresponsive_IO(); |
97 #if defined(OS_CHROMEOS) | 103 #if defined(OS_CHROMEOS) |
98 case BrowserThread::WEB_SOCKET_PROXY: | 104 case BrowserThread::WEB_SOCKET_PROXY: |
99 return ThreadUnresponsive_WEB_SOCKET_PROXY(); | 105 return ThreadUnresponsive_WEB_SOCKET_PROXY(); |
100 #endif | 106 #endif |
(...skipping 475 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
576 live_threads_threshold); | 582 live_threads_threshold); |
577 StartWatching(BrowserThread::IO, "IO", kSleepTime, kUnresponsiveTime, | 583 StartWatching(BrowserThread::IO, "IO", kSleepTime, kUnresponsiveTime, |
578 unresponsive_threshold, crash_on_hang_thread_names, | 584 unresponsive_threshold, crash_on_hang_thread_names, |
579 live_threads_threshold); | 585 live_threads_threshold); |
580 StartWatching(BrowserThread::DB, "DB", kSleepTime, kUnresponsiveTime, | 586 StartWatching(BrowserThread::DB, "DB", kSleepTime, kUnresponsiveTime, |
581 unresponsive_threshold, crash_on_hang_thread_names, | 587 unresponsive_threshold, crash_on_hang_thread_names, |
582 live_threads_threshold); | 588 live_threads_threshold); |
583 StartWatching(BrowserThread::FILE, "FILE", kSleepTime, kUnresponsiveTime, | 589 StartWatching(BrowserThread::FILE, "FILE", kSleepTime, kUnresponsiveTime, |
584 unresponsive_threshold, crash_on_hang_thread_names, | 590 unresponsive_threshold, crash_on_hang_thread_names, |
585 live_threads_threshold); | 591 live_threads_threshold); |
| 592 StartWatching(BrowserThread::FILE_USER_BLOCKING, "FILE_USER_BLOCKING", |
| 593 kSleepTime, kUnresponsiveTime, |
| 594 unresponsive_threshold, crash_on_hang_thread_names, |
| 595 live_threads_threshold); |
586 StartWatching(BrowserThread::CACHE, "CACHE", kSleepTime, kUnresponsiveTime, | 596 StartWatching(BrowserThread::CACHE, "CACHE", kSleepTime, kUnresponsiveTime, |
587 unresponsive_threshold, crash_on_hang_thread_names, | 597 unresponsive_threshold, crash_on_hang_thread_names, |
588 live_threads_threshold); | 598 live_threads_threshold); |
589 | 599 |
590 BrowserThread::PostTask( | 600 BrowserThread::PostTask( |
591 BrowserThread::UI, | 601 BrowserThread::UI, |
592 FROM_HERE, | 602 FROM_HERE, |
593 base::Bind(&StartupTimeBomb::DisarmStartupTimeBomb)); | 603 base::Bind(&StartupTimeBomb::DisarmStartupTimeBomb)); |
594 } | 604 } |
595 | 605 |
(...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
906 | 916 |
907 #if defined(OS_WIN) | 917 #if defined(OS_WIN) |
908 // On Windows XP, give twice the time for shutdown. | 918 // On Windows XP, give twice the time for shutdown. |
909 if (base::win::GetVersion() <= base::win::VERSION_XP) | 919 if (base::win::GetVersion() <= base::win::VERSION_XP) |
910 actual_duration *= 2; | 920 actual_duration *= 2; |
911 #endif | 921 #endif |
912 | 922 |
913 shutdown_watchdog_ = new ShutdownWatchDogThread(actual_duration); | 923 shutdown_watchdog_ = new ShutdownWatchDogThread(actual_duration); |
914 shutdown_watchdog_->Arm(); | 924 shutdown_watchdog_->Arm(); |
915 } | 925 } |
OLD | NEW |