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 // NOTE: This code is not shared between Google and Chrome. | 5 // NOTE: This code is not shared between Google and Chrome. |
6 | 6 |
7 #ifndef NET_QUIC_QUIC_CHROMIUM_CLIENT_STREAM_H_ | 7 #ifndef NET_QUIC_QUIC_CHROMIUM_CLIENT_STREAM_H_ |
8 #define NET_QUIC_QUIC_CHROMIUM_CLIENT_STREAM_H_ | 8 #define NET_QUIC_QUIC_CHROMIUM_CLIENT_STREAM_H_ |
9 | 9 |
10 #include <stddef.h> | 10 #include <stddef.h> |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 | 52 |
53 protected: | 53 protected: |
54 virtual ~Delegate() {} | 54 virtual ~Delegate() {} |
55 | 55 |
56 private: | 56 private: |
57 DISALLOW_COPY_AND_ASSIGN(Delegate); | 57 DISALLOW_COPY_AND_ASSIGN(Delegate); |
58 }; | 58 }; |
59 | 59 |
60 QuicChromiumClientStream(QuicStreamId id, | 60 QuicChromiumClientStream(QuicStreamId id, |
61 QuicClientSessionBase* session, | 61 QuicClientSessionBase* session, |
62 const BoundNetLog& net_log); | 62 const NetLogWithSource& net_log); |
63 | 63 |
64 ~QuicChromiumClientStream() override; | 64 ~QuicChromiumClientStream() override; |
65 | 65 |
66 // QuicSpdyStream | 66 // QuicSpdyStream |
67 void OnStreamHeadersComplete(bool fin, size_t frame_len) override; | 67 void OnStreamHeadersComplete(bool fin, size_t frame_len) override; |
68 void OnInitialHeadersComplete(bool fin, | 68 void OnInitialHeadersComplete(bool fin, |
69 size_t frame_len, | 69 size_t frame_len, |
70 const QuicHeaderList& header_list) override; | 70 const QuicHeaderList& header_list) override; |
71 void OnTrailingHeadersComplete(bool fin, | 71 void OnTrailingHeadersComplete(bool fin, |
72 size_t frame_len, | 72 size_t frame_len, |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 | 106 |
107 // Reads at most |buf_len| bytes into |buf|. Returns the number of bytes read. | 107 // Reads at most |buf_len| bytes into |buf|. Returns the number of bytes read. |
108 int Read(IOBuffer* buf, int buf_len); | 108 int Read(IOBuffer* buf, int buf_len); |
109 | 109 |
110 // Returns true if the stream can possible write data. (The socket may | 110 // Returns true if the stream can possible write data. (The socket may |
111 // turn out to be write blocked, of course). If the stream can not write, | 111 // turn out to be write blocked, of course). If the stream can not write, |
112 // this method returns false, and |callback| will be invoked when | 112 // this method returns false, and |callback| will be invoked when |
113 // it becomes writable. | 113 // it becomes writable. |
114 bool CanWrite(const CompletionCallback& callback); | 114 bool CanWrite(const CompletionCallback& callback); |
115 | 115 |
116 const BoundNetLog& net_log() const { return net_log_; } | 116 const NetLogWithSource& net_log() const { return net_log_; } |
117 | 117 |
118 // Prevents this stream from migrating to a new network. May cause other | 118 // Prevents this stream from migrating to a new network. May cause other |
119 // concurrent streams within the session to also not migrate. | 119 // concurrent streams within the session to also not migrate. |
120 void DisableConnectionMigration(); | 120 void DisableConnectionMigration(); |
121 | 121 |
122 bool can_migrate() { return can_migrate_; } | 122 bool can_migrate() { return can_migrate_; } |
123 | 123 |
124 // True if this stream is the first data stream created on this session. | 124 // True if this stream is the first data stream created on this session. |
125 bool IsFirstStream(); | 125 bool IsFirstStream(); |
126 | 126 |
127 using QuicSpdyStream::HasBufferedData; | 127 using QuicSpdyStream::HasBufferedData; |
128 | 128 |
129 private: | 129 private: |
130 void NotifyDelegateOfHeadersCompleteLater(SpdyHeaderBlock headers, | 130 void NotifyDelegateOfHeadersCompleteLater(SpdyHeaderBlock headers, |
131 size_t frame_len); | 131 size_t frame_len); |
132 void NotifyDelegateOfHeadersComplete(SpdyHeaderBlock headers, | 132 void NotifyDelegateOfHeadersComplete(SpdyHeaderBlock headers, |
133 size_t frame_len); | 133 size_t frame_len); |
134 void NotifyDelegateOfDataAvailableLater(); | 134 void NotifyDelegateOfDataAvailableLater(); |
135 void NotifyDelegateOfDataAvailable(); | 135 void NotifyDelegateOfDataAvailable(); |
136 void RunOrBuffer(base::Closure closure); | 136 void RunOrBuffer(base::Closure closure); |
137 | 137 |
138 BoundNetLog net_log_; | 138 NetLogWithSource net_log_; |
139 Delegate* delegate_; | 139 Delegate* delegate_; |
140 | 140 |
141 bool headers_delivered_; | 141 bool headers_delivered_; |
142 | 142 |
143 CompletionCallback callback_; | 143 CompletionCallback callback_; |
144 | 144 |
145 QuicClientSessionBase* session_; | 145 QuicClientSessionBase* session_; |
146 | 146 |
147 // Set to false if this stream to not be migrated during connection migration. | 147 // Set to false if this stream to not be migrated during connection migration. |
148 bool can_migrate_; | 148 bool can_migrate_; |
149 | 149 |
150 // Holds notifications generated before delegate_ is set. | 150 // Holds notifications generated before delegate_ is set. |
151 std::deque<base::Closure> delegate_tasks_; | 151 std::deque<base::Closure> delegate_tasks_; |
152 | 152 |
153 base::WeakPtrFactory<QuicChromiumClientStream> weak_factory_; | 153 base::WeakPtrFactory<QuicChromiumClientStream> weak_factory_; |
154 | 154 |
155 DISALLOW_COPY_AND_ASSIGN(QuicChromiumClientStream); | 155 DISALLOW_COPY_AND_ASSIGN(QuicChromiumClientStream); |
156 }; | 156 }; |
157 | 157 |
158 } // namespace net | 158 } // namespace net |
159 | 159 |
160 #endif // NET_QUIC_QUIC_CHROMIUM_CLIENT_STREAM_H_ | 160 #endif // NET_QUIC_QUIC_CHROMIUM_CLIENT_STREAM_H_ |
OLD | NEW |