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 #include "net/spdy/write_blocked_list.h" |
11 | 11 |
12 namespace net { | 12 namespace net { |
13 | 13 |
14 QuicReliableClientStream::QuicReliableClientStream(QuicStreamId id, | 14 QuicReliableClientStream::QuicReliableClientStream(QuicStreamId id, |
15 QuicSession* session, | 15 QuicSession* session, |
16 const BoundNetLog& net_log) | 16 const BoundNetLog& net_log) |
17 : ReliableQuicStream(id, session), | 17 : QuicDataStream(id, session), |
18 net_log_(net_log), | 18 net_log_(net_log), |
19 delegate_(NULL) { | 19 delegate_(NULL) { |
20 } | 20 } |
21 | 21 |
22 QuicReliableClientStream::~QuicReliableClientStream() { | 22 QuicReliableClientStream::~QuicReliableClientStream() { |
23 if (delegate_) | 23 if (delegate_) |
24 delegate_->OnClose(connection_error()); | 24 delegate_->OnClose(connection_error()); |
25 } | 25 } |
26 | 26 |
27 uint32 QuicReliableClientStream::ProcessData(const char* data, | 27 uint32 QuicReliableClientStream::ProcessData(const char* data, |
(...skipping 22 matching lines...) Expand all Loading... |
50 void QuicReliableClientStream::OnCanWrite() { | 50 void QuicReliableClientStream::OnCanWrite() { |
51 ReliableQuicStream::OnCanWrite(); | 51 ReliableQuicStream::OnCanWrite(); |
52 | 52 |
53 if (!HasBufferedData() && !callback_.is_null()) { | 53 if (!HasBufferedData() && !callback_.is_null()) { |
54 base::ResetAndReturn(&callback_).Run(OK); | 54 base::ResetAndReturn(&callback_).Run(OK); |
55 } | 55 } |
56 } | 56 } |
57 | 57 |
58 QuicPriority QuicReliableClientStream::EffectivePriority() const { | 58 QuicPriority QuicReliableClientStream::EffectivePriority() const { |
59 if (delegate_ && delegate_->HasSendHeadersComplete()) { | 59 if (delegate_ && delegate_->HasSendHeadersComplete()) { |
60 return ReliableQuicStream::EffectivePriority(); | 60 return QuicDataStream::EffectivePriority(); |
61 } | 61 } |
62 return kHighestPriority; | 62 return kHighestPriority; |
63 } | 63 } |
64 | 64 |
65 int QuicReliableClientStream::WriteStreamData( | 65 int QuicReliableClientStream::WriteStreamData( |
66 base::StringPiece data, | 66 base::StringPiece data, |
67 bool fin, | 67 bool fin, |
68 const CompletionCallback& callback) { | 68 const CompletionCallback& callback) { |
69 // We should not have data buffered. | 69 // We should not have data buffered. |
70 DCHECK(!HasBufferedData()); | 70 DCHECK(!HasBufferedData()); |
(...skipping 27 matching lines...) Expand all Loading... |
98 id() == kCryptoStreamId ? IS_HANDSHAKE : NOT_HANDSHAKE); | 98 id() == kCryptoStreamId ? IS_HANDSHAKE : NOT_HANDSHAKE); |
99 if (!can_write) { | 99 if (!can_write) { |
100 session()->MarkWriteBlocked(id(), EffectivePriority()); | 100 session()->MarkWriteBlocked(id(), EffectivePriority()); |
101 DCHECK(callback_.is_null()); | 101 DCHECK(callback_.is_null()); |
102 callback_ = callback; | 102 callback_ = callback; |
103 } | 103 } |
104 return can_write; | 104 return can_write; |
105 } | 105 } |
106 | 106 |
107 } // namespace net | 107 } // namespace net |
OLD | NEW |