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

Unified Diff: webkit/blob/blob_url_request_job.cc

Issue 10080001: Reland 132134 with memory fix - Use LocalFileReader in FileSystemURLRequestJob (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Read return value fix Created 8 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | webkit/blob/local_file_reader.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webkit/blob/blob_url_request_job.cc
diff --git a/webkit/blob/blob_url_request_job.cc b/webkit/blob/blob_url_request_job.cc
index 79db435c548e6df954305bf500bf2535dd5a5729..49f9b04c19876e8c13671a038f732e06ca89ddba 100644
--- a/webkit/blob/blob_url_request_job.cc
+++ b/webkit/blob/blob_url_request_job.cc
@@ -43,10 +43,6 @@ const char kHTTPRequestedRangeNotSatisfiableText[] =
"Requested Range Not Satisfiable";
const char kHTTPInternalErrorText[] = "Internal Server Error";
-const int kFileOpenFlags = base::PLATFORM_FILE_OPEN |
- base::PLATFORM_FILE_READ |
- base::PLATFORM_FILE_ASYNC;
-
} // namespace
BlobURLRequestJob::BlobURLRequestJob(
@@ -361,12 +357,18 @@ bool BlobURLRequestJob::ReadFileItem(LocalFileReader* reader,
read_buf_, bytes_to_read,
base::Bind(&BlobURLRequestJob::DidReadFile,
base::Unretained(this)));
- if (result != net::ERR_IO_PENDING) {
- DCHECK(result != net::OK);
- NotifyFailure(result);
- return false;
+ if (result >= 0) {
+ // Data is immediately available.
+ if (GetStatus().is_io_pending())
+ DidReadFile(result);
+ else
+ AdvanceBytesRead(result);
+ return true;
}
- SetStatus(net::URLRequestStatus(net::URLRequestStatus::IO_PENDING, 0));
+ if (result == net::ERR_IO_PENDING)
+ SetStatus(net::URLRequestStatus(net::URLRequestStatus::IO_PENDING, 0));
+ else
+ NotifyFailure(result);
return false;
}
« no previous file with comments | « no previous file | webkit/blob/local_file_reader.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698