| 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/location.h" | 9 #include "base/location.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 171 } | 171 } |
| 172 | 172 |
| 173 // OnResponseHeadersUpdated() may have closed |this|. | 173 // OnResponseHeadersUpdated() may have closed |this|. |
| 174 if (!weak_this) | 174 if (!weak_this) |
| 175 return; | 175 return; |
| 176 | 176 |
| 177 response_headers_status_ = RESPONSE_HEADERS_ARE_COMPLETE; | 177 response_headers_status_ = RESPONSE_HEADERS_ARE_COMPLETE; |
| 178 | 178 |
| 179 while (!pending_recv_data_.empty()) { | 179 while (!pending_recv_data_.empty()) { |
| 180 // Take ownership of the first element of |pending_recv_data_|. | 180 // Take ownership of the first element of |pending_recv_data_|. |
| 181 scoped_ptr<SpdyBuffer> buffer(pending_recv_data_.front()); | 181 scoped_ptr<SpdyBuffer> buffer = std::move(pending_recv_data_.at(0)); |
| 182 pending_recv_data_.weak_erase(pending_recv_data_.begin()); | 182 pending_recv_data_.erase(pending_recv_data_.begin()); |
| 183 | 183 |
| 184 bool eof = (buffer == NULL); | 184 bool eof = (buffer == NULL); |
| 185 | 185 |
| 186 CHECK(delegate_); | 186 CHECK(delegate_); |
| 187 delegate_->OnDataReceived(buffer.Pass()); | 187 delegate_->OnDataReceived(buffer.Pass()); |
| 188 | 188 |
| 189 // OnDataReceived() may have closed |this|. | 189 // OnDataReceived() may have closed |this|. |
| 190 if (!weak_this) | 190 if (!weak_this) |
| 191 return; | 191 return; |
| 192 | 192 |
| (...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 477 DCHECK(session_->IsStreamActive(stream_id_)); | 477 DCHECK(session_->IsStreamActive(stream_id_)); |
| 478 | 478 |
| 479 // If we're still buffering data for a push stream, we will do the | 479 // If we're still buffering data for a push stream, we will do the |
| 480 // check for data received with incomplete headers in | 480 // check for data received with incomplete headers in |
| 481 // PushedStreamReplayData(). | 481 // PushedStreamReplayData(). |
| 482 if (io_state_ == STATE_HALF_CLOSED_LOCAL_UNCLAIMED) { | 482 if (io_state_ == STATE_HALF_CLOSED_LOCAL_UNCLAIMED) { |
| 483 DCHECK_EQ(type_, SPDY_PUSH_STREAM); | 483 DCHECK_EQ(type_, SPDY_PUSH_STREAM); |
| 484 // It should be valid for this to happen in the server push case. | 484 // It should be valid for this to happen in the server push case. |
| 485 // We'll return received data when delegate gets attached to the stream. | 485 // We'll return received data when delegate gets attached to the stream. |
| 486 if (buffer) { | 486 if (buffer) { |
| 487 pending_recv_data_.push_back(buffer.Pass()); | 487 pending_recv_data_.push_back(std::move(buffer)); |
| 488 } else { | 488 } else { |
| 489 pending_recv_data_.push_back(NULL); | 489 pending_recv_data_.push_back(NULL); |
| 490 // Note: we leave the stream open in the session until the stream | 490 // Note: we leave the stream open in the session until the stream |
| 491 // is claimed. | 491 // is claimed. |
| 492 } | 492 } |
| 493 return; | 493 return; |
| 494 } | 494 } |
| 495 | 495 |
| 496 if (response_headers_status_ == TRAILERS_RECEIVED && buffer) { | 496 if (response_headers_status_ == TRAILERS_RECEIVED && buffer) { |
| 497 // TRAILERS_RECEIVED is only used in SPDY_REQUEST_RESPONSE_STREAM. | 497 // TRAILERS_RECEIVED is only used in SPDY_REQUEST_RESPONSE_STREAM. |
| (...skipping 448 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 946 description = base::StringPrintf("Unknown state 0x%08X (%u)", state, | 946 description = base::StringPrintf("Unknown state 0x%08X (%u)", state, |
| 947 state); | 947 state); |
| 948 break; | 948 break; |
| 949 } | 949 } |
| 950 return description; | 950 return description; |
| 951 } | 951 } |
| 952 | 952 |
| 953 #undef STATE_CASE | 953 #undef STATE_CASE |
| 954 | 954 |
| 955 } // namespace net | 955 } // namespace net |
| OLD | NEW |