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

Unified Diff: net/spdy/chromium/bidirectional_stream_spdy_impl.cc

Issue 2915053003: Remove unused BidirectionalStream::SendData() method and implementations. (Closed)
Patch Set: Fix Created 3 years, 7 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
Index: net/spdy/chromium/bidirectional_stream_spdy_impl.cc
diff --git a/net/spdy/chromium/bidirectional_stream_spdy_impl.cc b/net/spdy/chromium/bidirectional_stream_spdy_impl.cc
index dbef1f0c8c8c13b625c2fddc09af66eb035e9fd2..fa223bb487fd7587ec3911cbda73c6ffc2996d23 100644
--- a/net/spdy/chromium/bidirectional_stream_spdy_impl.cc
+++ b/net/spdy/chromium/bidirectional_stream_spdy_impl.cc
@@ -110,30 +110,6 @@ int BidirectionalStreamSpdyImpl::ReadData(IOBuffer* buf, int buf_len) {
return ERR_IO_PENDING;
}
-void BidirectionalStreamSpdyImpl::SendData(const scoped_refptr<IOBuffer>& data,
- int length,
- bool end_stream) {
- DCHECK(length > 0 || (length == 0 && end_stream));
- DCHECK(!write_pending_);
-
- if (written_end_of_stream_) {
- LOG(ERROR) << "Writing after end of stream is written.";
- base::ThreadTaskRunnerHandle::Get()->PostTask(
- FROM_HERE, base::Bind(&BidirectionalStreamSpdyImpl::NotifyError,
- weak_factory_.GetWeakPtr(), ERR_UNEXPECTED));
- return;
- }
-
- write_pending_ = true;
- written_end_of_stream_ = end_stream;
- if (MaybeHandleStreamClosedInSendData())
- return;
-
- DCHECK(!stream_closed_);
- stream_->SendData(data.get(), length,
- end_stream ? NO_MORE_DATA_TO_SEND : MORE_DATA_TO_SEND);
-}
-
void BidirectionalStreamSpdyImpl::SendvData(
const std::vector<scoped_refptr<IOBuffer>>& buffers,
const std::vector<int>& lengths,
@@ -160,13 +136,17 @@ void BidirectionalStreamSpdyImpl::SendvData(
total_len += len;
}
- pending_combined_buffer_ = new net::IOBuffer(total_len);
- int len = 0;
- // TODO(xunjieli): Get rid of extra copy. Coalesce headers and data frames.
- for (size_t i = 0; i < buffers.size(); ++i) {
- memcpy(pending_combined_buffer_->data() + len, buffers[i]->data(),
- lengths[i]);
- len += lengths[i];
+ if (buffers.size() == 1) {
+ pending_combined_buffer_ = buffers[0];
+ } else {
+ pending_combined_buffer_ = new net::IOBuffer(total_len);
+ int len = 0;
+ // TODO(xunjieli): Get rid of extra copy. Coalesce headers and data frames.
+ for (size_t i = 0; i < buffers.size(); ++i) {
+ memcpy(pending_combined_buffer_->data() + len, buffers[i]->data(),
+ lengths[i]);
+ len += lengths[i];
+ }
}
stream_->SendData(pending_combined_buffer_.get(), total_len,
end_stream ? NO_MORE_DATA_TO_SEND : MORE_DATA_TO_SEND);
« no previous file with comments | « net/spdy/chromium/bidirectional_stream_spdy_impl.h ('k') | net/spdy/chromium/bidirectional_stream_spdy_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698