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 #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/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "base/memory/weak_ptr.h" | 9 #include "base/memory/weak_ptr.h" |
10 #include "base/platform_file.h" | 10 #include "base/platform_file.h" |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 void GetFileItemInfo(const FilePath& file_path); | 53 void GetFileItemInfo(const FilePath& file_path); |
54 void DidGetFileItemInfo(base::PlatformFileError rv, | 54 void DidGetFileItemInfo(base::PlatformFileError rv, |
55 const base::PlatformFileInfo& file_info); | 55 const base::PlatformFileInfo& file_info); |
56 void Seek(int64 offset); | 56 void Seek(int64 offset); |
57 | 57 |
58 // For reading the blob. | 58 // For reading the blob. |
59 bool ReadLoop(int* bytes_read); | 59 bool ReadLoop(int* bytes_read); |
60 bool ReadItem(); | 60 bool ReadItem(); |
61 void AdvanceItem(); | 61 void AdvanceItem(); |
62 void AdvanceBytesRead(int result); | 62 void AdvanceBytesRead(int result); |
63 bool ReadBytes(const BlobData::Item& item); | 63 bool ReadBytesItem(const BlobData::Item& item); |
64 bool DispatchReadFile(const BlobData::Item& item); | 64 bool ReadFileItem(const BlobData::Item& item); |
65 | 65 |
66 void DidOpen(base::PlatformFileError rv, | 66 void DidOpenFile(base::PlatformFileError rv, |
67 base::PassPlatformFile file, | 67 base::PassPlatformFile file, |
68 bool created); | 68 bool created); |
69 bool ReadFile(); | 69 bool ReadFileStream(); |
70 void DidRead(int result); | 70 void DidReadFileStream(int result); |
71 void CloseStream(); | 71 void CloseFileStream(); |
72 | 72 |
73 int ComputeBytesToRead() const; | 73 int ComputeBytesToRead() const; |
74 int ReadCompleted(); | 74 int BytesReadCompleted(); |
75 | 75 |
76 void NotifySuccess(); | 76 void NotifySuccess(); |
77 void NotifyFailure(int); | 77 void NotifyFailure(int); |
78 void HeadersCompleted(int status_code, const std::string& status_txt); | 78 void HeadersCompleted(int status_code, const std::string& status_txt); |
79 | 79 |
80 base::WeakPtrFactory<BlobURLRequestJob> weak_factory_; | 80 base::WeakPtrFactory<BlobURLRequestJob> weak_factory_; |
81 scoped_refptr<BlobData> blob_data_; | 81 scoped_refptr<BlobData> blob_data_; |
82 scoped_refptr<base::MessageLoopProxy> file_thread_proxy_; | 82 scoped_refptr<base::MessageLoopProxy> file_thread_proxy_; |
83 std::vector<int64> item_length_list_; | 83 std::vector<int64> item_length_list_; |
84 scoped_ptr<net::FileStream> stream_; | 84 scoped_ptr<net::FileStream> stream_; |
85 size_t item_index_; | 85 size_t item_index_; |
86 int64 total_size_; | 86 int64 total_size_; |
87 int64 current_item_offset_; | 87 int64 current_item_offset_; |
88 int64 remaining_bytes_; | 88 int64 remaining_bytes_; |
89 scoped_refptr<net::DrainableIOBuffer> read_buf_; | 89 scoped_refptr<net::DrainableIOBuffer> read_buf_; |
90 int bytes_to_read_; | 90 int bytes_to_read_; |
91 bool error_; | 91 bool error_; |
92 bool headers_set_; | 92 bool headers_set_; |
93 bool byte_range_set_; | 93 bool byte_range_set_; |
94 net::HttpByteRange byte_range_; | 94 net::HttpByteRange byte_range_; |
95 scoped_ptr<net::HttpResponseInfo> response_info_; | 95 scoped_ptr<net::HttpResponseInfo> response_info_; |
96 | 96 |
97 DISALLOW_COPY_AND_ASSIGN(BlobURLRequestJob); | 97 DISALLOW_COPY_AND_ASSIGN(BlobURLRequestJob); |
98 }; | 98 }; |
99 | 99 |
100 } // namespace webkit_blob | 100 } // namespace webkit_blob |
101 | 101 |
102 #endif // WEBKIT_BLOB_BLOB_URL_REQUEST_JOB_H_ | 102 #endif // WEBKIT_BLOB_BLOB_URL_REQUEST_JOB_H_ |
OLD | NEW |