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 29 matching lines...) Expand all Loading... |
40 | 40 |
41 bool URLRequestSimpleJob::GetCharset(std::string* charset) { | 41 bool URLRequestSimpleJob::GetCharset(std::string* charset) { |
42 *charset = charset_; | 42 *charset = charset_; |
43 return true; | 43 return true; |
44 } | 44 } |
45 | 45 |
46 URLRequestSimpleJob::~URLRequestSimpleJob() {} | 46 URLRequestSimpleJob::~URLRequestSimpleJob() {} |
47 | 47 |
48 bool URLRequestSimpleJob::ReadRawData(IOBuffer* buf, int buf_size, | 48 bool URLRequestSimpleJob::ReadRawData(IOBuffer* buf, int buf_size, |
49 int* bytes_read) { | 49 int* bytes_read) { |
| 50 // TODO(vadimt): Remove ScopedTracker below once crbug.com/422489 is fixed. |
| 51 tracked_objects::ScopedTracker tracking_profile( |
| 52 FROM_HERE_WITH_EXPLICIT_FUNCTION( |
| 53 "422489 URLRequestSimpleJob::ReadRawData")); |
| 54 |
50 DCHECK(bytes_read); | 55 DCHECK(bytes_read); |
51 int remaining = byte_range_.last_byte_position() - data_offset_ + 1; | 56 int remaining = byte_range_.last_byte_position() - data_offset_ + 1; |
52 if (buf_size > remaining) | 57 if (buf_size > remaining) |
53 buf_size = remaining; | 58 buf_size = remaining; |
54 memcpy(buf->data(), data_->front() + data_offset_, buf_size); | 59 memcpy(buf->data(), data_->front() + data_offset_, buf_size); |
55 data_offset_ += buf_size; | 60 data_offset_ += buf_size; |
56 *bytes_read = buf_size; | 61 *bytes_read = buf_size; |
57 return true; | 62 return true; |
58 } | 63 } |
59 | 64 |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
136 int remaining_bytes = byte_range_.last_byte_position() - | 141 int remaining_bytes = byte_range_.last_byte_position() - |
137 byte_range_.first_byte_position() + 1; | 142 byte_range_.first_byte_position() + 1; |
138 set_expected_content_size(remaining_bytes); | 143 set_expected_content_size(remaining_bytes); |
139 NotifyHeadersComplete(); | 144 NotifyHeadersComplete(); |
140 } else { | 145 } else { |
141 NotifyStartError(URLRequestStatus(URLRequestStatus::FAILED, result)); | 146 NotifyStartError(URLRequestStatus(URLRequestStatus::FAILED, result)); |
142 } | 147 } |
143 } | 148 } |
144 | 149 |
145 } // namespace net | 150 } // namespace net |
OLD | NEW |