Increased the unresponsive_threshold from 6 to 12
in Beta channel and XP. We will crash the browser
if UI/IO threads don't respond within 24 secs
(instead of 12 secs) in Beta channel and Windows XP.

BUG=90095
R=jar
TEST=thread_watcher unit tests

Review URL: http://codereview.chromium.org/7744015

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@98697 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/chrome/browser/metrics/thread_watcher.cc b/chrome/browser/metrics/thread_watcher.cc
index 5c7103d26..22c26f8 100644
--- a/chrome/browser/metrics/thread_watcher.cc
+++ b/chrome/browser/metrics/thread_watcher.cc
@@ -16,7 +16,7 @@
 #include "content/common/notification_service.h"
 
 #if defined(OS_WIN)
-#include <Objbase.h>
+#include "base/win/windows_version.h"
 #endif
 
 // static
@@ -417,6 +417,22 @@
     uint32* live_threads_threshold) {
   // Determine |unresponsive_threshold| based on switches::kCrashOnHangSeconds.
   *unresponsive_threshold = kUnresponsiveCount;
+
+  if (chrome::VersionInfo::GetChannel() == chrome::VersionInfo::CHANNEL_BETA) {
+    // Increase the unresponsive_threshold in Beta channel to reduce the number
+    // of crashes due to ThreadWatcher.
+    *unresponsive_threshold *= 2;
+  } else {
+    // In Canary and Dev channels, for Windows XP (old systems), double the
+    // unresponsive_threshold to give OS a chance to schedule UI/IO threads a
+    // time slice to respond with a pong message (to get around limitations with
+    // the OS).
+#if defined(OS_WIN)
+    if (base::win::GetVersion() <= base::win::VERSION_XP)
+      *unresponsive_threshold *= 2;
+#endif
+  }
+
   std::string crash_on_hang_seconds =
       command_line.GetSwitchValueASCII(switches::kCrashOnHangSeconds);
   if (!crash_on_hang_seconds.empty()) {