| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/quic_reliable_client_stream.h" | 5 #include "net/quic/quic_reliable_client_stream.h" |
| 6 | 6 |
| 7 #include "base/callback_helpers.h" | 7 #include "base/callback_helpers.h" |
| 8 #include "net/base/net_errors.h" | 8 #include "net/base/net_errors.h" |
| 9 #include "net/quic/quic_session.h" | 9 #include "net/quic/quic_session.h" |
| 10 #include "net/spdy/write_blocked_list.h" |
| 10 | 11 |
| 11 namespace net { | 12 namespace net { |
| 12 | 13 |
| 13 QuicReliableClientStream::QuicReliableClientStream(QuicStreamId id, | 14 QuicReliableClientStream::QuicReliableClientStream(QuicStreamId id, |
| 14 QuicSession* session, | 15 QuicSession* session, |
| 15 const BoundNetLog& net_log) | 16 const BoundNetLog& net_log) |
| 16 : ReliableQuicStream(id, session), | 17 : ReliableQuicStream(id, session), |
| 17 net_log_(net_log), | 18 net_log_(net_log), |
| 18 delegate_(NULL) { | 19 delegate_(NULL) { |
| 19 } | 20 } |
| (...skipping 27 matching lines...) Expand all Loading... |
| 47 } | 48 } |
| 48 | 49 |
| 49 void QuicReliableClientStream::OnCanWrite() { | 50 void QuicReliableClientStream::OnCanWrite() { |
| 50 ReliableQuicStream::OnCanWrite(); | 51 ReliableQuicStream::OnCanWrite(); |
| 51 | 52 |
| 52 if (!HasBufferedData() && !callback_.is_null()) { | 53 if (!HasBufferedData() && !callback_.is_null()) { |
| 53 base::ResetAndReturn(&callback_).Run(OK); | 54 base::ResetAndReturn(&callback_).Run(OK); |
| 54 } | 55 } |
| 55 } | 56 } |
| 56 | 57 |
| 58 QuicPriority QuicReliableClientStream::EffectivePriority() const { |
| 59 if (delegate_->HasSendHeadersComplete()) { |
| 60 return ReliableQuicStream::EffectivePriority(); |
| 61 } |
| 62 return kHighestPriority; |
| 63 } |
| 64 |
| 57 int QuicReliableClientStream::WriteStreamData( | 65 int QuicReliableClientStream::WriteStreamData( |
| 58 base::StringPiece data, | 66 base::StringPiece data, |
| 59 bool fin, | 67 bool fin, |
| 60 const CompletionCallback& callback) { | 68 const CompletionCallback& callback) { |
| 61 // We should not have data buffered. | 69 // We should not have data buffered. |
| 62 DCHECK(!HasBufferedData()); | 70 DCHECK(!HasBufferedData()); |
| 63 // Writes the data, or buffers it. | 71 // Writes the data, or buffers it. |
| 64 WriteData(data, fin); | 72 WriteData(data, fin); |
| 65 if (!HasBufferedData()) { | 73 if (!HasBufferedData()) { |
| 66 return OK; | 74 return OK; |
| (...skipping 11 matching lines...) Expand all Loading... |
| 78 | 86 |
| 79 void QuicReliableClientStream::OnError(int error) { | 87 void QuicReliableClientStream::OnError(int error) { |
| 80 if (delegate_) { | 88 if (delegate_) { |
| 81 QuicReliableClientStream::Delegate* delegate = delegate_; | 89 QuicReliableClientStream::Delegate* delegate = delegate_; |
| 82 delegate_ = NULL; | 90 delegate_ = NULL; |
| 83 delegate->OnError(error); | 91 delegate->OnError(error); |
| 84 } | 92 } |
| 85 } | 93 } |
| 86 | 94 |
| 87 } // namespace net | 95 } // namespace net |
| OLD | NEW |