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

Unified Diff: storage/browser/fileapi/file_system_dir_url_request_job.cc

Issue 1459333002: Revert "Reland: URLRequestJob: change ReadRawData contract" (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 1 month 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
Index: storage/browser/fileapi/file_system_dir_url_request_job.cc
diff --git a/storage/browser/fileapi/file_system_dir_url_request_job.cc b/storage/browser/fileapi/file_system_dir_url_request_job.cc
index c053773526b530ccbb08dbe257b6e28612b08a11..fc91f3bc63f2034cc4b48ae3957441589c01f13a 100644
--- a/storage/browser/fileapi/file_system_dir_url_request_job.cc
+++ b/storage/browser/fileapi/file_system_dir_url_request_job.cc
@@ -14,6 +14,7 @@
#include "base/time/time.h"
#include "build/build_config.h"
#include "net/base/io_buffer.h"
+#include "net/base/net_errors.h"
#include "net/base/net_util.h"
#include "net/url_request/url_request.h"
#include "storage/browser/fileapi/file_system_context.h"
@@ -43,14 +44,16 @@ FileSystemDirURLRequestJob::FileSystemDirURLRequestJob(
FileSystemDirURLRequestJob::~FileSystemDirURLRequestJob() {
}
-int FileSystemDirURLRequestJob::ReadRawData(net::IOBuffer* dest,
- int dest_size) {
- int count = std::min(dest_size, base::checked_cast<int>(data_.size()));
+bool FileSystemDirURLRequestJob::ReadRawData(net::IOBuffer* dest,
+ int dest_size,
+ int* bytes_read) {
+ int count = std::min(dest_size, static_cast<int>(data_.size()));
if (count > 0) {
memcpy(dest->data(), data_.data(), count);
data_.erase(0, count);
}
- return count;
+ *bytes_read = count;
+ return true;
}
void FileSystemDirURLRequestJob::Start() {
@@ -96,7 +99,8 @@ void FileSystemDirURLRequestJob::StartAsync() {
false);
return;
}
- NotifyStartError(URLRequestStatus::FromError(net::ERR_FILE_NOT_FOUND));
+ NotifyDone(
+ URLRequestStatus(URLRequestStatus::FAILED, net::ERR_FILE_NOT_FOUND));
return;
}
file_system_context_->operation_runner()->ReadDirectory(
@@ -109,7 +113,8 @@ void FileSystemDirURLRequestJob::DidAttemptAutoMount(base::File::Error result) {
file_system_context_->CrackURL(request_->url()).is_valid()) {
StartAsync();
} else {
- NotifyStartError(URLRequestStatus::FromError(net::ERR_FILE_NOT_FOUND));
+ NotifyDone(
+ URLRequestStatus(URLRequestStatus::FAILED, net::ERR_FILE_NOT_FOUND));
}
}
@@ -121,7 +126,7 @@ void FileSystemDirURLRequestJob::DidReadDirectory(
int rv = net::ERR_FILE_NOT_FOUND;
if (result == base::File::FILE_ERROR_INVALID_URL)
rv = net::ERR_INVALID_URL;
- NotifyStartError(URLRequestStatus::FromError(rv));
+ NotifyDone(URLRequestStatus(URLRequestStatus::FAILED, rv));
return;
}
@@ -170,7 +175,7 @@ void FileSystemDirURLRequestJob::DidGetMetadata(
int rv = net::ERR_FILE_NOT_FOUND;
if (result == base::File::FILE_ERROR_INVALID_URL)
rv = net::ERR_INVALID_URL;
- NotifyStartError(URLRequestStatus(URLRequestStatus::FAILED, rv));
+ NotifyDone(URLRequestStatus(URLRequestStatus::FAILED, rv));
}
if (!request_)
« no previous file with comments | « storage/browser/fileapi/file_system_dir_url_request_job.h ('k') | storage/browser/fileapi/file_system_url_request_job.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698