| 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_http_stream.h" | 5 #include "net/spdy/spdy_http_stream.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <list> | 8 #include <list> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 103 | 103 |
| 104 int SpdyHttpStream::ReadResponseHeaders(const CompletionCallback& callback) { | 104 int SpdyHttpStream::ReadResponseHeaders(const CompletionCallback& callback) { |
| 105 CHECK(!callback.is_null()); | 105 CHECK(!callback.is_null()); |
| 106 if (stream_closed_) | 106 if (stream_closed_) |
| 107 return closed_stream_status_; | 107 return closed_stream_status_; |
| 108 | 108 |
| 109 CHECK(stream_.get()); | 109 CHECK(stream_.get()); |
| 110 | 110 |
| 111 // Check if we already have the response headers. If so, return synchronously. | 111 // Check if we already have the response headers. If so, return synchronously. |
| 112 if (response_headers_status_ == RESPONSE_HEADERS_ARE_COMPLETE) { | 112 if (response_headers_status_ == RESPONSE_HEADERS_ARE_COMPLETE) { |
| 113 CHECK(!stream_->IsIdleTemporaryRename()); | 113 CHECK(!stream_->IsIdle()); |
| 114 return OK; | 114 return OK; |
| 115 } | 115 } |
| 116 | 116 |
| 117 // Still waiting for the response, return IO_PENDING. | 117 // Still waiting for the response, return IO_PENDING. |
| 118 CHECK(callback_.is_null()); | 118 CHECK(callback_.is_null()); |
| 119 callback_ = callback; | 119 callback_ = callback; |
| 120 return ERR_IO_PENDING; | 120 return ERR_IO_PENDING; |
| 121 } | 121 } |
| 122 | 122 |
| 123 int SpdyHttpStream::ReadResponseBody( | 123 int SpdyHttpStream::ReadResponseBody( |
| 124 IOBuffer* buf, int buf_len, const CompletionCallback& callback) { | 124 IOBuffer* buf, int buf_len, const CompletionCallback& callback) { |
| 125 if (stream_.get()) | 125 if (stream_.get()) |
| 126 CHECK(!stream_->IsIdleTemporaryRename()); | 126 CHECK(!stream_->IsIdle()); |
| 127 | 127 |
| 128 CHECK(buf); | 128 CHECK(buf); |
| 129 CHECK(buf_len); | 129 CHECK(buf_len); |
| 130 CHECK(!callback.is_null()); | 130 CHECK(!callback.is_null()); |
| 131 | 131 |
| 132 // If we have data buffered, complete the IO immediately. | 132 // If we have data buffered, complete the IO immediately. |
| 133 if (!response_body_queue_.IsEmpty()) { | 133 if (!response_body_queue_.IsEmpty()) { |
| 134 return response_body_queue_.Dequeue(buf->data(), buf_len); | 134 return response_body_queue_.Dequeue(buf->data(), buf_len); |
| 135 } else if (stream_closed_) { | 135 } else if (stream_closed_) { |
| 136 return closed_stream_status_; | 136 return closed_stream_status_; |
| (...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 535 Close(false); | 535 Close(false); |
| 536 delete this; | 536 delete this; |
| 537 } | 537 } |
| 538 | 538 |
| 539 void SpdyHttpStream::SetPriority(RequestPriority priority) { | 539 void SpdyHttpStream::SetPriority(RequestPriority priority) { |
| 540 // TODO(akalin): Plumb this through to |stream_request_| and | 540 // TODO(akalin): Plumb this through to |stream_request_| and |
| 541 // |stream_|. | 541 // |stream_|. |
| 542 } | 542 } |
| 543 | 543 |
| 544 } // namespace net | 544 } // namespace net |
| OLD | NEW |