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

Unified Diff: net/spdy/spdy_http_stream.cc

Issue 11275088: Remove implicit scoped_refptr operator T* Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 8 years, 2 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 | « net/socket/tcp_server_socket_unittest.cc ('k') | net/spdy/spdy_http_stream_spdy2_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/spdy/spdy_http_stream.cc
diff --git a/net/spdy/spdy_http_stream.cc b/net/spdy/spdy_http_stream.cc
index cfbadd15c2343065e300b95daf950fedd8d758e3..ce0b85e8b798fb33820f65cd83476acbb6d23e4c 100644
--- a/net/spdy/spdy_http_stream.cc
+++ b/net/spdy/spdy_http_stream.cc
@@ -50,7 +50,7 @@ void SpdyHttpStream::InitializeWithExistingStream(SpdyStream* spdy_stream) {
}
SpdyHttpStream::~SpdyHttpStream() {
- if (stream_)
+ if (stream_.get())
stream_->DetachDelegate();
}
@@ -142,7 +142,7 @@ int SpdyHttpStream::ReadResponseBody(
}
CHECK(callback_.is_null());
- CHECK(!user_buffer_);
+ CHECK(!user_buffer_.get());
CHECK_EQ(0, user_buffer_len_);
callback_ = callback;
@@ -162,7 +162,7 @@ HttpStream* SpdyHttpStream::RenewStreamForAuth() {
}
bool SpdyHttpStream::IsResponseBodyComplete() const {
- if (!stream_)
+ if (!stream_.get())
return false;
return stream_->closed();
}
@@ -221,7 +221,7 @@ int SpdyHttpStream::SendRequest(const HttpRequestHeaders& request_headers,
// body data is written with this size at a time.
raw_request_body_buf_ = new IOBufferWithSize(kMaxSpdyFrameChunkSize);
// The request body buffer is empty at first.
- request_body_buf_ = new DrainableIOBuffer(raw_request_body_buf_, 0);
+ request_body_buf_ = new DrainableIOBuffer(raw_request_body_buf_.get(), 0);
}
}
@@ -268,10 +268,10 @@ int SpdyHttpStream::SendRequest(const HttpRequestHeaders& request_headers,
}
void SpdyHttpStream::Cancel() {
- if (spdy_session_)
+ if (spdy_session_.get())
spdy_session_->CancelPendingCreateStreams(&stream_);
callback_.Reset();
- if (stream_)
+ if (stream_.get())
stream_->Cancel();
}
@@ -281,7 +281,7 @@ int SpdyHttpStream::SendData() {
// Read the data from the request body stream.
const int bytes_read = request_body_stream_->Read(
- raw_request_body_buf_, raw_request_body_buf_->size(),
+ raw_request_body_buf_.get(), raw_request_body_buf_->size(),
base::Bind(
base::IgnoreResult(&SpdyHttpStream::OnRequestBodyReadCompleted),
weak_factory_.GetWeakPtr()));
@@ -304,7 +304,7 @@ int SpdyHttpStream::OnSendBody() {
const bool eof = request_body_stream_->IsEOF();
if (request_body_buf_->BytesRemaining() > 0) {
return stream_->WriteStreamData(
- request_body_buf_,
+ request_body_buf_.get(),
request_body_buf_->BytesRemaining(),
eof ? DATA_FLAG_FIN : DATA_FLAG_NONE);
}
@@ -371,7 +371,8 @@ int SpdyHttpStream::OnResponseReceived(const SpdyHeaderBlock& response,
response_info_->npn_negotiated_protocol =
SSLClientSocket::NextProtoToString(protocol_negotiated);
response_info_->request_time = stream_->GetRequestTime();
- response_info_->vary_data.Init(*request_info_, *response_info_->headers);
+ response_info_->
+ vary_data.Init(*request_info_, *response_info_->headers.get());
// TODO(ahendrickson): This is recorded after the entire SYN_STREAM control
// frame has been received and processed. Move to framer?
response_info_->response_time = response_time;
@@ -404,7 +405,7 @@ int SpdyHttpStream::OnDataReceived(const char* data, int length) {
memcpy(io_buffer->data(), data, length);
response_body_.push_back(make_scoped_refptr(io_buffer));
- if (user_buffer_) {
+ if (user_buffer_.get()) {
// Handing small chunks of data to the caller creates measurable overhead.
// We buffer data in short time-spans and send a single read notification.
ScheduleBufferedReadCallback();
@@ -470,7 +471,9 @@ bool SpdyHttpStream::DoBufferedReadCallback() {
// If the transaction is cancelled or errored out, we don't need to complete
// the read.
- if (!stream_ || stream_->response_status() != OK || stream_->cancelled())
+ if (
+ !stream_.get() || stream_->response_status() != OK || stream_->
+ cancelled())
return false;
// When more_read_data_pending_ is true, it means that more data has
@@ -482,8 +485,8 @@ bool SpdyHttpStream::DoBufferedReadCallback() {
}
int rv = 0;
- if (user_buffer_) {
- rv = ReadResponseBody(user_buffer_, user_buffer_len_, callback_);
+ if (user_buffer_.get()) {
+ rv = ReadResponseBody(user_buffer_.get(), user_buffer_len_, callback_);
CHECK_NE(rv, ERR_IO_PENDING);
user_buffer_ = NULL;
user_buffer_len_ = 0;
@@ -506,10 +509,11 @@ void SpdyHttpStream::DoCallback(int rv) {
int SpdyHttpStream::OnRequestBodyReadCompleted(int status) {
DCHECK_GE(status, 0);
- request_body_buf_ = new DrainableIOBuffer(raw_request_body_buf_, status);
+ request_body_buf_ =
+ new DrainableIOBuffer(raw_request_body_buf_.get(), status);
const bool eof = request_body_stream_->IsEOF();
- return stream_->WriteStreamData(request_body_buf_,
+ return stream_->WriteStreamData(request_body_buf_.get(),
request_body_buf_->BytesRemaining(),
eof ? DATA_FLAG_FIN : DATA_FLAG_NONE);
}
« no previous file with comments | « net/socket/tcp_server_socket_unittest.cc ('k') | net/spdy/spdy_http_stream_spdy2_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698