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 "webkit/fileapi/file_system_url_request_job.h" | 5 #include "webkit/fileapi/file_system_url_request_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 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
195 if (is_directory_) { | 195 if (is_directory_) { |
196 NotifyHeadersComplete(); | 196 NotifyHeadersComplete(); |
197 return; | 197 return; |
198 } | 198 } |
199 | 199 |
200 remaining_bytes_ = byte_range_.last_byte_position() - | 200 remaining_bytes_ = byte_range_.last_byte_position() - |
201 byte_range_.first_byte_position() + 1; | 201 byte_range_.first_byte_position() + 1; |
202 DCHECK_GE(remaining_bytes_, 0); | 202 DCHECK_GE(remaining_bytes_, 0); |
203 | 203 |
204 DCHECK(!reader_.get()); | 204 DCHECK(!reader_.get()); |
205 reader_.reset( | 205 reader_ = file_system_context_->CreateFileStreamReader( |
206 file_system_context_->CreateFileStreamReader( | 206 url_, byte_range_.first_byte_position(), base::Time()); |
207 url_, | |
208 byte_range_.first_byte_position(), | |
209 base::Time())); | |
210 | 207 |
211 set_expected_content_size(remaining_bytes_); | 208 set_expected_content_size(remaining_bytes_); |
212 response_info_.reset(new net::HttpResponseInfo()); | 209 response_info_.reset(new net::HttpResponseInfo()); |
213 response_info_->headers = CreateHttpResponseHeaders(); | 210 response_info_->headers = CreateHttpResponseHeaders(); |
214 NotifyHeadersComplete(); | 211 NotifyHeadersComplete(); |
215 } | 212 } |
216 | 213 |
217 void FileSystemURLRequestJob::DidRead(int result) { | 214 void FileSystemURLRequestJob::DidRead(int result) { |
218 if (result > 0) | 215 if (result > 0) |
219 SetStatus(URLRequestStatus()); // Clear the IO_PENDING status | 216 SetStatus(URLRequestStatus()); // Clear the IO_PENDING status |
(...skipping 23 matching lines...) Expand all Loading... |
243 } | 240 } |
244 | 241 |
245 return false; | 242 return false; |
246 } | 243 } |
247 | 244 |
248 void FileSystemURLRequestJob::NotifyFailed(int rv) { | 245 void FileSystemURLRequestJob::NotifyFailed(int rv) { |
249 NotifyDone(URLRequestStatus(URLRequestStatus::FAILED, rv)); | 246 NotifyDone(URLRequestStatus(URLRequestStatus::FAILED, rv)); |
250 } | 247 } |
251 | 248 |
252 } // namespace fileapi | 249 } // namespace fileapi |
OLD | NEW |