diff options
author | dmurph <dmurph@chromium.org> | 2015-12-15 13:21:49 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-12-15 21:23:24 +0000 |
commit | f01c1228c9cca9b4078443438dfa868f7b972ac2 (patch) | |
tree | 727a6488a5c4333fb84e93d5214ddfcbf34fc478 /storage | |
parent | 7064ae3762738bbc29e3f56ffe5c1938009a6b20 (diff) | |
download | chromium_src-f01c1228c9cca9b4078443438dfa868f7b972ac2.zip chromium_src-f01c1228c9cca9b4078443438dfa868f7b972ac2.tar.gz chromium_src-f01c1228c9cca9b4078443438dfa868f7b972ac2.tar.bz2 |
[Blob] Fix for resetting reader.
R=michaeln
BUG=567692
Committed-First-Time: https://crrev.com/ebf7a6b19a7a468195a5606fbd2bbd6d07a26ea2
Cr-Commit-Position-First-Time: refs/heads/master@{#365177}
Review URL: https://codereview.chromium.org/1513783005
Cr-Commit-Position: refs/heads/master@{#365316}
Diffstat (limited to 'storage')
-rw-r--r-- | storage/browser/blob/upload_blob_element_reader.cc | 13 | ||||
-rw-r--r-- | storage/browser/blob/upload_blob_element_reader.h | 15 |
2 files changed, 22 insertions, 6 deletions
diff --git a/storage/browser/blob/upload_blob_element_reader.cc b/storage/browser/blob/upload_blob_element_reader.cc index dd0058f..e4d6d4a 100644 --- a/storage/browser/blob/upload_blob_element_reader.cc +++ b/storage/browser/blob/upload_blob_element_reader.cc @@ -4,20 +4,27 @@ #include "storage/browser/blob/upload_blob_element_reader.h" +#include "base/single_thread_task_runner.h" #include "net/base/net_errors.h" #include "storage/browser/blob/blob_data_handle.h" #include "storage/browser/blob/blob_reader.h" +#include "storage/browser/fileapi/file_system_context.h" namespace storage { UploadBlobElementReader::UploadBlobElementReader( - scoped_ptr<storage::BlobReader> reader, - scoped_ptr<BlobDataHandle> handle) - : reader_(reader.Pass()), handle_(handle.Pass()) {} + scoped_ptr<BlobDataHandle> handle, + FileSystemContext* file_system_context, + base::SingleThreadTaskRunner* file_task_runner) + : handle_(handle.Pass()), + file_system_context_(file_system_context), + file_runner_(file_task_runner) {} UploadBlobElementReader::~UploadBlobElementReader() {} int UploadBlobElementReader::Init(const net::CompletionCallback& callback) { + reader_ = + handle_->CreateReader(file_system_context_.get(), file_runner_.get()); BlobReader::Status status = reader_->CalculateSize(callback); switch (status) { case BlobReader::Status::NET_ERROR: diff --git a/storage/browser/blob/upload_blob_element_reader.h b/storage/browser/blob/upload_blob_element_reader.h index 72b7244..47ff90d 100644 --- a/storage/browser/blob/upload_blob_element_reader.h +++ b/storage/browser/blob/upload_blob_element_reader.h @@ -6,11 +6,16 @@ #define STORAGE_BROWSER_BLOB_UPLOAD_BLOB_ELEMENT_READER_H_ #include "base/macros.h" +#include "base/memory/ref_counted.h" #include "base/memory/scoped_ptr.h" #include "net/base/completion_callback.h" #include "net/base/upload_element_reader.h" #include "storage/browser/storage_browser_export.h" +namespace base { +class SingleThreadTaskRunner; +} + namespace net { class IOBuffer; } @@ -18,6 +23,7 @@ class IOBuffer; namespace storage { class BlobDataHandle; class BlobReader; +class FileSystemContext; // This class is a wrapper around the BlobReader to make it conform // to the net::UploadElementReader interface, and it also holds around the @@ -25,8 +31,9 @@ class BlobReader; class STORAGE_EXPORT UploadBlobElementReader : NON_EXPORTED_BASE(public net::UploadElementReader) { public: - UploadBlobElementReader(scoped_ptr<BlobReader> reader, - scoped_ptr<BlobDataHandle> handle); + UploadBlobElementReader(scoped_ptr<BlobDataHandle> handle, + FileSystemContext* file_system_context, + base::SingleThreadTaskRunner* file_task_runner); ~UploadBlobElementReader() override; int Init(const net::CompletionCallback& callback) override; @@ -44,8 +51,10 @@ class STORAGE_EXPORT UploadBlobElementReader const std::string& uuid() const; private: - scoped_ptr<BlobReader> reader_; scoped_ptr<BlobDataHandle> handle_; + scoped_refptr<FileSystemContext> file_system_context_; + scoped_refptr<base::SingleThreadTaskRunner> file_runner_; + scoped_ptr<BlobReader> reader_; DISALLOW_COPY_AND_ASSIGN(UploadBlobElementReader); }; |