| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 STORAGE_BROWSER_BLOB_BLOB_READER_H_ | 5 #ifndef STORAGE_BROWSER_BLOB_BLOB_READER_H_ |
| 6 #define STORAGE_BROWSER_BLOB_BLOB_READER_H_ | 6 #define STORAGE_BROWSER_BLOB_BLOB_READER_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 #include <map> | 9 #include <map> |
| 10 #include <vector> | 10 #include <vector> |
| 11 | 11 |
| 12 #include "base/macros.h" | 12 #include "base/macros.h" |
| 13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
| 14 #include "base/memory/weak_ptr.h" | 14 #include "base/memory/weak_ptr.h" |
| 15 #include "net/base/completion_callback.h" | 15 #include "net/base/completion_callback.h" |
| 16 #include "net/base/net_errors.h" |
| 16 #include "storage/browser/storage_browser_export.h" | 17 #include "storage/browser/storage_browser_export.h" |
| 17 | 18 |
| 18 class GURL; | 19 class GURL; |
| 19 | 20 |
| 20 namespace base { | 21 namespace base { |
| 21 class FilePath; | 22 class FilePath; |
| 22 class SequencedTaskRunner; | 23 class SequencedTaskRunner; |
| 23 class TaskRunner; | 24 class TaskRunner; |
| 24 class Time; | 25 class Time; |
| 25 } | 26 } |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 156 void SetFileReaderAtIndex(size_t index, scoped_ptr<FileStreamReader> reader); | 157 void SetFileReaderAtIndex(size_t index, scoped_ptr<FileStreamReader> reader); |
| 157 // Creates a FileStreamReader for the item with additional_offset. | 158 // Creates a FileStreamReader for the item with additional_offset. |
| 158 scoped_ptr<FileStreamReader> CreateFileStreamReader( | 159 scoped_ptr<FileStreamReader> CreateFileStreamReader( |
| 159 const BlobDataItem& item, | 160 const BlobDataItem& item, |
| 160 uint64_t additional_offset); | 161 uint64_t additional_offset); |
| 161 | 162 |
| 162 scoped_ptr<BlobDataSnapshot> blob_data_; | 163 scoped_ptr<BlobDataSnapshot> blob_data_; |
| 163 scoped_ptr<FileStreamReaderProvider> file_stream_provider_; | 164 scoped_ptr<FileStreamReaderProvider> file_stream_provider_; |
| 164 scoped_refptr<base::SequencedTaskRunner> file_task_runner_; | 165 scoped_refptr<base::SequencedTaskRunner> file_task_runner_; |
| 165 | 166 |
| 166 int net_error_; | 167 int net_error_ = net::OK; |
| 167 bool item_list_populated_ = false; | |
| 168 std::vector<uint64_t> item_length_list_; | 168 std::vector<uint64_t> item_length_list_; |
| 169 | 169 |
| 170 scoped_refptr<net::DrainableIOBuffer> read_buf_; | 170 scoped_refptr<net::DrainableIOBuffer> read_buf_; |
| 171 | 171 |
| 172 bool total_size_calculated_ = false; | 172 bool total_size_calculated_ = false; |
| 173 uint64_t total_size_ = 0; | 173 uint64_t total_size_ = 0; |
| 174 uint64_t remaining_bytes_ = 0; | 174 uint64_t remaining_bytes_ = 0; |
| 175 size_t pending_get_file_info_count_ = 0; | 175 size_t pending_get_file_info_count_ = 0; |
| 176 std::map<size_t, FileStreamReader*> index_to_reader_; | 176 std::map<size_t, scoped_ptr<FileStreamReader>> index_to_reader_; |
| 177 size_t current_item_index_ = 0; | 177 size_t current_item_index_ = 0; |
| 178 uint64_t current_item_offset_ = 0; | 178 uint64_t current_item_offset_ = 0; |
| 179 | 179 |
| 180 bool io_pending_ = false; | 180 bool io_pending_ = false; |
| 181 | 181 |
| 182 net::CompletionCallback size_callback_; | 182 net::CompletionCallback size_callback_; |
| 183 net::CompletionCallback read_callback_; | 183 net::CompletionCallback read_callback_; |
| 184 | 184 |
| 185 base::WeakPtrFactory<BlobReader> weak_factory_; | 185 base::WeakPtrFactory<BlobReader> weak_factory_; |
| 186 DISALLOW_COPY_AND_ASSIGN(BlobReader); | 186 DISALLOW_COPY_AND_ASSIGN(BlobReader); |
| 187 }; | 187 }; |
| 188 | 188 |
| 189 } // namespace storage | 189 } // namespace storage |
| 190 #endif // STORAGE_BROWSER_BLOB_BLOB_READER_H_ | 190 #endif // STORAGE_BROWSER_BLOB_BLOB_READER_H_ |
| OLD | NEW |