| OLD | NEW |
| 1 // Copyright (c) 20010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 20010 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/blob/blob_url_request_job.h" | 5 #include "webkit/blob/blob_url_request_job.h" |
| 6 | 6 |
| 7 #include "base/compiler_specific.h" | 7 #include "base/compiler_specific.h" |
| 8 #include "base/file_path.h" | 8 #include "base/file_path.h" |
| 9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
| 10 #include "base/file_util_proxy.h" | 10 #include "base/file_util_proxy.h" |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 static const char kHTTPNotFoundText[] = "Not Found"; | 37 static const char kHTTPNotFoundText[] = "Not Found"; |
| 38 static const char kHTTPMethodNotAllowText[] = "Method Not Allowed"; | 38 static const char kHTTPMethodNotAllowText[] = "Method Not Allowed"; |
| 39 static const char kHTTPRequestedRangeNotSatisfiableText[] = | 39 static const char kHTTPRequestedRangeNotSatisfiableText[] = |
| 40 "Requested Range Not Satisfiable"; | 40 "Requested Range Not Satisfiable"; |
| 41 static const char kHTTPInternalErrorText[] = "Internal Server Error"; | 41 static const char kHTTPInternalErrorText[] = "Internal Server Error"; |
| 42 | 42 |
| 43 BlobURLRequestJob::BlobURLRequestJob( | 43 BlobURLRequestJob::BlobURLRequestJob( |
| 44 net::URLRequest* request, | 44 net::URLRequest* request, |
| 45 BlobData* blob_data, | 45 BlobData* blob_data, |
| 46 base::MessageLoopProxy* file_thread_proxy) | 46 base::MessageLoopProxy* file_thread_proxy) |
| 47 : URLRequestJob(request), | 47 : net::URLRequestJob(request), |
| 48 callback_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)), | 48 callback_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)), |
| 49 blob_data_(blob_data), | 49 blob_data_(blob_data), |
| 50 file_thread_proxy_(file_thread_proxy), | 50 file_thread_proxy_(file_thread_proxy), |
| 51 ALLOW_THIS_IN_INITIALIZER_LIST( | 51 ALLOW_THIS_IN_INITIALIZER_LIST( |
| 52 io_callback_(this, &BlobURLRequestJob::DidRead)), | 52 io_callback_(this, &BlobURLRequestJob::DidRead)), |
| 53 item_index_(0), | 53 item_index_(0), |
| 54 total_size_(0), | 54 total_size_(0), |
| 55 current_item_offset_(0), | 55 current_item_offset_(0), |
| 56 remaining_bytes_(0), | 56 remaining_bytes_(0), |
| 57 read_buf_offset_(0), | 57 read_buf_offset_(0), |
| (...skipping 27 matching lines...) Expand all Loading... |
| 85 NotifyFailure(net::ERR_FILE_NOT_FOUND); | 85 NotifyFailure(net::ERR_FILE_NOT_FOUND); |
| 86 return; | 86 return; |
| 87 } | 87 } |
| 88 | 88 |
| 89 CountSize(); | 89 CountSize(); |
| 90 } | 90 } |
| 91 | 91 |
| 92 void BlobURLRequestJob::Kill() { | 92 void BlobURLRequestJob::Kill() { |
| 93 stream_.Close(); | 93 stream_.Close(); |
| 94 | 94 |
| 95 URLRequestJob::Kill(); | 95 net::URLRequestJob::Kill(); |
| 96 callback_factory_.RevokeAll(); | 96 callback_factory_.RevokeAll(); |
| 97 method_factory_.RevokeAll(); | 97 method_factory_.RevokeAll(); |
| 98 } | 98 } |
| 99 | 99 |
| 100 void BlobURLRequestJob::ResolveFile(const FilePath& file_path) { | 100 void BlobURLRequestJob::ResolveFile(const FilePath& file_path) { |
| 101 // If the file thread proxy is provided, we can use it get the file info. | 101 // If the file thread proxy is provided, we can use it get the file info. |
| 102 if (file_thread_proxy_) { | 102 if (file_thread_proxy_) { |
| 103 base::FileUtilProxy::GetFileInfo( | 103 base::FileUtilProxy::GetFileInfo( |
| 104 file_thread_proxy_, | 104 file_thread_proxy_, |
| 105 file_path, | 105 file_path, |
| (...skipping 429 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 535 // We don't support multiple range requests in one single URL request, | 535 // We don't support multiple range requests in one single URL request, |
| 536 // because we need to do multipart encoding here. | 536 // because we need to do multipart encoding here. |
| 537 // TODO(jianli): Support multipart byte range requests. | 537 // TODO(jianli): Support multipart byte range requests. |
| 538 NotifyFailure(net::ERR_REQUEST_RANGE_NOT_SATISFIABLE); | 538 NotifyFailure(net::ERR_REQUEST_RANGE_NOT_SATISFIABLE); |
| 539 } | 539 } |
| 540 } | 540 } |
| 541 } | 541 } |
| 542 } | 542 } |
| 543 | 543 |
| 544 } // namespace webkit_blob | 544 } // namespace webkit_blob |
| OLD | NEW |