Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(508)

Side by Side Diff: net/quic/chromium/quic_chromium_client_stream.cc

Issue 2868633002: Create a QuicChromiumClientStream::Handle class for allowing a stream (Closed)
Patch Set: Rebase Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/chromium/quic_chromium_client_stream.h" 5 #include "net/quic/chromium/quic_chromium_client_stream.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/bind_helpers.h" 9 #include "base/bind_helpers.h"
10 #include "base/callback_helpers.h" 10 #include "base/callback_helpers.h"
11 #include "base/location.h" 11 #include "base/location.h"
12 #include "base/threading/thread_task_runner_handle.h" 12 #include "base/threading/thread_task_runner_handle.h"
13 #include "net/base/io_buffer.h" 13 #include "net/base/io_buffer.h"
14 #include "net/base/net_errors.h" 14 #include "net/base/net_errors.h"
15 #include "net/log/net_log_event_type.h" 15 #include "net/log/net_log_event_type.h"
16 #include "net/quic/chromium/quic_chromium_client_session.h" 16 #include "net/quic/chromium/quic_chromium_client_session.h"
17 #include "net/quic/chromium/quic_http_utils.h" 17 #include "net/quic/chromium/quic_http_utils.h"
18 #include "net/quic/core/quic_spdy_session.h" 18 #include "net/quic/core/quic_spdy_session.h"
19 #include "net/quic/core/quic_write_blocked_list.h" 19 #include "net/quic/core/quic_write_blocked_list.h"
20 #include "net/quic/core/spdy_utils.h" 20 #include "net/quic/core/spdy_utils.h"
21 21
22 namespace net { 22 namespace net {
23 23
24 QuicChromiumClientStream::Handle::Handle(QuicChromiumClientStream* stream,
25 Delegate* delegate)
26 : stream_(stream), delegate_(delegate) {
27 SaveState();
28 }
29
30 QuicChromiumClientStream::Handle::~Handle() {
31 if (stream_) {
32 stream_->ClearHandle();
33 // TODO(rch): If stream_ is still valid, it should probably be Reset()
34 // so that it does not leak.
35 // stream_->Reset(QUIC_STREAM_CANCELLED);
36 }
37 }
38
39 void QuicChromiumClientStream::Handle::ClearDelegate() {
40 delegate_ = nullptr;
41 }
42
43 void QuicChromiumClientStream::Handle::OnInitialHeadersAvailable(
44 const SpdyHeaderBlock& headers,
45 size_t frame_len) {
46 delegate_->OnInitialHeadersAvailable(headers, frame_len);
47 }
48
49 void QuicChromiumClientStream::Handle::OnTrailingHeadersAvailable(
50 const SpdyHeaderBlock& headers,
51 size_t frame_len) {
52 delegate_->OnTrailingHeadersAvailable(headers, frame_len);
53 }
54
55 void QuicChromiumClientStream::Handle::OnDataAvailable() {
56 delegate_->OnDataAvailable();
57 }
58
59 void QuicChromiumClientStream::Handle::OnClose() {
60 if (stream_)
61 SaveState();
62 stream_ = nullptr;
63 if (delegate_) {
64 auto* delegate = delegate_;
65 delegate_ = nullptr;
66 delegate->OnClose();
67 }
68 }
69
70 void QuicChromiumClientStream::Handle::OnError(int error) {
71 if (stream_)
72 SaveState();
73 stream_ = nullptr;
74 if (delegate_) {
75 auto* delegate = delegate_;
76 delegate_ = nullptr;
77 delegate->OnError(error);
78 }
79 }
80
81 size_t QuicChromiumClientStream::Handle::WriteHeaders(
82 SpdyHeaderBlock header_block,
83 bool fin,
84 QuicReferenceCountedPointer<QuicAckListenerInterface>
85 ack_notifier_delegate) {
86 if (!stream_)
87 return 0;
88 return stream_->WriteHeaders(std::move(header_block), fin,
89 ack_notifier_delegate);
90 }
91
92 int QuicChromiumClientStream::Handle::WriteStreamData(
93 base::StringPiece data,
94 bool fin,
95 const CompletionCallback& callback) {
96 if (!stream_)
97 return ERR_CONNECTION_CLOSED;
98 return stream_->WriteStreamData(data, fin, callback);
99 }
100
101 int QuicChromiumClientStream::Handle::WritevStreamData(
102 const std::vector<scoped_refptr<IOBuffer>>& buffers,
103 const std::vector<int>& lengths,
104 bool fin,
105 const CompletionCallback& callback) {
106 if (!stream_)
107 return ERR_CONNECTION_CLOSED;
108 return stream_->WritevStreamData(buffers, lengths, fin, callback);
109 }
110
111 int QuicChromiumClientStream::Handle::Read(IOBuffer* buf, int buf_len) {
112 if (!stream_)
113 return ERR_CONNECTION_CLOSED;
114 return stream_->Read(buf, buf_len);
115 }
116
117 void QuicChromiumClientStream::Handle::OnFinRead() {
118 if (stream_)
119 stream_->OnFinRead();
120 //
xunjieli 2017/05/08 19:51:00 nit: remove //
Ryan Hamilton 2017/05/08 20:58:05 Done.
121 }
122
123 void QuicChromiumClientStream::Handle::DisableConnectionMigration() {
124 if (stream_)
125 stream_->DisableConnectionMigration();
126 }
127
128 void QuicChromiumClientStream::Handle::SetPriority(SpdyPriority priority) {
129 if (stream_)
130 stream_->SetPriority(priority);
131 }
132
133 void QuicChromiumClientStream::Handle::Reset(
134 QuicRstStreamErrorCode error_code) {
135 if (stream_)
136 stream_->Reset(error_code);
137 }
138
139 QuicStreamId QuicChromiumClientStream::Handle::id() const {
140 if (!stream_)
141 return id_;
142 return stream_->id();
143 }
144
145 QuicErrorCode QuicChromiumClientStream::Handle::connection_error() const {
146 if (!stream_)
147 return connection_error_;
148 return stream_->connection_error();
149 }
150
151 QuicRstStreamErrorCode QuicChromiumClientStream::Handle::stream_error() const {
152 if (!stream_)
153 return stream_error_;
154 return stream_->stream_error();
155 }
156
157 bool QuicChromiumClientStream::Handle::fin_sent() const {
158 if (!stream_)
159 return fin_sent_;
160 return stream_->fin_sent();
161 }
162
163 bool QuicChromiumClientStream::Handle::fin_received() const {
164 if (!stream_)
165 return fin_received_;
166 return stream_->fin_received();
167 }
168
169 uint64_t QuicChromiumClientStream::Handle::stream_bytes_read() const {
170 if (!stream_)
171 return stream_bytes_read_;
172 return stream_->stream_bytes_read();
173 }
174
175 uint64_t QuicChromiumClientStream::Handle::stream_bytes_written() const {
176 if (!stream_)
177 return stream_bytes_written_;
178 return stream_->stream_bytes_written();
179 }
180
181 size_t QuicChromiumClientStream::Handle::NumBytesConsumed() const {
182 if (!stream_)
183 return num_bytes_consumed_;
184 return stream_->sequencer()->NumBytesConsumed();
185 }
186
187 bool QuicChromiumClientStream::Handle::IsDoneReading() const {
188 if (!stream_)
189 return is_done_reading_;
190 return stream_->IsDoneReading();
191 }
192
193 bool QuicChromiumClientStream::Handle::IsFirstStream() const {
194 if (!stream_)
195 return is_first_stream_;
196 return stream_->IsFirstStream();
197 }
198
199 SpdyPriority QuicChromiumClientStream::Handle::priority() const {
200 if (!stream_)
201 return 0;
xunjieli 2017/05/08 19:51:00 0 is kV3HighestPriority. which can be misleading.
Ryan Hamilton 2017/05/08 20:58:05 Whoops, fixed. It's test-only and I'll eventually
202 return stream_->priority();
203 }
204 bool QuicChromiumClientStream::Handle::can_migrate() {
205 if (!stream_)
206 return false;
207 return stream_->can_migrate();
208 }
209 void QuicChromiumClientStream::Handle::OnPromiseHeaderList(
xunjieli 2017/05/08 19:51:00 nit: Can we match the order with the declaration i
Ryan Hamilton 2017/05/08 20:58:05 Done.
210 QuicStreamId promised_id,
211 size_t frame_len,
212 const QuicHeaderList& header_list) {
213 stream_->OnPromiseHeaderList(promised_id, frame_len, header_list);
214 }
215 QuicChromiumClientStream::Delegate*
216 QuicChromiumClientStream::Handle::GetDelegate() {
217 return delegate_;
218 }
219
220 void QuicChromiumClientStream::Handle::SaveState() {
xunjieli 2017/05/08 19:51:00 nit: Maybe add a DCHECK(stream_) here.
Ryan Hamilton 2017/05/08 20:58:05 Done.
221 fin_sent_ = stream_->fin_sent();
222 fin_received_ = stream_->fin_received();
223 num_bytes_consumed_ = stream_->sequencer()->NumBytesConsumed();
224 id_ = stream_->id();
225 connection_error_ = stream_->connection_error();
226 stream_error_ = stream_->stream_error();
227 is_done_reading_ = stream_->IsDoneReading();
228 is_first_stream_ = stream_->IsFirstStream();
229 stream_bytes_read_ = stream_->stream_bytes_read();
230 stream_bytes_written_ = stream_->stream_bytes_written();
231 }
232
24 QuicChromiumClientStream::QuicChromiumClientStream( 233 QuicChromiumClientStream::QuicChromiumClientStream(
25 QuicStreamId id, 234 QuicStreamId id,
26 QuicClientSessionBase* session, 235 QuicClientSessionBase* session,
27 const NetLogWithSource& net_log) 236 const NetLogWithSource& net_log)
28 : QuicSpdyStream(id, session), 237 : QuicSpdyStream(id, session),
29 net_log_(net_log), 238 net_log_(net_log),
30 delegate_(nullptr), 239 handle_(nullptr),
31 headers_delivered_(false), 240 headers_delivered_(false),
32 initial_headers_sent_(false), 241 initial_headers_sent_(false),
33 session_(session), 242 session_(session),
34 can_migrate_(true), 243 can_migrate_(true),
35 initial_headers_frame_len_(0), 244 initial_headers_frame_len_(0),
36 weak_factory_(this) {} 245 weak_factory_(this) {}
37 246
38 QuicChromiumClientStream::~QuicChromiumClientStream() { 247 QuicChromiumClientStream::~QuicChromiumClientStream() {
39 if (delegate_) 248 if (handle_)
40 delegate_->OnClose(); 249 handle_->OnClose();
41 } 250 }
42 251
43 void QuicChromiumClientStream::OnInitialHeadersComplete( 252 void QuicChromiumClientStream::OnInitialHeadersComplete(
44 bool fin, 253 bool fin,
45 size_t frame_len, 254 size_t frame_len,
46 const QuicHeaderList& header_list) { 255 const QuicHeaderList& header_list) {
47 QuicSpdyStream::OnInitialHeadersComplete(fin, frame_len, header_list); 256 QuicSpdyStream::OnInitialHeadersComplete(fin, frame_len, header_list);
48 257
49 SpdyHeaderBlock header_block; 258 SpdyHeaderBlock header_block;
50 int64_t length = -1; 259 int64_t length = -1;
51 if (!SpdyUtils::CopyAndValidateHeaders(header_list, &length, &header_block)) { 260 if (!SpdyUtils::CopyAndValidateHeaders(header_list, &length, &header_block)) {
52 DLOG(ERROR) << "Failed to parse header list: " << header_list.DebugString(); 261 DLOG(ERROR) << "Failed to parse header list: " << header_list.DebugString();
53 ConsumeHeaderList(); 262 ConsumeHeaderList();
54 Reset(QUIC_BAD_APPLICATION_PAYLOAD); 263 Reset(QUIC_BAD_APPLICATION_PAYLOAD);
55 return; 264 return;
56 } 265 }
57 266
58 ConsumeHeaderList(); 267 ConsumeHeaderList();
59 session_->OnInitialHeadersComplete(id(), header_block); 268 session_->OnInitialHeadersComplete(id(), header_block);
60 269
61 if (delegate_) { 270 if (handle_) {
62 // The delegate will receive the headers via a posted task. 271 // The handle will receive the headers via a posted task.
63 NotifyDelegateOfInitialHeadersAvailableLater(std::move(header_block), 272 NotifyHandleOfInitialHeadersAvailableLater(std::move(header_block),
64 frame_len); 273 frame_len);
65 return; 274 return;
66 } 275 }
67 276
68 // Buffer the headers and deliver them when the delegate arrives. 277 // Buffer the headers and deliver them when the handle arrives.
69 initial_headers_ = std::move(header_block); 278 initial_headers_ = std::move(header_block);
70 initial_headers_frame_len_ = frame_len; 279 initial_headers_frame_len_ = frame_len;
71 } 280 }
72 281
73 void QuicChromiumClientStream::OnTrailingHeadersComplete( 282 void QuicChromiumClientStream::OnTrailingHeadersComplete(
74 bool fin, 283 bool fin,
75 size_t frame_len, 284 size_t frame_len,
76 const QuicHeaderList& header_list) { 285 const QuicHeaderList& header_list) {
77 QuicSpdyStream::OnTrailingHeadersComplete(fin, frame_len, header_list); 286 QuicSpdyStream::OnTrailingHeadersComplete(fin, frame_len, header_list);
78 NotifyDelegateOfTrailingHeadersAvailableLater(received_trailers().Clone(), 287 NotifyHandleOfTrailingHeadersAvailableLater(received_trailers().Clone(),
79 frame_len); 288 frame_len);
80 } 289 }
81 290
82 void QuicChromiumClientStream::OnPromiseHeaderList( 291 void QuicChromiumClientStream::OnPromiseHeaderList(
83 QuicStreamId promised_id, 292 QuicStreamId promised_id,
84 size_t frame_len, 293 size_t frame_len,
85 const QuicHeaderList& header_list) { 294 const QuicHeaderList& header_list) {
86 SpdyHeaderBlock promise_headers; 295 SpdyHeaderBlock promise_headers;
87 int64_t content_length = -1; 296 int64_t content_length = -1;
88 if (!SpdyUtils::CopyAndValidateHeaders(header_list, &content_length, 297 if (!SpdyUtils::CopyAndValidateHeaders(header_list, &content_length,
89 &promise_headers)) { 298 &promise_headers)) {
(...skipping 12 matching lines...) Expand all
102 // Buffer the data in the sequencer until the headers have been read. 311 // Buffer the data in the sequencer until the headers have been read.
103 return; 312 return;
104 } 313 }
105 314
106 if (!sequencer()->HasBytesToRead() && !FinishedReadingTrailers()) { 315 if (!sequencer()->HasBytesToRead() && !FinishedReadingTrailers()) {
107 // If there is no data to read, wait until either FIN is received or 316 // If there is no data to read, wait until either FIN is received or
108 // trailers are delivered. 317 // trailers are delivered.
109 return; 318 return;
110 } 319 }
111 320
112 // The delegate will read the data via a posted task, and 321 // The handle will read the data via a posted task, and
113 // will be able to, potentially, read all data which has queued up. 322 // will be able to, potentially, read all data which has queued up.
114 if (delegate_) 323 if (handle_)
115 NotifyDelegateOfDataAvailableLater(); 324 NotifyHandleOfDataAvailableLater();
116 } 325 }
117 326
118 void QuicChromiumClientStream::OnClose() { 327 void QuicChromiumClientStream::OnClose() {
119 if (delegate_) { 328 if (handle_) {
120 delegate_->OnClose(); 329 handle_->OnClose();
121 delegate_ = nullptr; 330 handle_ = nullptr;
122 } 331 }
123 QuicStream::OnClose(); 332 QuicStream::OnClose();
124 } 333 }
125 334
126 void QuicChromiumClientStream::OnCanWrite() { 335 void QuicChromiumClientStream::OnCanWrite() {
127 QuicStream::OnCanWrite(); 336 QuicStream::OnCanWrite();
128 337
129 if (!HasBufferedData() && !write_callback_.is_null()) { 338 if (!HasBufferedData() && !write_callback_.is_null()) {
130 base::ResetAndReturn(&write_callback_).Run(OK); 339 base::ResetAndReturn(&write_callback_).Run(OK);
131 } 340 }
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 WriteOrBufferData(string_data, is_fin, nullptr); 394 WriteOrBufferData(string_data, is_fin, nullptr);
186 } 395 }
187 if (!HasBufferedData()) { 396 if (!HasBufferedData()) {
188 return OK; 397 return OK;
189 } 398 }
190 399
191 write_callback_ = callback; 400 write_callback_ = callback;
192 return ERR_IO_PENDING; 401 return ERR_IO_PENDING;
193 } 402 }
194 403
195 void QuicChromiumClientStream::SetDelegate( 404 std::unique_ptr<QuicChromiumClientStream::Handle>
405 QuicChromiumClientStream::CreateHandle(
196 QuicChromiumClientStream::Delegate* delegate) { 406 QuicChromiumClientStream::Delegate* delegate) {
197 DCHECK(!(delegate_ && delegate)); 407 DCHECK(!handle_);
198 delegate_ = delegate; 408 auto handle = std::unique_ptr<QuicChromiumClientStream::Handle>(
199 if (delegate == nullptr) 409 new QuicChromiumClientStream::Handle(this, delegate));
200 return; 410 handle_ = handle.get();
201 411
202 // Should this perhaps be via PostTask to make reasoning simpler? 412 // Should this perhaps be via PostTask to make reasoning simpler?
203 if (!initial_headers_.empty()) { 413 if (!initial_headers_.empty()) {
204 delegate_->OnInitialHeadersAvailable(std::move(initial_headers_), 414 handle_->OnInitialHeadersAvailable(std::move(initial_headers_),
205 initial_headers_frame_len_); 415 initial_headers_frame_len_);
416 }
417
418 return handle;
419 }
420
421 void QuicChromiumClientStream::ClearHandle() {
422 handle_ = nullptr;
423 }
424
425 void QuicChromiumClientStream::OnError(int error) {
426 if (handle_) {
427 QuicChromiumClientStream::Handle* handle = handle_;
428 handle_ = nullptr;
429 handle->OnError(error);
206 } 430 }
207 } 431 }
208 432
209 void QuicChromiumClientStream::OnError(int error) {
210 if (delegate_) {
211 QuicChromiumClientStream::Delegate* delegate = delegate_;
212 delegate_ = nullptr;
213 delegate->OnError(error);
214 }
215 }
216
217 int QuicChromiumClientStream::Read(IOBuffer* buf, int buf_len) { 433 int QuicChromiumClientStream::Read(IOBuffer* buf, int buf_len) {
218 if (IsDoneReading()) 434 if (IsDoneReading())
219 return 0; // EOF 435 return 0; // EOF
220 436
221 if (!HasBytesToRead()) 437 if (!HasBytesToRead())
222 return ERR_IO_PENDING; 438 return ERR_IO_PENDING;
223 439
224 iovec iov; 440 iovec iov;
225 iov.iov_base = buf->data(); 441 iov.iov_base = buf->data();
226 iov.iov_len = buf_len; 442 iov.iov_len = buf_len;
227 size_t bytes_read = Readv(&iov, 1); 443 size_t bytes_read = Readv(&iov, 1);
228 // Since HasBytesToRead is true, Readv() must of read some data. 444 // Since HasBytesToRead is true, Readv() must of read some data.
229 DCHECK_NE(0u, bytes_read); 445 DCHECK_NE(0u, bytes_read);
230 return bytes_read; 446 return bytes_read;
231 } 447 }
232 448
233 void QuicChromiumClientStream::NotifyDelegateOfInitialHeadersAvailableLater( 449 void QuicChromiumClientStream::NotifyHandleOfInitialHeadersAvailableLater(
234 SpdyHeaderBlock headers, 450 SpdyHeaderBlock headers,
235 size_t frame_len) { 451 size_t frame_len) {
236 DCHECK(delegate_); 452 DCHECK(handle_);
237 base::ThreadTaskRunnerHandle::Get()->PostTask( 453 base::ThreadTaskRunnerHandle::Get()->PostTask(
238 FROM_HERE, 454 FROM_HERE,
239 base::Bind( 455 base::Bind(
240 &QuicChromiumClientStream::NotifyDelegateOfInitialHeadersAvailable, 456 &QuicChromiumClientStream::NotifyHandleOfInitialHeadersAvailable,
241 weak_factory_.GetWeakPtr(), base::Passed(std::move(headers)), 457 weak_factory_.GetWeakPtr(), base::Passed(std::move(headers)),
242 frame_len)); 458 frame_len));
243 } 459 }
244 460
245 void QuicChromiumClientStream::NotifyDelegateOfInitialHeadersAvailable( 461 void QuicChromiumClientStream::NotifyHandleOfInitialHeadersAvailable(
246 SpdyHeaderBlock headers, 462 SpdyHeaderBlock headers,
247 size_t frame_len) { 463 size_t frame_len) {
248 if (!delegate_) 464 if (!handle_)
249 return; 465 return;
250 466
251 DCHECK(!headers_delivered_); 467 DCHECK(!headers_delivered_);
252 headers_delivered_ = true; 468 headers_delivered_ = true;
253 net_log_.AddEvent( 469 net_log_.AddEvent(
254 NetLogEventType::QUIC_CHROMIUM_CLIENT_STREAM_READ_RESPONSE_HEADERS, 470 NetLogEventType::QUIC_CHROMIUM_CLIENT_STREAM_READ_RESPONSE_HEADERS,
255 base::Bind(&SpdyHeaderBlockNetLogCallback, &headers)); 471 base::Bind(&SpdyHeaderBlockNetLogCallback, &headers));
256 472
257 delegate_->OnInitialHeadersAvailable(headers, frame_len); 473 handle_->OnInitialHeadersAvailable(headers, frame_len);
258 } 474 }
259 475
260 void QuicChromiumClientStream::NotifyDelegateOfTrailingHeadersAvailableLater( 476 void QuicChromiumClientStream::NotifyHandleOfTrailingHeadersAvailableLater(
261 SpdyHeaderBlock headers, 477 SpdyHeaderBlock headers,
262 size_t frame_len) { 478 size_t frame_len) {
263 DCHECK(delegate_); 479 DCHECK(handle_);
264 base::ThreadTaskRunnerHandle::Get()->PostTask( 480 base::ThreadTaskRunnerHandle::Get()->PostTask(
265 FROM_HERE, 481 FROM_HERE,
266 base::Bind( 482 base::Bind(
267 &QuicChromiumClientStream::NotifyDelegateOfTrailingHeadersAvailable, 483 &QuicChromiumClientStream::NotifyHandleOfTrailingHeadersAvailable,
268 weak_factory_.GetWeakPtr(), base::Passed(std::move(headers)), 484 weak_factory_.GetWeakPtr(), base::Passed(std::move(headers)),
269 frame_len)); 485 frame_len));
270 } 486 }
271 487
272 void QuicChromiumClientStream::NotifyDelegateOfTrailingHeadersAvailable( 488 void QuicChromiumClientStream::NotifyHandleOfTrailingHeadersAvailable(
273 SpdyHeaderBlock headers, 489 SpdyHeaderBlock headers,
274 size_t frame_len) { 490 size_t frame_len) {
275 if (!delegate_) 491 if (!handle_)
276 return; 492 return;
277 493
278 DCHECK(headers_delivered_); 494 DCHECK(headers_delivered_);
279 // Only mark trailers consumed when we are about to notify delegate. 495 // Only mark trailers consumed when we are about to notify delegate.
280 MarkTrailersConsumed(); 496 MarkTrailersConsumed();
281 // Post an async task to notify delegate of the FIN flag. 497 // Post an async task to notify delegate of the FIN flag.
282 NotifyDelegateOfDataAvailableLater(); 498 NotifyHandleOfDataAvailableLater();
283 net_log_.AddEvent( 499 net_log_.AddEvent(
284 NetLogEventType::QUIC_CHROMIUM_CLIENT_STREAM_READ_RESPONSE_TRAILERS, 500 NetLogEventType::QUIC_CHROMIUM_CLIENT_STREAM_READ_RESPONSE_TRAILERS,
285 base::Bind(&SpdyHeaderBlockNetLogCallback, &headers)); 501 base::Bind(&SpdyHeaderBlockNetLogCallback, &headers));
286 502
287 delegate_->OnTrailingHeadersAvailable(headers, frame_len); 503 handle_->OnTrailingHeadersAvailable(headers, frame_len);
288 } 504 }
289 505
290 void QuicChromiumClientStream::NotifyDelegateOfDataAvailableLater() { 506 void QuicChromiumClientStream::NotifyHandleOfDataAvailableLater() {
291 DCHECK(delegate_); 507 DCHECK(handle_);
292 base::ThreadTaskRunnerHandle::Get()->PostTask( 508 base::ThreadTaskRunnerHandle::Get()->PostTask(
293 FROM_HERE, 509 FROM_HERE,
294 base::Bind(&QuicChromiumClientStream::NotifyDelegateOfDataAvailable, 510 base::Bind(&QuicChromiumClientStream::NotifyHandleOfDataAvailable,
295 weak_factory_.GetWeakPtr())); 511 weak_factory_.GetWeakPtr()));
296 } 512 }
297 513
298 void QuicChromiumClientStream::NotifyDelegateOfDataAvailable() { 514 void QuicChromiumClientStream::NotifyHandleOfDataAvailable() {
299 if (delegate_) 515 if (handle_)
300 delegate_->OnDataAvailable(); 516 handle_->OnDataAvailable();
301 } 517 }
302 518
303 void QuicChromiumClientStream::DisableConnectionMigration() { 519 void QuicChromiumClientStream::DisableConnectionMigration() {
304 can_migrate_ = false; 520 can_migrate_ = false;
305 } 521 }
306 522
307 bool QuicChromiumClientStream::IsFirstStream() { 523 bool QuicChromiumClientStream::IsFirstStream() {
308 return id() == kHeadersStreamId + 2; 524 return id() == kHeadersStreamId + 2;
309 } 525 }
310 526
311 } // namespace net 527 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698