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/loader/async_resource_handler.h" | 5 #include "content/browser/loader/async_resource_handler.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 495 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
506 | 506 |
507 int error_code = status.error(); | 507 int error_code = status.error(); |
508 bool was_ignored_by_handler = info->WasIgnoredByHandler(); | 508 bool was_ignored_by_handler = info->WasIgnoredByHandler(); |
509 | 509 |
510 DCHECK(status.status() != net::URLRequestStatus::IO_PENDING); | 510 DCHECK(status.status() != net::URLRequestStatus::IO_PENDING); |
511 // If this check fails, then we're in an inconsistent state because all | 511 // If this check fails, then we're in an inconsistent state because all |
512 // requests ignored by the handler should be canceled (which should result in | 512 // requests ignored by the handler should be canceled (which should result in |
513 // the ERR_ABORTED error code). | 513 // the ERR_ABORTED error code). |
514 DCHECK(!was_ignored_by_handler || error_code == net::ERR_ABORTED); | 514 DCHECK(!was_ignored_by_handler || error_code == net::ERR_ABORTED); |
515 | 515 |
516 // TODO(mkosiba): Fix up cases where we create a URLRequestStatus | |
517 // with a status() != SUCCESS and an error_code() == net::OK. | |
518 if (status.status() == net::URLRequestStatus::CANCELED && | |
519 error_code == net::OK) { | |
520 error_code = net::ERR_ABORTED; | |
521 } else if (status.status() == net::URLRequestStatus::FAILED && | |
522 error_code == net::OK) { | |
523 error_code = net::ERR_FAILED; | |
524 } | |
525 | |
526 ResourceRequestCompletionStatus request_complete_data; | 516 ResourceRequestCompletionStatus request_complete_data; |
527 request_complete_data.error_code = error_code; | 517 request_complete_data.error_code = error_code; |
528 request_complete_data.was_ignored_by_handler = was_ignored_by_handler; | 518 request_complete_data.was_ignored_by_handler = was_ignored_by_handler; |
529 request_complete_data.exists_in_cache = request()->response_info().was_cached; | 519 request_complete_data.exists_in_cache = request()->response_info().was_cached; |
530 request_complete_data.security_info = security_info; | 520 request_complete_data.security_info = security_info; |
531 request_complete_data.completion_time = TimeTicks::Now(); | 521 request_complete_data.completion_time = TimeTicks::Now(); |
532 request_complete_data.encoded_data_length = | 522 request_complete_data.encoded_data_length = |
533 request()->GetTotalReceivedBytes(); | 523 request()->GetTotalReceivedBytes(); |
534 info->filter()->Send( | 524 info->filter()->Send( |
535 new ResourceMsg_RequestComplete(GetRequestID(), request_complete_data)); | 525 new ResourceMsg_RequestComplete(GetRequestID(), request_complete_data)); |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
601 } else { | 591 } else { |
602 UMA_HISTOGRAM_CUSTOM_COUNTS( | 592 UMA_HISTOGRAM_CUSTOM_COUNTS( |
603 "Net.ResourceLoader.ResponseStartToEnd.Over_512kB", | 593 "Net.ResourceLoader.ResponseStartToEnd.Over_512kB", |
604 elapsed_time, 1, 100000, 100); | 594 elapsed_time, 1, 100000, 100); |
605 } | 595 } |
606 | 596 |
607 inlining_helper_->RecordHistogram(elapsed_time); | 597 inlining_helper_->RecordHistogram(elapsed_time); |
608 } | 598 } |
609 | 599 |
610 } // namespace content | 600 } // namespace content |
OLD | NEW |