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

Issue 6612051: In BlobURLRequestJob, open files asynchronously to avoid blocking the IO thread (Closed)

Created:
9 years, 9 months ago by adamk
Modified:
9 years, 7 months ago
Reviewers:
michaeln, jianli
CC:
chromium-reviews, pam+watch_chromium.org, darin-cc_chromium.org, Paweł Hajdan Jr., kinuko, ericu
Visibility:
Public.

Description

In BlobURLRequestJob, open files asynchronously to avoid blocking the IO thread (and tripping thread restriction asserts). The bug was found while trying to get FileWriter ui_tests to pass (see http://codereview.chromium.org/6609040/). This change also changes all callers to pass in a file_thread_proxy so the class can assume it's there and pass it to FileUtilProxy. Finally, it adds a BlobURLRequestJob test case that reads a file larger than the buffer size, to better exercise the job's behavior when ReadRawData() is called multiple times. BUG=75548 TEST=test_shell_tests,ui_tests Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=78079

Patch Set 1 #

Patch Set 2 : Properly handle multiple calls to ReadRawData and add a test for that case #

Total comments: 6

Patch Set 3 : Make const, reserve string space #

Patch Set 4 : Put const on the correct method #

Patch Set 5 : Store bytes_to_read_ in a member variable #

Total comments: 4

Patch Set 6 : Added DCHECK, merged with trunk #

Unified diffs Side-by-side diffs Delta from patch set Stats (+125 lines, -73 lines) Patch
M webkit/blob/blob_url_request_job.h View 1 2 3 4 6 chunks +14 lines, -4 lines 0 comments Download
M webkit/blob/blob_url_request_job.cc View 1 2 3 4 5 9 chunks +87 lines, -66 lines 0 comments Download
M webkit/blob/blob_url_request_job_unittest.cc View 1 2 4 chunks +23 lines, -2 lines 0 comments Download
M webkit/tools/test_shell/simple_resource_loader_bridge.cc View 1 chunk +1 line, -1 line 0 comments Download

Messages

Total messages: 10 (0 generated)
adamk
9 years, 9 months ago (2011-03-09 22:59:25 UTC) #1
adamk
Oops, there's a major bug in this, since I failed to handle the case of ...
9 years, 9 months ago (2011-03-09 23:35:54 UTC) #2
adamk
On 2011/03/09 23:35:54, Adam Klein wrote: > Oops, there's a major bug in this, since ...
9 years, 9 months ago (2011-03-10 00:44:44 UTC) #3
jianli
http://codereview.chromium.org/6612051/diff/4001/webkit/blob/blob_url_request_job.cc File webkit/blob/blob_url_request_job.cc (right): http://codereview.chromium.org/6612051/diff/4001/webkit/blob/blob_url_request_job.cc#newcode254 webkit/blob/blob_url_request_job.cc:254: int BlobURLRequestJob::ComputeBytesToRead() { Since we do not change anything ...
9 years, 9 months ago (2011-03-10 22:50:42 UTC) #4
adamk
http://codereview.chromium.org/6612051/diff/4001/webkit/blob/blob_url_request_job.cc File webkit/blob/blob_url_request_job.cc (right): http://codereview.chromium.org/6612051/diff/4001/webkit/blob/blob_url_request_job.cc#newcode254 webkit/blob/blob_url_request_job.cc:254: int BlobURLRequestJob::ComputeBytesToRead() { On 2011/03/10 22:50:42, jianli wrote: > ...
9 years, 9 months ago (2011-03-10 23:06:12 UTC) #5
jianli
On Thu, Mar 10, 2011 at 3:06 PM, <adamk@chromium.org> wrote: > > > http://codereview.chromium.org/6612051/diff/4001/webkit/blob/blob_url_request_job.cc > ...
9 years, 9 months ago (2011-03-10 23:20:26 UTC) #6
adamk
On Thu, Mar 10, 2011 at 3:19 PM, Jian Li <jianli@chromium.org> wrote: > > > ...
9 years, 9 months ago (2011-03-11 00:00:11 UTC) #7
michaeln
just a drive-by comment, jian is looking already so when it lgt_him it lgtm http://codereview.chromium.org/6612051/diff/10003/webkit/blob/blob_url_request_job.cc ...
9 years, 9 months ago (2011-03-11 06:03:47 UTC) #8
jianli
LGTM. On Thu, Mar 10, 2011 at 4:00 PM, Adam Klein <adamk@chromium.org> wrote: > On ...
9 years, 9 months ago (2011-03-11 19:18:13 UTC) #9
adamk
9 years, 9 months ago (2011-03-14 17:42:14 UTC) #10
http://codereview.chromium.org/6612051/diff/10003/webkit/blob/blob_url_reques...
File webkit/blob/blob_url_request_job.cc (right):

http://codereview.chromium.org/6612051/diff/10003/webkit/blob/blob_url_reques...
webkit/blob/blob_url_request_job.cc:116: void
BlobURLRequestJob::ResolveFile(const FilePath& file_path) {
On 2011/03/11 06:03:47, michaeln wrote:
> nit: maybe DCHECK(file_thread_proxy_)

Added that DCHECK to the constructor (that'll make it useful, as it will
actually include the errant caller in the stack trace).

http://codereview.chromium.org/6612051/diff/10003/webkit/blob/blob_url_reques...
webkit/blob/blob_url_request_job.cc:369: DidRead(rv);
On 2011/03/11 06:03:47, michaeln wrote:
> ah... is this what your new large test is about... if this also fixes a bug
with
> reading large blobs maybe mention that in the CL description too.

Added something to the CL description.  There wasn't a bug in the original code,
but my initial version of this change _did_ have a bug.  The test is a good idea
to leave in the CL nonetheless (unless you think I should split it into another
change).

Powered by Google App Engine
This is Rietveld 408576698