Chromium Code Reviews| 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 "content/browser/renderer_host/async_resource_handler.h" | 5 #include "content/browser/renderer_host/async_resource_handler.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/debug/alias.h" | 10 #include "base/debug/alias.h" |
| (...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 281 int request_id, | 281 int request_id, |
| 282 const net::URLRequestStatus& status, | 282 const net::URLRequestStatus& status, |
| 283 const std::string& security_info) { | 283 const std::string& security_info) { |
| 284 // If we crash here, figure out what URL the renderer was requesting. | 284 // If we crash here, figure out what URL the renderer was requesting. |
| 285 // http://crbug.com/107692 | 285 // http://crbug.com/107692 |
| 286 char url_buf[128]; | 286 char url_buf[128]; |
| 287 base::strlcpy(url_buf, request_->url().spec().c_str(), arraysize(url_buf)); | 287 base::strlcpy(url_buf, request_->url().spec().c_str(), arraysize(url_buf)); |
| 288 base::debug::Alias(url_buf); | 288 base::debug::Alias(url_buf); |
| 289 | 289 |
| 290 TimeTicks completion_time = TimeTicks::Now(); | 290 TimeTicks completion_time = TimeTicks::Now(); |
| 291 | |
| 292 int error_code = status.error(); | |
| 293 if (status.status() == net::URLRequestStatus::IO_PENDING) | |
| 294 error_code = net::ERR_IO_PENDING; | |
| 295 else if (status.status() == net::URLRequestStatus::CANCELED && | |
| 296 error_code == net::OK) | |
| 297 error_code = net::ERR_ABORTED; | |
| 298 else if (status.status() == net::URLRequestStatus::FAILED && | |
| 299 error_code == net::OK) | |
| 300 error_code = net::ERR_FAILED; | |
|
mkosiba (inactive)
2012/06/26 17:01:42
I was going back and forth on whether to do this h
| |
| 291 filter_->Send(new ResourceMsg_RequestComplete(routing_id_, | 301 filter_->Send(new ResourceMsg_RequestComplete(routing_id_, |
| 292 request_id, | 302 request_id, |
| 293 status, | 303 error_code, |
| 294 security_info, | 304 security_info, |
| 295 completion_time)); | 305 completion_time)); |
| 296 | 306 |
| 297 // If we still have a read buffer, then see about caching it for later... | 307 // If we still have a read buffer, then see about caching it for later... |
| 298 // Note that we have to make sure the buffer is not still being used, so we | 308 // Note that we have to make sure the buffer is not still being used, so we |
| 299 // have to perform an explicit check on the status code. | 309 // have to perform an explicit check on the status code. |
| 300 if (g_spare_read_buffer || | 310 if (g_spare_read_buffer || |
| 301 net::URLRequestStatus::SUCCESS != status.status()) { | 311 net::URLRequestStatus::SUCCESS != status.status()) { |
| 302 read_buffer_ = NULL; | 312 read_buffer_ = NULL; |
| 303 } else if (read_buffer_.get()) { | 313 } else if (read_buffer_.get()) { |
| (...skipping 26 matching lines...) Expand all Loading... | |
| 330 } | 340 } |
| 331 | 341 |
| 332 void AsyncResourceHandler::ResumeIfDeferred() { | 342 void AsyncResourceHandler::ResumeIfDeferred() { |
| 333 if (did_defer_) { | 343 if (did_defer_) { |
| 334 did_defer_ = false; | 344 did_defer_ = false; |
| 335 controller()->Resume(); | 345 controller()->Resume(); |
| 336 } | 346 } |
| 337 } | 347 } |
| 338 | 348 |
| 339 } // namespace content | 349 } // namespace content |
| OLD | NEW |