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

Unified Diff: trunk/src/tools/telemetry/telemetry/core/util.py

Issue 60233004: Revert 232959 "[Telemetry] Fix image_decoding_measurement timeout." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 7 years, 1 month 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
Index: trunk/src/tools/telemetry/telemetry/core/util.py
===================================================================
--- trunk/src/tools/telemetry/telemetry/core/util.py (revision 233019)
+++ trunk/src/tools/telemetry/telemetry/core/util.py (working copy)
@@ -39,7 +39,7 @@
sys.path.append(path)
-def WaitFor(condition, timeout):
+def WaitFor(condition, timeout, pass_time_left_to_func=False):
"""Waits for up to |timeout| secs for the function |condition| to return True.
Polling frequency is (elapsed_time / 10), with a min of .1s and max of 5s.
@@ -50,7 +50,11 @@
start_time = time.time()
while True:
elapsed_time = time.time() - start_time
- res = condition()
+ if pass_time_left_to_func:
+ remaining_time = timeout - elapsed_time
+ res = condition(max(remaining_time, 0.0))
+ else:
+ res = condition()
if res:
return res
if elapsed_time > timeout:

Powered by Google App Engine
This is Rietveld 408576698