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

Issue 196053: When converting between units of time or data types of different precision,... (Closed)

Created:
11 years, 3 months ago by Markus (顧孟勤)
Modified:
9 years, 7 months ago
CC:
chromium-reviews_googlegroups.com, darin (slow to review), brettw
Visibility:
Public.

Description

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

Patch Set 1 #

Total comments: 1

Patch Set 2 : '' #

Total comments: 5

Patch Set 3 : '' #

Unified diffs Side-by-side diffs Delta from patch set Stats (+58 lines, -14 lines) Patch
M base/time.h View 1 2 1 chunk +1 line, -0 lines 0 comments Download
M base/time.cc View 1 2 1 chunk +5 lines, -0 lines 0 comments Download
M base/timer.cc View 1 2 1 chunk +1 line, -1 line 0 comments Download
M net/socket/client_socket_pool_base_unittest.cc View 2 3 chunks +28 lines, -11 lines 0 comments Download
M net/socket/socket_test_util.cc View 2 1 chunk +9 lines, -0 lines 0 comments Download
M webkit/glue/webkitclient_impl.cc View 1 2 2 chunks +14 lines, -2 lines 0 comments Download

Messages

Total messages: 13 (0 generated)
Markus (顧孟勤)
11 years, 3 months ago (2009-09-09 01:59:34 UTC) #1
Evan Martin
I can't review this properly. I think Brett or Jim are our best hopes.
11 years, 3 months ago (2009-09-09 22:24:49 UTC) #2
brettw
The change in time is OK, but the call to it and the ceil call ...
11 years, 3 months ago (2009-09-09 23:03:54 UTC) #3
jar (doing other things)
LGTM (but see nit below) http://codereview.chromium.org/196053/diff/1/2 File webkit/glue/webkitclient_impl.cc (right): http://codereview.chromium.org/196053/diff/1/2#newcode225 Line 225: int interval = ...
11 years, 3 months ago (2009-09-09 23:55:20 UTC) #4
brettw
In case it's not obvious, be sure to let us know when you upload the ...
11 years, 3 months ago (2009-09-11 00:22:12 UTC) #5
Markus (顧孟勤)
Oh yes. I'll do that. Got side tracked today w/ a few other issues, and ...
11 years, 3 months ago (2009-09-11 02:06:57 UTC) #6
Markus (顧孟勤)
Would you mind taking another look. I think, I addressed the (minor) changes that you ...
11 years, 3 months ago (2009-09-22 00:16:38 UTC) #7
Markus (顧孟勤)
Ping? On Mon, Sep 21, 2009 at 17:16, <markus@chromium.org> wrote: > Would you mind taking ...
11 years, 3 months ago (2009-09-23 16:16:40 UTC) #8
brettw
LGTM with one style nit. http://codereview.chromium.org/196053/diff/6001/7001 File webkit/glue/webkitclient_impl.cc (right): http://codereview.chromium.org/196053/diff/6001/7001#newcode280 Line 280: base::Time::kMicrosecondsPerSecond)); We usually ...
11 years, 3 months ago (2009-09-23 16:45:16 UTC) #9
jar (doing other things)
http://codereview.chromium.org/196053/diff/6001/7005 File net/socket/client_socket_pool_base_unittest.cc (right): http://codereview.chromium.org/196053/diff/6001/7005#newcode152 Line 152: 2); style nit: align indentation of arguments. (same ...
11 years, 3 months ago (2009-09-23 17:23:38 UTC) #10
Markus (顧孟勤)
On Wed, Sep 23, 2009 at 10:23, <jar@chromium.org> wrote: > > http://codereview.chromium.org/196053/diff/6001/7005 > File net/socket/client_socket_pool_base_unittest.cc ...
11 years, 3 months ago (2009-09-23 18:12:48 UTC) #11
brettw
On Wed, Sep 23, 2009 at 11:12 AM, Markus Gutschke <markus@chromium.org> wrote: > On Wed, ...
11 years, 3 months ago (2009-09-23 18:19:29 UTC) #12
jar (doing other things)
11 years, 3 months ago (2009-09-23 20:50:52 UTC) #13
http://codereview.chromium.org/196053/diff/6001/7005
File net/socket/client_socket_pool_base_unittest.cc (right):

http://codereview.chromium.org/196053/diff/6001/7005#newcode152
Line 152: 2);
My mistake.  I mismatched the "2" because I didn't see the close paren after the
comment.  The indentation is correct.

...but...

Given that I goofed in my reading, perhaps use of a // style comment beyond the
end of the line would be more readable than the embedded /* ... */ style
comment.  The adjacent // style comments could even be aligned to avoid
interfering with the code flow.  The style guide specifically offers such an
example for describing arguments at a call site.



On 2009/09/23 17:23:38, jar wrote:
> style nit: align indentation of arguments.
> 
> (same below)

Powered by Google App Engine
This is Rietveld 408576698