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

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

Powered by Google App Engine
This is Rietveld 408576698