OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/spdy/spdy_stream.h" | 5 #include "net/spdy/spdy_stream.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
9 #include "net/http/http_request_info.h" | 9 #include "net/http/http_request_info.h" |
10 #include "net/http/http_response_info.h" | 10 #include "net/http/http_response_info.h" |
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
294 } | 294 } |
295 | 295 |
296 int SpdyStream::DoLoop(int result) { | 296 int SpdyStream::DoLoop(int result) { |
297 do { | 297 do { |
298 State state = io_state_; | 298 State state = io_state_; |
299 io_state_ = STATE_NONE; | 299 io_state_ = STATE_NONE; |
300 switch (state) { | 300 switch (state) { |
301 // State machine 1: Send headers and wait for response headers. | 301 // State machine 1: Send headers and wait for response headers. |
302 case STATE_SEND_HEADERS: | 302 case STATE_SEND_HEADERS: |
303 CHECK_EQ(OK, result); | 303 CHECK_EQ(OK, result); |
304 net_log_.BeginEvent(NetLog::TYPE_SPDY_STREAM_SEND_HEADERS); | 304 net_log_.BeginEvent(NetLog::TYPE_SPDY_STREAM_SEND_HEADERS, NULL); |
305 result = DoSendHeaders(); | 305 result = DoSendHeaders(); |
306 break; | 306 break; |
307 case STATE_SEND_HEADERS_COMPLETE: | 307 case STATE_SEND_HEADERS_COMPLETE: |
308 net_log_.EndEvent(NetLog::TYPE_SPDY_STREAM_SEND_HEADERS); | 308 net_log_.EndEvent(NetLog::TYPE_SPDY_STREAM_SEND_HEADERS, NULL); |
309 result = DoSendHeadersComplete(result); | 309 result = DoSendHeadersComplete(result); |
310 break; | 310 break; |
311 case STATE_SEND_BODY: | 311 case STATE_SEND_BODY: |
312 CHECK_EQ(OK, result); | 312 CHECK_EQ(OK, result); |
313 net_log_.BeginEvent(NetLog::TYPE_SPDY_STREAM_SEND_BODY); | 313 net_log_.BeginEvent(NetLog::TYPE_SPDY_STREAM_SEND_BODY, NULL); |
314 result = DoSendBody(); | 314 result = DoSendBody(); |
315 break; | 315 break; |
316 case STATE_SEND_BODY_COMPLETE: | 316 case STATE_SEND_BODY_COMPLETE: |
317 net_log_.EndEvent(NetLog::TYPE_SPDY_STREAM_SEND_BODY); | 317 net_log_.EndEvent(NetLog::TYPE_SPDY_STREAM_SEND_BODY, NULL); |
318 result = DoSendBodyComplete(result); | 318 result = DoSendBodyComplete(result); |
319 break; | 319 break; |
320 case STATE_READ_HEADERS: | 320 case STATE_READ_HEADERS: |
321 CHECK_EQ(OK, result); | 321 CHECK_EQ(OK, result); |
322 net_log_.BeginEvent(NetLog::TYPE_SPDY_STREAM_READ_HEADERS); | 322 net_log_.BeginEvent(NetLog::TYPE_SPDY_STREAM_READ_HEADERS, NULL); |
323 result = DoReadHeaders(); | 323 result = DoReadHeaders(); |
324 break; | 324 break; |
325 case STATE_READ_HEADERS_COMPLETE: | 325 case STATE_READ_HEADERS_COMPLETE: |
326 net_log_.EndEvent(NetLog::TYPE_SPDY_STREAM_READ_HEADERS); | 326 net_log_.EndEvent(NetLog::TYPE_SPDY_STREAM_READ_HEADERS, NULL); |
327 result = DoReadHeadersComplete(result); | 327 result = DoReadHeadersComplete(result); |
328 break; | 328 break; |
329 | 329 |
330 // State machine 2: Read body. | 330 // State machine 2: Read body. |
331 // NOTE(willchan): Currently unused. Currently we handle this stuff in | 331 // NOTE(willchan): Currently unused. Currently we handle this stuff in |
332 // the OnDataReceived()/OnClose()/ReadResponseHeaders()/etc. Only reason | 332 // the OnDataReceived()/OnClose()/ReadResponseHeaders()/etc. Only reason |
333 // to do this is for consistency with the Http code. | 333 // to do this is for consistency with the Http code. |
334 case STATE_READ_BODY: | 334 case STATE_READ_BODY: |
335 net_log_.BeginEvent(NetLog::TYPE_SPDY_STREAM_READ_BODY); | 335 net_log_.BeginEvent(NetLog::TYPE_SPDY_STREAM_READ_BODY, NULL); |
336 result = DoReadBody(); | 336 result = DoReadBody(); |
337 break; | 337 break; |
338 case STATE_READ_BODY_COMPLETE: | 338 case STATE_READ_BODY_COMPLETE: |
339 net_log_.EndEvent(NetLog::TYPE_SPDY_STREAM_READ_BODY); | 339 net_log_.EndEvent(NetLog::TYPE_SPDY_STREAM_READ_BODY, NULL); |
340 result = DoReadBodyComplete(result); | 340 result = DoReadBodyComplete(result); |
341 break; | 341 break; |
342 case STATE_DONE: | 342 case STATE_DONE: |
343 DCHECK(result != ERR_IO_PENDING); | 343 DCHECK(result != ERR_IO_PENDING); |
344 break; | 344 break; |
345 default: | 345 default: |
346 NOTREACHED(); | 346 NOTREACHED(); |
347 break; | 347 break; |
348 } | 348 } |
349 } while (result != ERR_IO_PENDING && io_state_ != STATE_NONE); | 349 } while (result != ERR_IO_PENDING && io_state_ != STATE_NONE); |
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
514 UMA_HISTOGRAM_TIMES("Net.SpdyStreamDownloadTime", | 514 UMA_HISTOGRAM_TIMES("Net.SpdyStreamDownloadTime", |
515 recv_last_byte_time_ - recv_first_byte_time_); | 515 recv_last_byte_time_ - recv_first_byte_time_); |
516 UMA_HISTOGRAM_TIMES("Net.SpdyStreamTime", | 516 UMA_HISTOGRAM_TIMES("Net.SpdyStreamTime", |
517 recv_last_byte_time_ - send_time_); | 517 recv_last_byte_time_ - send_time_); |
518 | 518 |
519 UMA_HISTOGRAM_COUNTS("Net.SpdySendBytes", send_bytes_); | 519 UMA_HISTOGRAM_COUNTS("Net.SpdySendBytes", send_bytes_); |
520 UMA_HISTOGRAM_COUNTS("Net.SpdyRecvBytes", recv_bytes_); | 520 UMA_HISTOGRAM_COUNTS("Net.SpdyRecvBytes", recv_bytes_); |
521 } | 521 } |
522 | 522 |
523 } // namespace net | 523 } // namespace net |
OLD | NEW |