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