| 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/url_request/url_request_simple_job.h" | 5 #include "net/url_request/url_request_simple_job.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 // TODO(vadimt): Remove ScopedProfile below once crbug.com/422489 is fixed. | 93 // TODO(vadimt): Remove ScopedProfile below once crbug.com/422489 is fixed. |
| 94 tracked_objects::ScopedProfile tracking_profile( | 94 tracked_objects::ScopedProfile tracking_profile( |
| 95 FROM_HERE_WITH_EXPLICIT_FUNCTION( | 95 FROM_HERE_WITH_EXPLICIT_FUNCTION( |
| 96 "422489 URLRequestSimpleJob::StartAsync 3")); | 96 "422489 URLRequestSimpleJob::StartAsync 3")); |
| 97 | 97 |
| 98 OnGetDataCompleted(result); | 98 OnGetDataCompleted(result); |
| 99 } | 99 } |
| 100 } | 100 } |
| 101 | 101 |
| 102 void URLRequestSimpleJob::OnGetDataCompleted(int result) { | 102 void URLRequestSimpleJob::OnGetDataCompleted(int result) { |
| 103 // TODO(vadimt): Remove ScopedProfile below once crbug.com/422489 is fixed. |
| 104 tracked_objects::ScopedProfile tracking_profile( |
| 105 FROM_HERE_WITH_EXPLICIT_FUNCTION( |
| 106 "422489 URLRequestSimpleJob::OnGetDataCompleted")); |
| 107 |
| 103 if (result == OK) { | 108 if (result == OK) { |
| 104 // Notify that the headers are complete | 109 // Notify that the headers are complete |
| 105 if (!byte_range_.ComputeBounds(data_.size())) { | 110 if (!byte_range_.ComputeBounds(data_.size())) { |
| 106 NotifyDone(URLRequestStatus(URLRequestStatus::FAILED, | 111 NotifyDone(URLRequestStatus(URLRequestStatus::FAILED, |
| 107 ERR_REQUEST_RANGE_NOT_SATISFIABLE)); | 112 ERR_REQUEST_RANGE_NOT_SATISFIABLE)); |
| 108 return; | 113 return; |
| 109 } | 114 } |
| 110 | 115 |
| 111 data_offset_ = byte_range_.first_byte_position(); | 116 data_offset_ = byte_range_.first_byte_position(); |
| 112 int remaining_bytes = byte_range_.last_byte_position() - | 117 int remaining_bytes = byte_range_.last_byte_position() - |
| 113 byte_range_.first_byte_position() + 1; | 118 byte_range_.first_byte_position() + 1; |
| 114 set_expected_content_size(remaining_bytes); | 119 set_expected_content_size(remaining_bytes); |
| 115 NotifyHeadersComplete(); | 120 NotifyHeadersComplete(); |
| 116 } else { | 121 } else { |
| 117 NotifyStartError(URLRequestStatus(URLRequestStatus::FAILED, result)); | 122 NotifyStartError(URLRequestStatus(URLRequestStatus::FAILED, result)); |
| 118 } | 123 } |
| 119 } | 124 } |
| 120 | 125 |
| 121 } // namespace net | 126 } // namespace net |
| OLD | NEW |