| 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 #ifndef WEBKIT_BLOB_BLOB_URL_REQUEST_JOB_H_ | 5 #ifndef WEBKIT_BLOB_BLOB_URL_REQUEST_JOB_H_ |
| 6 #define WEBKIT_BLOB_BLOB_URL_REQUEST_JOB_H_ | 6 #define WEBKIT_BLOB_BLOB_URL_REQUEST_JOB_H_ |
| 7 | 7 |
| 8 #include "base/platform_file.h" | 8 #include "base/platform_file.h" |
| 9 #include "base/ref_counted.h" | 9 #include "base/ref_counted.h" |
| 10 #include "base/scoped_callback_factory.h" | 10 #include "base/scoped_callback_factory.h" |
| 11 #include "base/scoped_ptr.h" | 11 #include "base/scoped_ptr.h" |
| 12 #include "net/base/completion_callback.h" | 12 #include "net/base/completion_callback.h" |
| 13 #include "net/base/file_stream.h" | 13 #include "net/base/file_stream.h" |
| 14 #include "net/http/http_byte_range.h" | 14 #include "net/http/http_byte_range.h" |
| 15 #include "net/url_request/url_request_job.h" | 15 #include "net/url_request/url_request_job.h" |
| 16 #include "webkit/blob/blob_data.h" | 16 #include "webkit/blob/blob_data.h" |
| 17 | 17 |
| 18 namespace base { | 18 namespace base { |
| 19 class MessageLoopProxy; | 19 class MessageLoopProxy; |
| 20 } | 20 struct PlatformFileInfo; |
| 21 | |
| 22 namespace file_util { | |
| 23 struct FileInfo; | |
| 24 } | 21 } |
| 25 | 22 |
| 26 namespace webkit_blob { | 23 namespace webkit_blob { |
| 27 | 24 |
| 28 // A request job that handles reading blob URLs. | 25 // A request job that handles reading blob URLs. |
| 29 class BlobURLRequestJob : public URLRequestJob { | 26 class BlobURLRequestJob : public URLRequestJob { |
| 30 public: | 27 public: |
| 31 BlobURLRequestJob(URLRequest* request, | 28 BlobURLRequestJob(URLRequest* request, |
| 32 BlobData* blob_data, | 29 BlobData* blob_data, |
| 33 base::MessageLoopProxy* resolving_message_loop_proxy); | 30 base::MessageLoopProxy* resolving_message_loop_proxy); |
| (...skipping 18 matching lines...) Expand all Loading... |
| 52 bool ReadItem(); | 49 bool ReadItem(); |
| 53 bool ReadBytes(const BlobData::Item& item, int bytes_to_read); | 50 bool ReadBytes(const BlobData::Item& item, int bytes_to_read); |
| 54 bool ReadFile(const BlobData::Item& item, int bytes_to_read); | 51 bool ReadFile(const BlobData::Item& item, int bytes_to_read); |
| 55 void HeadersCompleted(int status_code, const std::string& status_txt); | 52 void HeadersCompleted(int status_code, const std::string& status_txt); |
| 56 int ReadCompleted(); | 53 int ReadCompleted(); |
| 57 void NotifySuccess(); | 54 void NotifySuccess(); |
| 58 void NotifyFailure(int); | 55 void NotifyFailure(int); |
| 59 | 56 |
| 60 void DidStart(); | 57 void DidStart(); |
| 61 void DidResolve(base::PlatformFileError rv, | 58 void DidResolve(base::PlatformFileError rv, |
| 62 const file_util::FileInfo& file_info); | 59 const base::PlatformFileInfo& file_info); |
| 63 void DidRead(int result); | 60 void DidRead(int result); |
| 64 | 61 |
| 65 base::ScopedCallbackFactory<BlobURLRequestJob> callback_factory_; | 62 base::ScopedCallbackFactory<BlobURLRequestJob> callback_factory_; |
| 66 scoped_refptr<BlobData> blob_data_; | 63 scoped_refptr<BlobData> blob_data_; |
| 67 scoped_refptr<base::MessageLoopProxy> file_thread_proxy_; | 64 scoped_refptr<base::MessageLoopProxy> file_thread_proxy_; |
| 68 net::CompletionCallbackImpl<BlobURLRequestJob> io_callback_; | 65 net::CompletionCallbackImpl<BlobURLRequestJob> io_callback_; |
| 69 std::vector<int64> item_length_list_; | 66 std::vector<int64> item_length_list_; |
| 70 net::FileStream stream_; | 67 net::FileStream stream_; |
| 71 size_t item_index_; | 68 size_t item_index_; |
| 72 int64 total_size_; | 69 int64 total_size_; |
| 73 int64 current_item_offset_; | 70 int64 current_item_offset_; |
| 74 int64 remaining_bytes_; | 71 int64 remaining_bytes_; |
| 75 scoped_refptr<net::IOBuffer> read_buf_; | 72 scoped_refptr<net::IOBuffer> read_buf_; |
| 76 int read_buf_offset_; | 73 int read_buf_offset_; |
| 77 int read_buf_size_; | 74 int read_buf_size_; |
| 78 int read_buf_remaining_bytes_; | 75 int read_buf_remaining_bytes_; |
| 79 bool error_; | 76 bool error_; |
| 80 bool headers_set_; | 77 bool headers_set_; |
| 81 bool byte_range_set_; | 78 bool byte_range_set_; |
| 82 net::HttpByteRange byte_range_; | 79 net::HttpByteRange byte_range_; |
| 83 scoped_ptr<net::HttpResponseInfo> response_info_; | 80 scoped_ptr<net::HttpResponseInfo> response_info_; |
| 84 | 81 |
| 85 DISALLOW_COPY_AND_ASSIGN(BlobURLRequestJob); | 82 DISALLOW_COPY_AND_ASSIGN(BlobURLRequestJob); |
| 86 }; | 83 }; |
| 87 | 84 |
| 88 } // namespace webkit_blob | 85 } // namespace webkit_blob |
| 89 | 86 |
| 90 #endif // WEBKIT_BLOB_BLOB_URL_REQUEST_JOB_H_ | 87 #endif // WEBKIT_BLOB_BLOB_URL_REQUEST_JOB_H_ |
| OLD | NEW |