summaryrefslogtreecommitdiffstats
path: root/content/gpu
diff options
context:
space:
mode:
authortedvessenes@gmail.com <tedvessenes@gmail.com@0039d316-1c4b-4281-b951-d872f2087c98>2012-01-11 23:38:01 +0000
committertedvessenes@gmail.com <tedvessenes@gmail.com@0039d316-1c4b-4281-b951-d872f2087c98>2012-01-11 23:38:01 +0000
commit2196015316da309926cb8029cbda71004f305b56 (patch)
treea26bd392254576952b669befe77216d04279d665 /content/gpu
parenta6080c04b2d12af8bc1d5c31f422b473f748574a (diff)
downloadchromium_src-2196015316da309926cb8029cbda71004f305b56.zip
chromium_src-2196015316da309926cb8029cbda71004f305b56.tar.gz
chromium_src-2196015316da309926cb8029cbda71004f305b56.tar.bz2
Convert use of int ms to TimeDelta in files owned by apatrick.
R=apatrick@chromium.org BUG=108171 TEST= Review URL: http://codereview.chromium.org/9188017 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@117324 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/gpu')
-rw-r--r--content/gpu/gpu_watchdog_thread.cc21
-rw-r--r--content/gpu/gpu_watchdog_thread.h8
2 files changed, 14 insertions, 15 deletions
diff --git a/content/gpu/gpu_watchdog_thread.cc b/content/gpu/gpu_watchdog_thread.cc
index dd7e075..67d7727 100644
--- a/content/gpu/gpu_watchdog_thread.cc
+++ b/content/gpu/gpu_watchdog_thread.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -17,17 +17,17 @@
#include "content/public/common/result_codes.h"
namespace {
-const int64 kCheckPeriod = 2000;
+const base::TimeDelta kCheckPeriod = base::TimeDelta::FromSeconds(2);
} // namespace
GpuWatchdogThread::GpuWatchdogThread(int timeout)
: base::Thread("Watchdog"),
watched_message_loop_(MessageLoop::current()),
- timeout_(timeout),
+ timeout_(base::TimeDelta::FromMilliseconds(timeout)),
armed_(false),
#if defined(OS_WIN)
watched_thread_handle_(0),
- arm_cpu_time_(0),
+ arm_cpu_time_(base::TimeDelta()),
#endif
ALLOW_THIS_IN_INITIALIZER_LIST(task_observer_(this)),
ALLOW_THIS_IN_INITIALIZER_LIST(weak_factory_(this)) {
@@ -125,7 +125,7 @@ void GpuWatchdogThread::OnAcknowledge() {
}
#if defined(OS_WIN)
-int64 GpuWatchdogThread::GetWatchedThreadTime() {
+base::TimeDelta GpuWatchdogThread::GetWatchedThreadTime() {
FILETIME creation_time;
FILETIME exit_time;
FILETIME user_time;
@@ -152,8 +152,8 @@ int64 GpuWatchdogThread::GetWatchedThreadTime() {
// returns to user level or where user level code
// calls into kernel level repeatedly, giving up its quanta before it is
// tracked, for example a loop that repeatedly Sleeps.
- return static_cast<int64>(
- (user_time64.QuadPart + kernel_time64.QuadPart) / 10000);
+ return base::TimeDelta::FromMilliseconds(static_cast<int64>(
+ (user_time64.QuadPart + kernel_time64.QuadPart) / 10000));
}
#endif
@@ -194,7 +194,7 @@ void GpuWatchdogThread::DeliberatelyTerminateToRecoverFromHang() {
#if defined(OS_WIN)
// Defer termination until a certain amount of CPU time has elapsed on the
// watched thread.
- int64 time_since_arm = GetWatchedThreadTime() - arm_cpu_time_;
+ base::TimeDelta time_since_arm = GetWatchedThreadTime() - arm_cpu_time_;
if (time_since_arm < timeout_) {
message_loop()->PostDelayedTask(
FROM_HERE,
@@ -210,8 +210,7 @@ void GpuWatchdogThread::DeliberatelyTerminateToRecoverFromHang() {
// the watchdog check. This is to prevent the watchdog thread from terminating
// when a machine wakes up from sleep or hibernation, which would otherwise
// appear to be a hang.
- if ((base::Time::Now() - arm_absolute_time_).InMilliseconds() >
- timeout_ * 2) {
+ if (base::Time::Now() - arm_absolute_time_ > timeout_ * 2) {
armed_ = false;
OnCheck();
return;
@@ -230,7 +229,7 @@ void GpuWatchdogThread::DeliberatelyTerminateToRecoverFromHang() {
#endif
LOG(ERROR) << "The GPU process hung. Terminating after "
- << timeout_ << " ms.";
+ << timeout_.InMilliseconds() << " ms.";
base::Process current_process(base::GetCurrentProcessHandle());
current_process.Terminate(content::RESULT_CODE_HUNG);
diff --git a/content/gpu/gpu_watchdog_thread.h b/content/gpu/gpu_watchdog_thread.h
index 2572706e..8f3ee90 100644
--- a/content/gpu/gpu_watchdog_thread.h
+++ b/content/gpu/gpu_watchdog_thread.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -55,16 +55,16 @@ class GpuWatchdogThread : public base::Thread,
void DeliberatelyTerminateToRecoverFromHang();
void Disable();
- int64 GetWatchedThreadTime();
+ base::TimeDelta GetWatchedThreadTime();
MessageLoop* watched_message_loop_;
- int timeout_;
+ base::TimeDelta timeout_;
volatile bool armed_;
GpuWatchdogTaskObserver task_observer_;
#if defined(OS_WIN)
void* watched_thread_handle_;
- int64 arm_cpu_time_;
+ base::TimeDelta arm_cpu_time_;
#endif
base::Time arm_absolute_time_;