Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(563)

Unified Diff: storage/browser/blob/blob_reader.h

Issue 1513783005: [Blob] Fix for resetting reader. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: comments Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: storage/browser/blob/blob_reader.h
diff --git a/storage/browser/blob/blob_reader.h b/storage/browser/blob/blob_reader.h
index 54b262f3ef3e910dfcf932c37a87d8b9e85ab8b7..023a279a1c968db784710074cda2276aa0aff37a 100644
--- a/storage/browser/blob/blob_reader.h
+++ b/storage/browser/blob/blob_reader.h
@@ -13,6 +13,7 @@
#include "base/memory/scoped_ptr.h"
#include "base/memory/weak_ptr.h"
#include "net/base/completion_callback.h"
+#include "net/base/net_errors.h"
#include "storage/browser/storage_browser_export.h"
class GURL;
@@ -65,7 +66,7 @@ class STORAGE_EXPORT BlobReader {
// This calculates the total size of the blob, and initializes the reading
// cursor.
- // * This should only be called once per reader.
+ // * This hsould only be called once per reader.
michaeln 2015/12/11 02:17:01 stray key strike
// * Status::Done means that the total_size() value is populated and you can
// continue to SetReadRange or Read.
// * The 'done' callback is only called if Status::IO_PENDING is returned.
@@ -109,6 +110,9 @@ class STORAGE_EXPORT BlobReader {
// is called.
uint64_t total_size() const { return total_size_; }
+ // Returns if the reader has been used at all.
+ bool dirty() const { return dirty_; }
+
protected:
friend class BlobDataHandle;
friend class BlobReaderTest;
@@ -163,8 +167,7 @@ class STORAGE_EXPORT BlobReader {
scoped_ptr<FileStreamReaderProvider> file_stream_provider_;
scoped_refptr<base::SequencedTaskRunner> file_task_runner_;
- int net_error_;
- bool item_list_populated_ = false;
+ int net_error_ = net::OK;
std::vector<uint64_t> item_length_list_;
scoped_refptr<net::DrainableIOBuffer> read_buf_;
@@ -173,10 +176,11 @@ class STORAGE_EXPORT BlobReader {
uint64_t total_size_ = 0;
uint64_t remaining_bytes_ = 0;
size_t pending_get_file_info_count_ = 0;
- std::map<size_t, FileStreamReader*> index_to_reader_;
+ std::map<size_t, scoped_ptr<FileStreamReader>> index_to_reader_;
size_t current_item_index_ = 0;
uint64_t current_item_offset_ = 0;
+ bool dirty_ = false;
bool io_pending_ = false;
net::CompletionCallback size_callback_;

Powered by Google App Engine
This is Rietveld 408576698