| 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 <stddef.h> | 8 #include <stddef.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 | 10 |
| 11 #include <map> | 11 #include <map> |
| 12 #include <memory> | 12 #include <memory> |
| 13 #include <vector> | 13 #include <vector> |
| 14 | 14 |
| 15 #include "base/gtest_prod_util.h" | 15 #include "base/gtest_prod_util.h" |
| 16 #include "base/macros.h" | 16 #include "base/macros.h" |
| 17 #include "base/memory/weak_ptr.h" | 17 #include "base/memory/weak_ptr.h" |
| 18 #include "net/base/completion_callback.h" | 18 #include "net/base/completion_callback.h" |
| 19 #include "storage/browser/storage_browser_export.h" | 19 #include "storage/browser/storage_browser_export.h" |
| 20 #include "storage/common/blob_storage/blob_storage_constants.h" |
| 20 | 21 |
| 21 class GURL; | 22 class GURL; |
| 22 | 23 |
| 23 namespace base { | 24 namespace base { |
| 24 class FilePath; | 25 class FilePath; |
| 25 class SequencedTaskRunner; | 26 class SequencedTaskRunner; |
| 26 class TaskRunner; | 27 class TaskRunner; |
| 27 class Time; | 28 class Time; |
| 28 } | 29 } |
| 29 | 30 |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 std::unique_ptr<FileStreamReaderProvider> file_stream_provider, | 126 std::unique_ptr<FileStreamReaderProvider> file_stream_provider, |
| 126 base::SequencedTaskRunner* file_task_runner); | 127 base::SequencedTaskRunner* file_task_runner); |
| 127 | 128 |
| 128 bool total_size_calculated() const { return total_size_calculated_; } | 129 bool total_size_calculated() const { return total_size_calculated_; } |
| 129 | 130 |
| 130 private: | 131 private: |
| 131 Status ReportError(int net_error); | 132 Status ReportError(int net_error); |
| 132 void InvalidateCallbacksAndDone(int net_error, net::CompletionCallback done); | 133 void InvalidateCallbacksAndDone(int net_error, net::CompletionCallback done); |
| 133 | 134 |
| 134 void AsyncCalculateSize(const net::CompletionCallback& done, | 135 void AsyncCalculateSize(const net::CompletionCallback& done, |
| 135 bool async_succeeded); | 136 bool async_succeeded, |
| 137 IPCBlobCreationCancelCode reason); |
| 136 Status CalculateSizeImpl(const net::CompletionCallback& done); | 138 Status CalculateSizeImpl(const net::CompletionCallback& done); |
| 137 bool AddItemLength(size_t index, uint64_t length); | 139 bool AddItemLength(size_t index, uint64_t length); |
| 138 bool ResolveFileItemLength(const BlobDataItem& item, | 140 bool ResolveFileItemLength(const BlobDataItem& item, |
| 139 int64_t total_length, | 141 int64_t total_length, |
| 140 uint64_t* output_length); | 142 uint64_t* output_length); |
| 141 void DidGetFileItemLength(size_t index, int64_t result); | 143 void DidGetFileItemLength(size_t index, int64_t result); |
| 142 void DidCountSize(); | 144 void DidCountSize(); |
| 143 | 145 |
| 144 // For reading the blob. | 146 // For reading the blob. |
| 145 // Returns if we're done, PENDING_IO if we're waiting on async. | 147 // Returns if we're done, PENDING_IO if we're waiting on async. |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 194 | 196 |
| 195 net::CompletionCallback size_callback_; | 197 net::CompletionCallback size_callback_; |
| 196 net::CompletionCallback read_callback_; | 198 net::CompletionCallback read_callback_; |
| 197 | 199 |
| 198 base::WeakPtrFactory<BlobReader> weak_factory_; | 200 base::WeakPtrFactory<BlobReader> weak_factory_; |
| 199 DISALLOW_COPY_AND_ASSIGN(BlobReader); | 201 DISALLOW_COPY_AND_ASSIGN(BlobReader); |
| 200 }; | 202 }; |
| 201 | 203 |
| 202 } // namespace storage | 204 } // namespace storage |
| 203 #endif // STORAGE_BROWSER_BLOB_BLOB_READER_H_ | 205 #endif // STORAGE_BROWSER_BLOB_BLOB_READER_H_ |
| OLD | NEW |