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/http/http_stream_parser.h" | 5 #include "net/http/http_stream_parser.h" |
6 | 6 |
7 #include "base/compiler_specific.h" | 7 #include "base/compiler_specific.h" |
8 #include "base/histogram.h" | 8 #include "base/histogram.h" |
9 #include "base/trace_event.h" | 9 #include "base/trace_event.h" |
10 #include "net/base/io_buffer.h" | 10 #include "net/base/io_buffer.h" |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
142 else | 142 else |
143 result = DoSendBody(result); | 143 result = DoSendBody(result); |
144 TRACE_EVENT_END("http.write_body", request_, request_->url.spec()); | 144 TRACE_EVENT_END("http.write_body", request_, request_->url.spec()); |
145 break; | 145 break; |
146 case STATE_REQUEST_SENT: | 146 case STATE_REQUEST_SENT: |
147 DCHECK(result != ERR_IO_PENDING); | 147 DCHECK(result != ERR_IO_PENDING); |
148 can_do_more = false; | 148 can_do_more = false; |
149 break; | 149 break; |
150 case STATE_READ_HEADERS: | 150 case STATE_READ_HEADERS: |
151 TRACE_EVENT_BEGIN("http.read_headers", request_, request_->url.spec()); | 151 TRACE_EVENT_BEGIN("http.read_headers", request_, request_->url.spec()); |
152 net_log_.BeginEvent(NetLog::TYPE_HTTP_STREAM_PARSER_READ_HEADERS); | 152 net_log_.BeginEvent(NetLog::TYPE_HTTP_STREAM_PARSER_READ_HEADERS, NULL); |
153 result = DoReadHeaders(); | 153 result = DoReadHeaders(); |
154 break; | 154 break; |
155 case STATE_READ_HEADERS_COMPLETE: | 155 case STATE_READ_HEADERS_COMPLETE: |
156 result = DoReadHeadersComplete(result); | 156 result = DoReadHeadersComplete(result); |
157 net_log_.EndEvent(NetLog::TYPE_HTTP_STREAM_PARSER_READ_HEADERS); | 157 net_log_.EndEvent(NetLog::TYPE_HTTP_STREAM_PARSER_READ_HEADERS, NULL); |
158 TRACE_EVENT_END("http.read_headers", request_, request_->url.spec()); | 158 TRACE_EVENT_END("http.read_headers", request_, request_->url.spec()); |
159 break; | 159 break; |
160 case STATE_BODY_PENDING: | 160 case STATE_BODY_PENDING: |
161 DCHECK(result != ERR_IO_PENDING); | 161 DCHECK(result != ERR_IO_PENDING); |
162 can_do_more = false; | 162 can_do_more = false; |
163 break; | 163 break; |
164 case STATE_READ_BODY: | 164 case STATE_READ_BODY: |
165 TRACE_EVENT_BEGIN("http.read_body", request_, request_->url.spec()); | 165 TRACE_EVENT_BEGIN("http.read_body", request_, request_->url.spec()); |
166 result = DoReadBody(); | 166 result = DoReadBody(); |
167 // DoReadBodyComplete handles error conditions. | 167 // DoReadBodyComplete handles error conditions. |
(...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
557 | 557 |
558 bool HttpStreamParser::CanFindEndOfResponse() const { | 558 bool HttpStreamParser::CanFindEndOfResponse() const { |
559 return chunked_decoder_.get() || response_body_length_ >= 0; | 559 return chunked_decoder_.get() || response_body_length_ >= 0; |
560 } | 560 } |
561 | 561 |
562 bool HttpStreamParser::IsMoreDataBuffered() const { | 562 bool HttpStreamParser::IsMoreDataBuffered() const { |
563 return read_buf_->offset() > read_buf_unused_offset_; | 563 return read_buf_->offset() > read_buf_unused_offset_; |
564 } | 564 } |
565 | 565 |
566 } // namespace net | 566 } // namespace net |
OLD | NEW |