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

Side by Side Diff: net/spdy/spdy_http_stream.cc

Issue 4291001: Convert implicit scoped_refptr constructor calls to explicit ones, part 2 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/build
Patch Set: comments Created 10 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « net/socket_stream/socket_stream.cc ('k') | net/spdy/spdy_network_transaction_unittest.cc » ('j') | 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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/spdy/spdy_http_stream.h" 5 #include "net/spdy/spdy_http_stream.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <list> 8 #include <list>
9 #include <string> 9 #include <string>
10 10
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 memcpy(&(buf->data()[bytes_read]), data->data(), bytes_to_copy); 106 memcpy(&(buf->data()[bytes_read]), data->data(), bytes_to_copy);
107 buf_len -= bytes_to_copy; 107 buf_len -= bytes_to_copy;
108 if (bytes_to_copy == data->size()) { 108 if (bytes_to_copy == data->size()) {
109 response_body_.pop_front(); 109 response_body_.pop_front();
110 } else { 110 } else {
111 const int bytes_remaining = data->size() - bytes_to_copy; 111 const int bytes_remaining = data->size() - bytes_to_copy;
112 IOBufferWithSize* new_buffer = new IOBufferWithSize(bytes_remaining); 112 IOBufferWithSize* new_buffer = new IOBufferWithSize(bytes_remaining);
113 memcpy(new_buffer->data(), &(data->data()[bytes_to_copy]), 113 memcpy(new_buffer->data(), &(data->data()[bytes_to_copy]),
114 bytes_remaining); 114 bytes_remaining);
115 response_body_.pop_front(); 115 response_body_.pop_front();
116 response_body_.push_front(new_buffer); 116 response_body_.push_front(make_scoped_refptr(new_buffer));
117 } 117 }
118 bytes_read += bytes_to_copy; 118 bytes_read += bytes_to_copy;
119 } 119 }
120 if (spdy_session_->flow_control()) 120 if (spdy_session_->flow_control())
121 stream_->IncreaseRecvWindowSize(bytes_read); 121 stream_->IncreaseRecvWindowSize(bytes_read);
122 return bytes_read; 122 return bytes_read;
123 } else if (stream_->closed()) { 123 } else if (stream_->closed()) {
124 return stream_->response_status(); 124 return stream_->response_status();
125 } 125 }
126 126
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
266 266
267 void SpdyHttpStream::OnDataReceived(const char* data, int length) { 267 void SpdyHttpStream::OnDataReceived(const char* data, int length) {
268 // Note that data may be received for a SpdyStream prior to the user calling 268 // Note that data may be received for a SpdyStream prior to the user calling
269 // ReadResponseBody(), therefore user_buffer_ may be NULL. This may often 269 // ReadResponseBody(), therefore user_buffer_ may be NULL. This may often
270 // happen for server initiated streams. 270 // happen for server initiated streams.
271 DCHECK(!stream_->closed() || stream_->pushed()); 271 DCHECK(!stream_->closed() || stream_->pushed());
272 if (length > 0) { 272 if (length > 0) {
273 // Save the received data. 273 // Save the received data.
274 IOBufferWithSize* io_buffer = new IOBufferWithSize(length); 274 IOBufferWithSize* io_buffer = new IOBufferWithSize(length);
275 memcpy(io_buffer->data(), data, length); 275 memcpy(io_buffer->data(), data, length);
276 response_body_.push_back(io_buffer); 276 response_body_.push_back(make_scoped_refptr(io_buffer));
277 277
278 if (user_buffer_) { 278 if (user_buffer_) {
279 // Handing small chunks of data to the caller creates measurable overhead. 279 // Handing small chunks of data to the caller creates measurable overhead.
280 // We buffer data in short time-spans and send a single read notification. 280 // We buffer data in short time-spans and send a single read notification.
281 ScheduleBufferedReadCallback(); 281 ScheduleBufferedReadCallback();
282 } 282 }
283 } 283 }
284 } 284 }
285 285
286 void SpdyHttpStream::OnDataSent(int length) { 286 void SpdyHttpStream::OnDataSent(int length) {
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
377 stream_->GetSSLInfo(ssl_info, &using_npn); 377 stream_->GetSSLInfo(ssl_info, &using_npn);
378 } 378 }
379 379
380 void SpdyHttpStream::GetSSLCertRequestInfo( 380 void SpdyHttpStream::GetSSLCertRequestInfo(
381 SSLCertRequestInfo* cert_request_info) { 381 SSLCertRequestInfo* cert_request_info) {
382 DCHECK(stream_); 382 DCHECK(stream_);
383 stream_->GetSSLCertRequestInfo(cert_request_info); 383 stream_->GetSSLCertRequestInfo(cert_request_info);
384 } 384 }
385 385
386 } // namespace net 386 } // namespace net
OLDNEW
« no previous file with comments | « net/socket_stream/socket_stream.cc ('k') | net/spdy/spdy_network_transaction_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698