Commit dbfab928 authored by Charlie Harrison's avatar Charlie Harrison Committed by Commit Bot

Remove deprecated URLRequest::Read

The last caller, URLLoader, can be changed simply to the new API.

Bug: 423484
Change-Id: Idd0233b098aeb78bc246580fca542e5f542b12a3
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1893431
Commit-Queue: Charlie Harrison <csharrison@chromium.org>
Reviewed-by: default avatarMatt Menke <mmenke@chromium.org>
Cr-Commit-Position: refs/heads/master@{#711327}
parent f3c2f1da
......@@ -764,23 +764,6 @@ int URLRequest::Read(IOBuffer* dest, int dest_size) {
return rv;
}
// Deprecated.
bool URLRequest::Read(IOBuffer* dest, int dest_size, int* bytes_read) {
int result = Read(dest, dest_size);
if (result >= 0) {
*bytes_read = result;
return true;
}
if (result == ERR_IO_PENDING) {
*bytes_read = 0;
} else {
*bytes_read = -1;
}
return false;
}
void URLRequest::NotifyReceivedRedirect(const RedirectInfo& redirect_info,
bool* defer_redirect) {
is_redirecting_ = true;
......
......@@ -153,12 +153,9 @@ class NET_EXPORT URLRequest : public base::SupportsUserData {
// Read() initiated by delegate
// - OnReadCompleted* (zero or more calls until all data is read)
//
// Read() must be called at least once. Read() returns true when it completed
// immediately, and false if an IO is pending or if there is an error. When
// Read() returns false, the caller can check the Request's status() to see
// if an error occurred, or if the IO is just pending. When Read() returns
// true with zero bytes read, it indicates the end of the response.
//
// Read() must be called at least once. Read() returns bytes read when it
// completes immediately, and a negative error value if an IO is pending or if
// there is an error.
class NET_EXPORT Delegate {
public:
// Called upon receiving a redirect. The delegate may call the request's
......@@ -617,9 +614,6 @@ class NET_EXPORT URLRequest : public base::SupportsUserData {
//
// The |max_bytes| parameter is the maximum number of bytes to read.
int Read(IOBuffer* buf, int max_bytes);
// Deprecated.
// TODO(maksims): Remove this.
bool Read(IOBuffer* buf, int max_bytes, int* bytes_read);
// This method may be called to follow a redirect that was deferred in
// response to an OnReceivedRedirect call. If non-null,
......
......@@ -1067,14 +1067,10 @@ void URLLoader::ReadMore() {
auto buf = base::MakeRefCounted<NetToMojoIOBuffer>(
pending_write_.get(), pending_write_buffer_offset_);
int bytes_read;
url_request_->Read(buf.get(),
static_cast<int>(pending_write_buffer_size_ -
pending_write_buffer_offset_),
&bytes_read);
if (url_request_->status().is_io_pending()) {
// Wait for OnReadCompleted.
} else {
int bytes_read = url_request_->Read(
buf.get(), static_cast<int>(pending_write_buffer_size_ -
pending_write_buffer_offset_));
if (bytes_read != net::ERR_IO_PENDING) {
DidRead(bytes_read, true);
// |this| may have been deleted.
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment