When converting between units of time or data types of different precision,
we have to be careful to consistently round in the same direction. Timeout checks usually check if Now() is less or equal to a deadline in order to determine if a timeout has occurred. This correctly handles the case where actual sleep times are equal or longer than requested sleep times. But if we round down when setting the sleep delay, this can result in unnecessary and expensive looping. Make sure, we always round up when converting to a format with less precision. BUG=none TEST=none Review URL: http://codereview.chromium.org/196053 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@27146 0039d316-1c4b-4281-b951-d872f2087c98
Showing
- base/time.cc 5 additions, 0 deletionsbase/time.cc
- base/time.h 1 addition, 0 deletionsbase/time.h
- base/timer.cc 1 addition, 1 deletionbase/timer.cc
- net/socket/client_socket_pool_base_unittest.cc 28 additions, 11 deletionsnet/socket/client_socket_pool_base_unittest.cc
- net/socket/socket_test_util.cc 9 additions, 0 deletionsnet/socket/socket_test_util.cc
- webkit/glue/webkitclient_impl.cc 14 additions, 2 deletionswebkit/glue/webkitclient_impl.cc
Loading
Please register or sign in to comment