| OLD | NEW |
| 1 // Copyright (c) 2016 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2016 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/quic/quartc/quartc_stream.h" | 5 #include "net/quic/quartc/quartc_stream.h" |
| 6 #include "net/quic/platform/api/quic_string_piece.h" |
| 6 | 7 |
| 7 namespace net { | 8 namespace net { |
| 8 | 9 |
| 9 QuartcStream::QuartcStream(QuicStreamId id, QuicSession* session) | 10 QuartcStream::QuartcStream(QuicStreamId id, QuicSession* session) |
| 10 : QuicStream(id, session) {} | 11 : QuicStream(id, session) {} |
| 11 QuartcStream::~QuartcStream() {} | 12 QuartcStream::~QuartcStream() {} |
| 12 | 13 |
| 13 void QuartcStream::OnDataAvailable() { | 14 void QuartcStream::OnDataAvailable() { |
| 14 struct iovec iov; | 15 struct iovec iov; |
| 15 while (sequencer()->GetReadableRegions(&iov, 1) == 1) { | 16 while (sequencer()->GetReadableRegions(&iov, 1) == 1) { |
| (...skipping 30 matching lines...) Expand all Loading... |
| 46 return queued_data_bytes(); | 47 return queued_data_bytes(); |
| 47 } | 48 } |
| 48 | 49 |
| 49 bool QuartcStream::fin_sent() { | 50 bool QuartcStream::fin_sent() { |
| 50 return QuicStream::fin_sent(); | 51 return QuicStream::fin_sent(); |
| 51 } | 52 } |
| 52 | 53 |
| 53 void QuartcStream::Write(const char* data, | 54 void QuartcStream::Write(const char* data, |
| 54 size_t size, | 55 size_t size, |
| 55 const WriteParameters& param) { | 56 const WriteParameters& param) { |
| 56 WriteOrBufferData(base::StringPiece(data, size), param.fin, nullptr); | 57 WriteOrBufferData(QuicStringPiece(data, size), param.fin, nullptr); |
| 57 } | 58 } |
| 58 | 59 |
| 59 void QuartcStream::Close() { | 60 void QuartcStream::Close() { |
| 60 QuicStream::session()->CloseStream(id()); | 61 QuicStream::session()->CloseStream(id()); |
| 61 } | 62 } |
| 62 | 63 |
| 63 void QuartcStream::SetDelegate(QuartcStreamInterface::Delegate* delegate) { | 64 void QuartcStream::SetDelegate(QuartcStreamInterface::Delegate* delegate) { |
| 64 if (delegate_) { | 65 if (delegate_) { |
| 65 LOG(WARNING) << "The delegate for Stream " << id() | 66 LOG(WARNING) << "The delegate for Stream " << id() |
| 66 << " has already been set."; | 67 << " has already been set."; |
| 67 } | 68 } |
| 68 delegate_ = delegate; | 69 delegate_ = delegate; |
| 69 DCHECK(delegate_); | 70 DCHECK(delegate_); |
| 70 } | 71 } |
| 71 | 72 |
| 72 } // namespace net | 73 } // namespace net |
| OLD | NEW |