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

Side by Side Diff: net/url_request/url_request_job.cc

Issue 2829833002: Remove buffer size sanity check from URLRequestJob::Read (Closed)
Patch Set: Created 3 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "net/url_request/url_request_job.h" 5 #include "net/url_request/url_request_job.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/callback_helpers.h" 10 #include "base/callback_helpers.h"
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 // TODO(mmenke): The URLRequest is currently deleted before this method 193 // TODO(mmenke): The URLRequest is currently deleted before this method
194 // invokes its async callback whenever this is called by the URLRequest. 194 // invokes its async callback whenever this is called by the URLRequest.
195 // Try to simplify how cancellation works. 195 // Try to simplify how cancellation works.
196 NotifyCanceled(); 196 NotifyCanceled();
197 } 197 }
198 198
199 // This method passes reads down the filter chain, where they eventually end up 199 // This method passes reads down the filter chain, where they eventually end up
200 // at URLRequestJobSourceStream::Read, which calls back into 200 // at URLRequestJobSourceStream::Read, which calls back into
201 // URLRequestJob::ReadRawData. 201 // URLRequestJob::ReadRawData.
202 int URLRequestJob::Read(IOBuffer* buf, int buf_size) { 202 int URLRequestJob::Read(IOBuffer* buf, int buf_size) {
203 DCHECK_LT(buf_size, 1000000); // Sanity check.
204 DCHECK(buf); 203 DCHECK(buf);
205 204
206 pending_read_buffer_ = buf; 205 pending_read_buffer_ = buf;
207 int result = source_stream_->Read( 206 int result = source_stream_->Read(
208 buf, buf_size, base::Bind(&URLRequestJob::SourceStreamReadComplete, 207 buf, buf_size, base::Bind(&URLRequestJob::SourceStreamReadComplete,
209 weak_factory_.GetWeakPtr(), false)); 208 weak_factory_.GetWeakPtr(), false));
210 if (result == ERR_IO_PENDING) 209 if (result == ERR_IO_PENDING)
211 return ERR_IO_PENDING; 210 return ERR_IO_PENDING;
212 211
213 SourceStreamReadComplete(true, result); 212 SourceStreamReadComplete(true, result);
(...skipping 639 matching lines...) Expand 10 before | Expand all | Expand 10 after
853 int64_t total_sent_bytes = GetTotalSentBytes(); 852 int64_t total_sent_bytes = GetTotalSentBytes();
854 DCHECK_GE(total_sent_bytes, last_notified_total_sent_bytes_); 853 DCHECK_GE(total_sent_bytes, last_notified_total_sent_bytes_);
855 if (total_sent_bytes > last_notified_total_sent_bytes_) { 854 if (total_sent_bytes > last_notified_total_sent_bytes_) {
856 network_delegate_->NotifyNetworkBytesSent( 855 network_delegate_->NotifyNetworkBytesSent(
857 request_, total_sent_bytes - last_notified_total_sent_bytes_); 856 request_, total_sent_bytes - last_notified_total_sent_bytes_);
858 } 857 }
859 last_notified_total_sent_bytes_ = total_sent_bytes; 858 last_notified_total_sent_bytes_ = total_sent_bytes;
860 } 859 }
861 860
862 } // namespace net 861 } // namespace net
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698