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/spdy/spdy_stream.h" | 5 #include "net/spdy/spdy_stream.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
(...skipping 508 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
519 | 519 |
520 // Track our bandwidth. | 520 // Track our bandwidth. |
521 metrics_.RecordBytes(length); | 521 metrics_.RecordBytes(length); |
522 recv_bytes_ += length; | 522 recv_bytes_ += length; |
523 recv_last_byte_time_ = base::TimeTicks::Now(); | 523 recv_last_byte_time_ = base::TimeTicks::Now(); |
524 | 524 |
525 // May close |this|. | 525 // May close |this|. |
526 delegate_->OnDataReceived(buffer.Pass()); | 526 delegate_->OnDataReceived(buffer.Pass()); |
527 } | 527 } |
528 | 528 |
| 529 void SpdyStream::OnPaddingConsumed(size_t len) { |
| 530 if (session_->flow_control_state() >= SpdySession::FLOW_CONTROL_STREAM) { |
| 531 // Decrease window size because padding bytes are received. |
| 532 // Increase window size because padding bytes are consumed (by discarding). |
| 533 // Net result: |session_unacked_recv_window_bytes_| increases by |len|, |
| 534 // |session_recv_window_size_| does not change. |
| 535 DecreaseRecvWindowSize(static_cast<int32>(len)); |
| 536 IncreaseRecvWindowSize(static_cast<int32>(len)); |
| 537 } |
| 538 } |
| 539 |
529 void SpdyStream::OnFrameWriteComplete(SpdyFrameType frame_type, | 540 void SpdyStream::OnFrameWriteComplete(SpdyFrameType frame_type, |
530 size_t frame_size) { | 541 size_t frame_size) { |
531 DCHECK_NE(type_, SPDY_PUSH_STREAM); | 542 DCHECK_NE(type_, SPDY_PUSH_STREAM); |
532 | 543 |
533 if (frame_size < session_->GetFrameMinimumSize() || | 544 if (frame_size < session_->GetFrameMinimumSize() || |
534 frame_size > session_->GetFrameMaximumSize()) { | 545 frame_size > session_->GetFrameMaximumSize()) { |
535 NOTREACHED(); | 546 NOTREACHED(); |
536 return; | 547 return; |
537 } | 548 } |
538 CHECK(frame_type == SYN_STREAM || | 549 CHECK(frame_type == SYN_STREAM || |
(...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
912 description = base::StringPrintf("Unknown state 0x%08X (%u)", state, | 923 description = base::StringPrintf("Unknown state 0x%08X (%u)", state, |
913 state); | 924 state); |
914 break; | 925 break; |
915 } | 926 } |
916 return description; | 927 return description; |
917 } | 928 } |
918 | 929 |
919 #undef STATE_CASE | 930 #undef STATE_CASE |
920 | 931 |
921 } // namespace net | 932 } // namespace net |
OLD | NEW |