Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(421)

Unified Diff: build/android/pylib/utils/watchdog_timer.py

Issue 1314913009: [Android] Move some pylib modules into devil/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « build/android/pylib/utils/timeout_retry.py ('k') | build/android/pylib/utils/zip_utils.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: build/android/pylib/utils/watchdog_timer.py
diff --git a/build/android/pylib/utils/watchdog_timer.py b/build/android/pylib/utils/watchdog_timer.py
index 2f4c46455be7c9751e9a570a8f41cac0e3430cf7..967794c4fdf399dfc7f7b2a2329684242452772a 100644
--- a/build/android/pylib/utils/watchdog_timer.py
+++ b/build/android/pylib/utils/watchdog_timer.py
@@ -1,47 +1,8 @@
-# Copyright 2013 The Chromium Authors. All rights reserved.
+# Copyright 2015 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.
-"""WatchdogTimer timeout objects."""
+# pylint: disable=unused-wildcard-import
+# pylint: disable=wildcard-import
-import time
-
-
-class WatchdogTimer(object):
- """A resetable timeout-based watchdog.
-
- This object is threadsafe.
- """
-
- def __init__(self, timeout):
- """Initializes the watchdog.
-
- Args:
- timeout: The timeout in seconds. If timeout is None it will never timeout.
- """
- self._start_time = time.time()
- self._timeout = timeout
-
- def Reset(self):
- """Resets the timeout countdown."""
- self._start_time = time.time()
-
- def GetElapsed(self):
- """Returns the elapsed time of the watchdog."""
- return time.time() - self._start_time
-
- def GetRemaining(self):
- """Returns the remaining time of the watchdog."""
- if self._timeout:
- return self._timeout - self.GetElapsed()
- else:
- return None
-
- def IsTimedOut(self):
- """Whether the watchdog has timed out.
-
- Returns:
- True if the watchdog has timed out, False otherwise.
- """
- remaining = self.GetRemaining()
- return remaining is not None and remaining < 0
+from devil.utils.watchdog_timer import *
« no previous file with comments | « build/android/pylib/utils/timeout_retry.py ('k') | build/android/pylib/utils/zip_utils.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698