diff options
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); }; |