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" |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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()); |
71 // Writes the data, or buffers it. | 71 // Writes the data, or buffers it. |
72 WriteData(data, fin); | 72 WriteOrBufferData(data, fin); |
73 if (!HasBufferedData()) { | 73 if (!HasBufferedData()) { |
74 return OK; | 74 return OK; |
75 } | 75 } |
76 | 76 |
77 callback_ = callback; | 77 callback_ = callback; |
78 return ERR_IO_PENDING; | 78 return ERR_IO_PENDING; |
79 } | 79 } |
80 | 80 |
81 void QuicReliableClientStream::SetDelegate( | 81 void QuicReliableClientStream::SetDelegate( |
82 QuicReliableClientStream::Delegate* delegate) { | 82 QuicReliableClientStream::Delegate* delegate) { |
(...skipping 15 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 |