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

Issue 1148383003: Only support seeking file streams from the beginning of the file. (Closed)

Created:
5 years, 7 months ago by Reilly Grant (use Gerrit)
Modified:
5 years, 6 months ago
CC:
chromium-reviews, cbentzel+watch_chromium.org, kinuko+fileapi, nhiroki, tzik, rvargas (doing something else)
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Only support seeking file streams from the beginning of the file. On Windows file streams are backed by files opened for overlapped I/O. In this mode SetFilePointerEx (used for seeking) will return a write- protected media error if the file is on write-protected media. This is even if the file is opened read-only! Since no code (except for the FileStream tests) calls Seek with anything other than File::FROM_BEGIN it is simplest to simply remove this capability. That way we can update the offset in the FileStream context's overlapped structure without going through a call to Windows. BUG=478227 Committed: https://crrev.com/aa435e70c70364430093361b5b8c460831f80bb4 Cr-Commit-Position: refs/heads/master@{#334518}

Patch Set 1 : #

Total comments: 1

Patch Set 2 : Prevent file_ from leaking out and DCHECK that async I/O is supported. #

Patch Set 3 : Allow files built from native file handles to be marked async. #

Patch Set 4 : One more instance where files need to be tagged as async. #

Total comments: 2

Patch Set 5 : Use static method instead of new constructor. #

Total comments: 1

Patch Set 6 : Add comment about ownership and "would be nice to check FLAG_OVERLAPPED". #

Total comments: 2

Patch Set 7 : Rebased. #

Total comments: 3

Patch Set 8 : Fix Win DBG build by Pass()-ing file out of CreateForAsyncHandle. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+71 lines, -133 lines) Patch
M base/files/file.h View 1 2 3 4 5 1 chunk +3 lines, -0 lines 0 comments Download
M base/files/file.cc View 1 2 3 4 5 6 7 1 chunk +9 lines, -0 lines 0 comments Download
M chrome/browser/chromeos/drive/local_file_reader.cc View 1 chunk +3 lines, -4 lines 0 comments Download
M chrome/browser/extensions/api/messaging/native_message_process_host_unittest.cc View 1 2 3 4 1 chunk +2 lines, -2 lines 0 comments Download
M chrome/browser/extensions/api/messaging/native_process_launcher_win.cc View 1 2 3 4 1 chunk +2 lines, -2 lines 0 comments Download
M content/browser/android/url_request_content_job.cc View 1 chunk +1 line, -2 lines 0 comments Download
M net/base/file_stream.h View 1 2 3 4 5 6 2 chunks +7 lines, -12 lines 0 comments Download
M net/base/file_stream.cc View 1 2 3 4 5 6 2 chunks +3 lines, -9 lines 0 comments Download
M net/base/file_stream_context.h View 1 2 3 4 5 6 3 chunks +5 lines, -5 lines 0 comments Download
M net/base/file_stream_context.cc View 1 2 3 4 5 6 2 chunks +8 lines, -9 lines 0 comments Download
M net/base/file_stream_context_posix.cc View 1 2 3 4 5 6 1 chunk +1 line, -2 lines 0 comments Download
M net/base/file_stream_context_win.cc View 1 2 3 4 5 6 2 chunks +4 lines, -9 lines 0 comments Download
M net/base/file_stream_unittest.cc View 1 2 3 4 5 6 13 chunks +11 lines, -57 lines 0 comments Download
M net/base/mock_file_stream.h View 1 2 3 4 5 6 1 chunk +1 line, -3 lines 0 comments Download
M net/base/mock_file_stream.cc View 1 2 3 4 5 6 1 chunk +2 lines, -3 lines 0 comments Download
M net/base/upload_file_element_reader.cc View 1 2 3 4 5 6 1 chunk +2 lines, -3 lines 0 comments Download
M net/url_request/url_request_file_job.cc View 1 2 3 4 5 6 1 chunk +1 line, -2 lines 0 comments Download
M storage/browser/fileapi/local_file_stream_reader.cc View 1 chunk +2 lines, -4 lines 0 comments Download
M storage/browser/fileapi/local_file_stream_writer.cc View 1 chunk +4 lines, -5 lines 0 comments Download

Messages

Total messages: 30 (7 generated)
Reilly Grant (use Gerrit)
davidben@, please take a look at the bulk of this change in //net and //content. ...
5 years, 7 months ago (2015-05-21 00:06:29 UTC) #3
hirono
For //chrome/browser/chromeos/drive, lgtm
5 years, 7 months ago (2015-05-21 01:40:15 UTC) #4
davidben
I'm not super-familiar with Windows. Eric, do you mind looking at this? I'll stamp content ...
5 years, 7 months ago (2015-05-21 17:22:12 UTC) #6
Reilly Grant (use Gerrit)
On 2015/05/21 17:22:12, David Benjamin wrote: > I'm not super-familiar with Windows. Eric, do you ...
5 years, 7 months ago (2015-05-21 18:36:53 UTC) #7
eroman
The description sounds reasonable. Ricardo would be the expert to review this, but he is ...
5 years, 7 months ago (2015-05-21 22:25:34 UTC) #8
Reilly Grant (use Gerrit)
Adding thestig@ for //base review. Let me know if you think there's a better way ...
5 years, 7 months ago (2015-05-22 20:53:32 UTC) #10
Lei Zhang
https://codereview.chromium.org/1148383003/diff/80001/base/files/file.h File base/files/file.h (right): https://codereview.chromium.org/1148383003/diff/80001/base/files/file.h#newcode172 base/files/file.h:172: File(PlatformFile platform_file, bool async); Calling this with |async| set ...
5 years, 7 months ago (2015-05-25 00:29:58 UTC) #11
tzik
fileapi part LGTM.
5 years, 7 months ago (2015-05-25 07:32:17 UTC) #12
Reilly Grant (use Gerrit)
https://codereview.chromium.org/1148383003/diff/80001/base/files/file.h File base/files/file.h (right): https://codereview.chromium.org/1148383003/diff/80001/base/files/file.h#newcode172 base/files/file.h:172: File(PlatformFile platform_file, bool async); On 2015/05/25 00:29:58, Lei Zhang ...
5 years, 7 months ago (2015-05-26 23:41:33 UTC) #13
Lei Zhang
base/ lgtm with comment added. https://codereview.chromium.org/1148383003/diff/100001/base/files/file.h File base/files/file.h (right): https://codereview.chromium.org/1148383003/diff/100001/base/files/file.h#newcode179 base/files/file.h:179: static File CreateForAsyncHandle(PlatformFile platform_file); ...
5 years, 7 months ago (2015-05-26 23:58:06 UTC) #14
Reilly Grant (use Gerrit)
//net folks, ping?
5 years, 6 months ago (2015-06-02 00:43:58 UTC) #15
Reilly Grant (use Gerrit)
Ping again?
5 years, 6 months ago (2015-06-08 22:23:42 UTC) #16
howard
On 2015/06/08 22:23:42, reillyg wrote: > Ping again? //net folks thanks so much for taking ...
5 years, 6 months ago (2015-06-13 00:24:11 UTC) #17
davidben
Eric is on vacation for a while. (Sorry, I didn't notice this earlier.) scottmg@, do ...
5 years, 6 months ago (2015-06-15 20:30:07 UTC) #19
scottmg
lgtm (SetFilePointerEx can extend the file, so I guess that's probably why it fails.) https://codereview.chromium.org/1148383003/diff/120001/base/files/file.cc ...
5 years, 6 months ago (2015-06-15 21:42:45 UTC) #20
Reilly Grant (use Gerrit)
https://codereview.chromium.org/1148383003/diff/120001/base/files/file.cc File base/files/file.cc (right): https://codereview.chromium.org/1148383003/diff/120001/base/files/file.cc#newcode70 base/files/file.cc:70: // with FLAG_OVERLAPPED on Windows but this doesn't appear ...
5 years, 6 months ago (2015-06-15 22:01:12 UTC) #21
davidben
content and net lgtm. Sorry about the delay!
5 years, 6 months ago (2015-06-15 22:04:19 UTC) #22
scottmg
https://codereview.chromium.org/1148383003/diff/140001/base/files/file.cc File base/files/file.cc (right): https://codereview.chromium.org/1148383003/diff/140001/base/files/file.cc#newcode70 base/files/file.cc:70: // FILE_FLAG_OVERLAPPED on Windows but this doesn't appear to ...
5 years, 6 months ago (2015-06-15 22:06:55 UTC) #23
Reilly Grant (use Gerrit)
https://codereview.chromium.org/1148383003/diff/140001/base/files/file.cc File base/files/file.cc (right): https://codereview.chromium.org/1148383003/diff/140001/base/files/file.cc#newcode70 base/files/file.cc:70: // FILE_FLAG_OVERLAPPED on Windows but this doesn't appear to ...
5 years, 6 months ago (2015-06-15 22:36:36 UTC) #24
scottmg
https://codereview.chromium.org/1148383003/diff/140001/base/files/file.cc File base/files/file.cc (right): https://codereview.chromium.org/1148383003/diff/140001/base/files/file.cc#newcode70 base/files/file.cc:70: // FILE_FLAG_OVERLAPPED on Windows but this doesn't appear to ...
5 years, 6 months ago (2015-06-15 22:42:13 UTC) #25
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1148383003/160001
5 years, 6 months ago (2015-06-16 00:12:30 UTC) #28
commit-bot: I haz the power
Committed patchset #8 (id:160001)
5 years, 6 months ago (2015-06-16 00:48:53 UTC) #29
commit-bot: I haz the power
5 years, 6 months ago (2015-06-16 00:49:53 UTC) #30
Message was sent while issue was closed.
Patchset 8 (id:??) landed as
https://crrev.com/aa435e70c70364430093361b5b8c460831f80bb4
Cr-Commit-Position: refs/heads/master@{#334518}

Powered by Google App Engine
This is Rietveld 408576698