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

Unified Diff: ios/net/crn_http_protocol_handler.mm

Issue 2939993002: Simplify OnReadCompleted() logic that appends bytes to the client buffer (Closed)
Patch Set: Created 3 years, 6 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ios/net/crn_http_protocol_handler.mm
diff --git a/ios/net/crn_http_protocol_handler.mm b/ios/net/crn_http_protocol_handler.mm
index bdfe452786f167bef6412d972564aba381948a2d..372042b587c36164a08c164378c3391078c96bb5 100644
--- a/ios/net/crn_http_protocol_handler.mm
+++ b/ios/net/crn_http_protocol_handler.mm
@@ -534,10 +534,7 @@ void HttpProtocolHandlerCore::OnReadCompleted(URLRequest* request,
while (bytes_read > 0 &&
[data length] + bytes_read <= kClientMaxBufferSize) {
total_bytes_read += bytes_read;
- NSUInteger data_length = [data length];
- [data increaseLengthBy:bytes_read];
- memcpy(reinterpret_cast<char*>([data mutableBytes]) + data_length,
- buffer_->data(), bytes_read);
+ [data appendBytes:buffer_->data() length:bytes_read];
bytes_read = request->Read(buffer_.get(), kIOBufferSize);
}
« 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