summaryrefslogtreecommitdiffstats
path: root/mojo/system/waiter.cc
diff options
context:
space:
mode:
authorviettrungluu@chromium.org <viettrungluu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-06-24 15:29:45 +0000
committerviettrungluu@chromium.org <viettrungluu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-06-24 15:29:45 +0000
commit95c4ab642a3de8bf81600fd963c64471c848e14d (patch)
treea7d0c16fcd322f57b2622ab465b94d9ed750c6f7 /mojo/system/waiter.cc
parentf577cd09d3d489122ffb75b8d5ba66f7a63eeb59 (diff)
downloadchromium_src-95c4ab642a3de8bf81600fd963c64471c848e14d.zip
chromium_src-95c4ab642a3de8bf81600fd963c64471c848e14d.tar.gz
chromium_src-95c4ab642a3de8bf81600fd963c64471c848e14d.tar.bz2
Mojo: Always use Now() instead of HighResNow().
This will hopefully fix/reduce flakiness of MessagePipeDispatcherTest.BasicThreaded on Windows. This is a no-op on Mac and non-Mac POSIX (where Now() and HighResNow() are the same). Apparently, the canonical time is "Now". Our current, weird implementation of PlatformThread::Sleep() for Windows is: // When measured with a high resolution clock, Sleep() sometimes returns much // too early. We may need to call it repeatedly to get the desired duration. TimeTicks end = TimeTicks::Now() + duration; TimeTicks now; while ((now = TimeTicks::Now()) < end) ::Sleep((end - now).InMillisecondsRoundedUp()); Of course, if Now() is *not* the high res timer ... who knows what the effect of this is versus HighResNow(). (We could end up having slept for much longer -- as measured by HighResNow() -- than we wanted. This seems to be the symptom of this particular flakiness.) On the other hand, who knows what timer the timeouts of WaitForSingleObject(), etc. are relative to. So the correctness of times in Chromium on Windows is highly suspect. R=yzshen@chromium.org BUG=387513 Review URL: https://codereview.chromium.org/354533003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@279413 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'mojo/system/waiter.cc')
-rw-r--r--mojo/system/waiter.cc4
1 files changed, 2 insertions, 2 deletions
diff --git a/mojo/system/waiter.cc b/mojo/system/waiter.cc
index 5a3150d..381f9bb 100644
--- a/mojo/system/waiter.cc
+++ b/mojo/system/waiter.cc
@@ -64,10 +64,10 @@ MojoResult Waiter::Wait(MojoDeadline deadline, uint32_t* context) {
} else {
// NOTE(vtl): This is very inefficient on POSIX, since pthreads condition
// variables take an absolute deadline.
- const base::TimeTicks end_time = base::TimeTicks::HighResNow() +
+ const base::TimeTicks end_time = base::TimeTicks::Now() +
base::TimeDelta::FromMicroseconds(static_cast<int64_t>(deadline));
do {
- base::TimeTicks now_time = base::TimeTicks::HighResNow();
+ base::TimeTicks now_time = base::TimeTicks::Now();
if (now_time >= end_time)
return MOJO_RESULT_DEADLINE_EXCEEDED;