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

Issue 7745008: Base: WritePlatformFile now retries the operation if (Closed)

Created:
9 years, 4 months ago by rvargas (doing something else)
Modified:
9 years, 3 months ago
CC:
chromium-reviews, Paweł Hajdan Jr., brettw-cc_chromium.org
Visibility:
Public.

Description

Base: WritePlatformFile now retries the operation if the OS writes less than expected (for POSIX). BUG=94161 TEST=none Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=98497

Patch Set 1 #

Total comments: 6

Patch Set 2 : '' #

Total comments: 2

Patch Set 3 : '' #

Unified diffs Side-by-side diffs Delta from patch set Stats (+16 lines, -20 lines) Patch
M base/platform_file.h View 1 2 1 chunk +2 lines, -1 line 0 comments Download
M base/platform_file_posix.cc View 1 2 1 chunk +13 lines, -2 lines 0 comments Download
M base/platform_file_unittest.cc View 1 chunk +1 line, -17 lines 0 comments Download

Messages

Total messages: 16 (0 generated)
rvargas (doing something else)
9 years, 4 months ago (2011-08-25 18:51:15 UTC) #1
Scott Hess - ex-Googler
LGTM, minor nit on return value. http://codereview.chromium.org/7745008/diff/1/base/platform_file_posix.cc File base/platform_file_posix.cc (right): http://codereview.chromium.org/7745008/diff/1/base/platform_file_posix.cc#newcode173 base/platform_file_posix.cc:173: return bytes_written ? ...
9 years, 4 months ago (2011-08-25 21:05:23 UTC) #2
rvargas (doing something else)
Thanks http://codereview.chromium.org/7745008/diff/1/base/platform_file_posix.cc File base/platform_file_posix.cc (right): http://codereview.chromium.org/7745008/diff/1/base/platform_file_posix.cc#newcode173 base/platform_file_posix.cc:173: return bytes_written ? bytes_written : (size ? rv ...
9 years, 4 months ago (2011-08-25 21:28:06 UTC) #3
rvargas (doing something else)
+Darin, for owner review.
9 years, 4 months ago (2011-08-25 21:32:19 UTC) #4
Scott Hess - ex-Googler
http://codereview.chromium.org/7745008/diff/1/base/platform_file_posix.cc File base/platform_file_posix.cc (right): http://codereview.chromium.org/7745008/diff/1/base/platform_file_posix.cc#newcode173 base/platform_file_posix.cc:173: return bytes_written ? bytes_written : (size ? rv : ...
9 years, 4 months ago (2011-08-25 21:33:01 UTC) #5
rvargas (doing something else)
http://codereview.chromium.org/7745008/diff/1/base/platform_file_posix.cc File base/platform_file_posix.cc (right): http://codereview.chromium.org/7745008/diff/1/base/platform_file_posix.cc#newcode173 base/platform_file_posix.cc:173: return bytes_written ? bytes_written : (size ? rv : ...
9 years, 4 months ago (2011-08-25 21:37:50 UTC) #6
rvargas (doing something else)
New version up.
9 years, 4 months ago (2011-08-25 22:59:54 UTC) #7
Scott Hess - ex-Googler
Definitely! LGTM. BTW, did you manually test the short-write case at all? Maybe something like: ...
9 years, 4 months ago (2011-08-25 23:09:09 UTC) #8
Scott Hess - ex-Googler
On 2011/08/25 23:09:09, shess wrote: > BTW, did you manually test the short-write case at ...
9 years, 4 months ago (2011-08-25 23:10:14 UTC) #9
darin (slow to review)
http://codereview.chromium.org/7745008/diff/10001/base/platform_file.h File base/platform_file.h (right): http://codereview.chromium.org/7745008/diff/10001/base/platform_file.h#newcode126 base/platform_file.h:126: // on error. Note that this function automatically retries ...
9 years, 4 months ago (2011-08-25 23:54:24 UTC) #10
rvargas (doing something else)
http://codereview.chromium.org/7745008/diff/10001/base/platform_file.h File base/platform_file.h (right): http://codereview.chromium.org/7745008/diff/10001/base/platform_file.h#newcode126 base/platform_file.h:126: // on error. Note that this function automatically retries ...
9 years, 4 months ago (2011-08-26 00:09:36 UTC) #11
darin (slow to review)
On Thu, Aug 25, 2011 at 5:09 PM, <rvargas@chromium.org> wrote: > > http://codereview.chromium.**org/7745008/diff/10001/base/**platform_file.h<http://codereview.chromium.org/7745008/diff/10001/base/platform_file.h> > File ...
9 years, 4 months ago (2011-08-26 05:59:46 UTC) #12
rvargas (doing something else)
On 2011/08/26 05:59:46, darin wrote: > On Thu, Aug 25, 2011 at 5:09 PM, <mailto:rvargas@chromium.org> ...
9 years, 3 months ago (2011-08-26 21:07:00 UTC) #13
darin (slow to review)
On Fri, Aug 26, 2011 at 2:07 PM, <rvargas@chromium.org> wrote: > On 2011/08/26 05:59:46, darin ...
9 years, 3 months ago (2011-08-26 21:25:29 UTC) #14
rvargas (doing something else)
LGTY ? :) On 2011/08/26 21:25:29, darin wrote: > On Fri, Aug 26, 2011 at ...
9 years, 3 months ago (2011-08-26 21:26:57 UTC) #15
darin (slow to review)
9 years, 3 months ago (2011-08-26 21:27:34 UTC) #16
Yes, sorry... LGTM :)

On Fri, Aug 26, 2011 at 2:26 PM, <rvargas@chromium.org> wrote:

> LGTY ? :)
>
> On 2011/08/26 21:25:29, darin wrote:
>
>  On Fri, Aug 26, 2011 at 2:07 PM, <mailto:rvargas@chromium.org> wrote:
>>
>
>  > On 2011/08/26 05:59:46, darin wrote:
>> >
>> >> On Thu, Aug 25, 2011 at 5:09 PM, <mailto:rvargas@chromium.org> wrote:
>> >>
>> >
>> >  >
>> >> >
>> >>
>> >
>> > http://codereview.chromium.******org/7745008/diff/10001/base/******
>> >
platform_file.h%3Chttp://**coder**eview.chromium.org/**7745008/**<http://eview.chromium.org/7745008/**>
>> >
>>
>
> diff/10001/base/platform_file.****h<http://codereview.**
>
chromium.org/7745008/diff/**10001/base/platform_file.h<http://codereview.chromium.org/7745008/diff/10001/base/platform_file.h>
> >
>
>> > >
>> >
>> >  > File base/platform_file.h (right):
>> >> >
>> >> > http://codereview.chromium.******org/7745008/diff/10001/base/****
>> >> >
>> >>
>> >
>> >
platform_file.h#newcode126<**htt**p://codereview.chromium.**org/**<http://codereview.chromium.org/**>
>> >
>>
>
> 7745008/diff/10001/base/****platform_file.h#newcode126<htt**
> p://codereview.chromium.org/**7745008/diff/10001/base/**
>
platform_file.h#newcode126<http://codereview.chromium.org/7745008/diff/10001/base/platform_file.h#newcode126>
> >
>
>> > >
>> >
>> >  > base/platform_file.h:126: // on error. Note that this function
>> >> > automatically retries writing if it is
>> >> > On 2011/08/25 23:54:24, darin wrote:
>> >> >
>> >> >> Is this to match the behavior of Windows?  If so, does that mean
>> that
>> >> >>
>> >> > this
>> >> >
>> >> >> change is about ensuring that, on all platforms, all of the given
>> data
>> >> >>
>> >> > will be
>> >> >
>> >> >> written unless there is an error?
>> >> >>
>> >> >
>> >> > Something like that. I have another code review where I'm using
>> >> > WritePlatformFile, and this issue came afloat. I don't think it makes
>> >> > sense to ask all users of Write() to have loops to make sure that the
>> >> > operation succeeds, even if all OSes were behaving the same way
>> >> > regarding signals (actually, if all OSes were doing it, maybe that
>> would
>> >> > be the familiar thing to do, dunno).
>> >> >
>> >>
>> >
>> >  Yeah, I'm happy with this change.  Given that you want the behavior to
>> be
>> >> the same on all plaforms (i.e., to make a best effort to write all
>> given
>> >> data
>> >> before returning), I think we should just document that instead of
>> >> mentioning
>> >> the implementation detail of retrying.
>> >>
>> >
>> > Thanks.
>> >
>> > I updated the comment with: "Note that this function makes a best effort
>> to
>> > write all data on all platforms."
>>
>
>
>  Great, thanks!
>> -Darin
>>
>
>
>  >
>> >
>> >
>> >  -Darin
>> >>
>> >
>> >
>> >
>> >  >
>> >> > I was just thinking that maybe we should add something like
>> >> > ReadUntilComplete() to this file to be more symmetric. Maybe in a
>> >> > follow-up cl?
>> >> >
>> >> >
>> >> >
>> >>
>> >
>> > http://codereview.chromium.******org/7745008/%253Chttp://**coderevi**
>>
>> > ew.chromium.org/7745008/
<http://codereview.chromium.**org/7745008/<http://codereview.chromium.org/7745...
>> >>
>> >
>> >  >
>> >>
>> >
>> >
>> >
>> >
>>
>
> http://codereview.chromium.****org/7745008/%3Chttp://coderevi**
> ew.chromium.org/7745008/ <http://codereview.chromium.org/7745008/>>
>
>> >
>>
>
>
>
>
http://codereview.chromium.**org/7745008/<http://codereview.chromium.org/7745...
>

Powered by Google App Engine
This is Rietveld 408576698