OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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_network_transaction.h" | 5 #include "net/spdy/spdy_network_transaction.h" |
6 | 6 |
7 #include "base/compiler_specific.h" | 7 #include "base/compiler_specific.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/scoped_ptr.h" | 9 #include "base/scoped_ptr.h" |
10 #include "base/stats_counters.h" | 10 #include "base/stats_counters.h" |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 if (!request_) | 152 if (!request_) |
153 return 0; | 153 return 0; |
154 | 154 |
155 int rv = result; | 155 int rv = result; |
156 do { | 156 do { |
157 State state = next_state_; | 157 State state = next_state_; |
158 next_state_ = STATE_NONE; | 158 next_state_ = STATE_NONE; |
159 switch (state) { | 159 switch (state) { |
160 case STATE_INIT_CONNECTION: | 160 case STATE_INIT_CONNECTION: |
161 DCHECK_EQ(OK, rv); | 161 DCHECK_EQ(OK, rv); |
162 net_log_.BeginEvent(NetLog::TYPE_SPDY_TRANSACTION_INIT_CONNECTION); | 162 net_log_.BeginEvent(NetLog::TYPE_SPDY_TRANSACTION_INIT_CONNECTION, |
| 163 NULL); |
163 rv = DoInitConnection(); | 164 rv = DoInitConnection(); |
164 break; | 165 break; |
165 case STATE_INIT_CONNECTION_COMPLETE: | 166 case STATE_INIT_CONNECTION_COMPLETE: |
166 net_log_.EndEvent(NetLog::TYPE_SPDY_TRANSACTION_INIT_CONNECTION); | 167 net_log_.EndEvent(NetLog::TYPE_SPDY_TRANSACTION_INIT_CONNECTION, NULL); |
167 rv = DoInitConnectionComplete(rv); | 168 rv = DoInitConnectionComplete(rv); |
168 break; | 169 break; |
169 case STATE_SEND_REQUEST: | 170 case STATE_SEND_REQUEST: |
170 DCHECK_EQ(OK, rv); | 171 DCHECK_EQ(OK, rv); |
171 net_log_.BeginEvent(NetLog::TYPE_SPDY_TRANSACTION_SEND_REQUEST); | 172 net_log_.BeginEvent(NetLog::TYPE_SPDY_TRANSACTION_SEND_REQUEST, NULL); |
172 rv = DoSendRequest(); | 173 rv = DoSendRequest(); |
173 break; | 174 break; |
174 case STATE_SEND_REQUEST_COMPLETE: | 175 case STATE_SEND_REQUEST_COMPLETE: |
175 net_log_.EndEvent(NetLog::TYPE_SPDY_TRANSACTION_SEND_REQUEST); | 176 net_log_.EndEvent(NetLog::TYPE_SPDY_TRANSACTION_SEND_REQUEST, NULL); |
176 rv = DoSendRequestComplete(rv); | 177 rv = DoSendRequestComplete(rv); |
177 break; | 178 break; |
178 case STATE_READ_HEADERS: | 179 case STATE_READ_HEADERS: |
179 DCHECK_EQ(OK, rv); | 180 DCHECK_EQ(OK, rv); |
180 net_log_.BeginEvent(NetLog::TYPE_SPDY_TRANSACTION_READ_HEADERS); | 181 net_log_.BeginEvent(NetLog::TYPE_SPDY_TRANSACTION_READ_HEADERS, NULL); |
181 rv = DoReadHeaders(); | 182 rv = DoReadHeaders(); |
182 break; | 183 break; |
183 case STATE_READ_HEADERS_COMPLETE: | 184 case STATE_READ_HEADERS_COMPLETE: |
184 net_log_.EndEvent(NetLog::TYPE_SPDY_TRANSACTION_READ_HEADERS); | 185 net_log_.EndEvent(NetLog::TYPE_SPDY_TRANSACTION_READ_HEADERS, NULL); |
185 rv = DoReadHeadersComplete(rv); | 186 rv = DoReadHeadersComplete(rv); |
186 break; | 187 break; |
187 case STATE_READ_BODY: | 188 case STATE_READ_BODY: |
188 DCHECK_EQ(OK, rv); | 189 DCHECK_EQ(OK, rv); |
189 net_log_.BeginEvent(NetLog::TYPE_SPDY_TRANSACTION_READ_BODY); | 190 net_log_.BeginEvent(NetLog::TYPE_SPDY_TRANSACTION_READ_BODY, NULL); |
190 rv = DoReadBody(); | 191 rv = DoReadBody(); |
191 break; | 192 break; |
192 case STATE_READ_BODY_COMPLETE: | 193 case STATE_READ_BODY_COMPLETE: |
193 net_log_.EndEvent(NetLog::TYPE_SPDY_TRANSACTION_READ_BODY); | 194 net_log_.EndEvent(NetLog::TYPE_SPDY_TRANSACTION_READ_BODY, NULL); |
194 rv = DoReadBodyComplete(rv); | 195 rv = DoReadBodyComplete(rv); |
195 break; | 196 break; |
196 case STATE_NONE: | 197 case STATE_NONE: |
197 rv = ERR_FAILED; | 198 rv = ERR_FAILED; |
198 break; | 199 break; |
199 default: | 200 default: |
200 NOTREACHED() << "bad state"; | 201 NOTREACHED() << "bad state"; |
201 rv = ERR_FAILED; | 202 rv = ERR_FAILED; |
202 break; | 203 break; |
203 } | 204 } |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
290 user_buffer_ = NULL; | 291 user_buffer_ = NULL; |
291 user_buffer_len_ = 0; | 292 user_buffer_len_ = 0; |
292 | 293 |
293 if (result <= 0) | 294 if (result <= 0) |
294 stream_ = NULL; | 295 stream_ = NULL; |
295 | 296 |
296 return result; | 297 return result; |
297 } | 298 } |
298 | 299 |
299 } // namespace net | 300 } // namespace net |
OLD | NEW |