| 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 |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 // Status::DONE) of 0 means we're finished reading. | 113 // Status::DONE) of 0 means we're finished reading. |
| 114 Status Read(net::IOBuffer* buffer, | 114 Status Read(net::IOBuffer* buffer, |
| 115 size_t dest_size, | 115 size_t dest_size, |
| 116 int* bytes_read, | 116 int* bytes_read, |
| 117 net::CompletionCallback done); | 117 net::CompletionCallback done); |
| 118 | 118 |
| 119 // Kills reading and invalidates all callbacks. The reader cannot be used | 119 // Kills reading and invalidates all callbacks. The reader cannot be used |
| 120 // after this call. | 120 // after this call. |
| 121 void Kill(); | 121 void Kill(); |
| 122 | 122 |
| 123 // Returns if all of the blob's items are in memory. | 123 // Returns if all of the blob's items are in memory. Should only be called |
| 124 // after CalculateSize. |
| 124 bool IsInMemory() const; | 125 bool IsInMemory() const; |
| 125 | 126 |
| 126 // Returns the remaining bytes to be read in the blob. This is populated | 127 // Returns the remaining bytes to be read in the blob. This is populated |
| 127 // after CalculateSize, and is modified by SetReadRange. | 128 // after CalculateSize, and is modified by SetReadRange. |
| 128 uint64_t remaining_bytes() const { return remaining_bytes_; } | 129 uint64_t remaining_bytes() const { return remaining_bytes_; } |
| 129 | 130 |
| 130 // Returns the net error code if there was an error. Defaults to net::OK. | 131 // Returns the net error code if there was an error. Defaults to net::OK. |
| 131 int net_error() const { return net_error_; } | 132 int net_error() const { return net_error_; } |
| 132 | 133 |
| 133 // Returns the total size of the blob. This is populated after CalculateSize | 134 // Returns the total size of the blob. This is populated after CalculateSize |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 221 | 222 |
| 222 net::CompletionCallback size_callback_; | 223 net::CompletionCallback size_callback_; |
| 223 net::CompletionCallback read_callback_; | 224 net::CompletionCallback read_callback_; |
| 224 | 225 |
| 225 base::WeakPtrFactory<BlobReader> weak_factory_; | 226 base::WeakPtrFactory<BlobReader> weak_factory_; |
| 226 DISALLOW_COPY_AND_ASSIGN(BlobReader); | 227 DISALLOW_COPY_AND_ASSIGN(BlobReader); |
| 227 }; | 228 }; |
| 228 | 229 |
| 229 } // namespace storage | 230 } // namespace storage |
| 230 #endif // STORAGE_BROWSER_BLOB_BLOB_READER_H_ | 231 #endif // STORAGE_BROWSER_BLOB_BLOB_READER_H_ |
| OLD | NEW |