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/proxy/proxy_script_fetcher_impl.h" | 5 #include "net/proxy/proxy_script_fetcher_impl.h" |
6 | 6 |
7 #include "base/compiler_specific.h" | 7 #include "base/compiler_specific.h" |
8 #include "base/i18n/icu_string_conversions.h" | 8 #include "base/i18n/icu_string_conversions.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
243 if (ConsumeBytesRead(request, num_bytes)) { | 243 if (ConsumeBytesRead(request, num_bytes)) { |
244 // Keep reading. | 244 // Keep reading. |
245 ReadBody(request); | 245 ReadBody(request); |
246 } | 246 } |
247 } | 247 } |
248 | 248 |
249 void ProxyScriptFetcherImpl::ReadBody(URLRequest* request) { | 249 void ProxyScriptFetcherImpl::ReadBody(URLRequest* request) { |
250 // Read as many bytes as are available synchronously. | 250 // Read as many bytes as are available synchronously. |
251 while (true) { | 251 while (true) { |
252 int num_bytes; | 252 int num_bytes; |
253 if (!request->Read(buf_, kBufSize, &num_bytes)) { | 253 if (!request->Read(buf_.get(), kBufSize, &num_bytes)) { |
254 // Check whether the read failed synchronously. | 254 // Check whether the read failed synchronously. |
255 if (!request->status().is_io_pending()) | 255 if (!request->status().is_io_pending()) |
256 OnResponseCompleted(request); | 256 OnResponseCompleted(request); |
257 return; | 257 return; |
258 } | 258 } |
259 if (!ConsumeBytesRead(request, num_bytes)) | 259 if (!ConsumeBytesRead(request, num_bytes)) |
260 return; | 260 return; |
261 } | 261 } |
262 } | 262 } |
263 | 263 |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
313 // is still applicable. | 313 // is still applicable. |
314 if (cur_request_id_ != id) | 314 if (cur_request_id_ != id) |
315 return; | 315 return; |
316 | 316 |
317 DCHECK(cur_request_.get()); | 317 DCHECK(cur_request_.get()); |
318 result_code_ = ERR_TIMED_OUT; | 318 result_code_ = ERR_TIMED_OUT; |
319 cur_request_->Cancel(); | 319 cur_request_->Cancel(); |
320 } | 320 } |
321 | 321 |
322 } // namespace net | 322 } // namespace net |
OLD | NEW |