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

Side by Side Diff: storage/browser/blob/upload_blob_element_reader.h

Issue 1513783005: [Blob] Fix for resetting reader. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: comments and cleanup 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 unified diff | Download patch
OLDNEW
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_UPLOAD_BLOB_ELEMENT_READER_H_ 5 #ifndef STORAGE_BROWSER_BLOB_UPLOAD_BLOB_ELEMENT_READER_H_
6 #define STORAGE_BROWSER_BLOB_UPLOAD_BLOB_ELEMENT_READER_H_ 6 #define STORAGE_BROWSER_BLOB_UPLOAD_BLOB_ELEMENT_READER_H_
7 7
8 #include "base/macros.h" 8 #include "base/macros.h"
9 #include "base/memory/ref_counted.h"
9 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
10 #include "net/base/completion_callback.h" 11 #include "net/base/completion_callback.h"
11 #include "net/base/upload_element_reader.h" 12 #include "net/base/upload_element_reader.h"
12 #include "storage/browser/storage_browser_export.h" 13 #include "storage/browser/storage_browser_export.h"
13 14
15 namespace base {
16 class SingleThreadTaskRunner;
17 }
18
14 namespace net { 19 namespace net {
15 class IOBuffer; 20 class IOBuffer;
16 } 21 }
17 22
18 namespace storage { 23 namespace storage {
19 class BlobDataHandle; 24 class BlobDataHandle;
20 class BlobReader; 25 class BlobReader;
26 class FileSystemContext;
21 27
22 // This class is a wrapper around the BlobReader to make it conform 28 // This class is a wrapper around the BlobReader to make it conform
23 // to the net::UploadElementReader interface, and it also holds around the 29 // to the net::UploadElementReader interface, and it also holds around the
24 // handle to the blob so it stays in memory while we read it. 30 // handle to the blob so it stays in memory while we read it.
25 class STORAGE_EXPORT UploadBlobElementReader 31 class STORAGE_EXPORT UploadBlobElementReader
26 : NON_EXPORTED_BASE(public net::UploadElementReader) { 32 : NON_EXPORTED_BASE(public net::UploadElementReader) {
27 public: 33 public:
28 UploadBlobElementReader(scoped_ptr<BlobReader> reader, 34 UploadBlobElementReader(scoped_ptr<BlobDataHandle> handle,
29 scoped_ptr<BlobDataHandle> handle); 35 FileSystemContext* file_system_context,
36 base::SingleThreadTaskRunner* file_task_runner);
30 ~UploadBlobElementReader() override; 37 ~UploadBlobElementReader() override;
31 38
32 int Init(const net::CompletionCallback& callback) override; 39 int Init(const net::CompletionCallback& callback) override;
33 40
34 uint64_t GetContentLength() const override; 41 uint64_t GetContentLength() const override;
35 42
36 uint64_t BytesRemaining() const override; 43 uint64_t BytesRemaining() const override;
37 44
38 bool IsInMemory() const override; 45 bool IsInMemory() const override;
39 46
40 int Read(net::IOBuffer* buf, 47 int Read(net::IOBuffer* buf,
41 int buf_length, 48 int buf_length,
42 const net::CompletionCallback& callback) override; 49 const net::CompletionCallback& callback) override;
43 50
44 const std::string& uuid() const; 51 const std::string& uuid() const;
45 52
46 private: 53 private:
54 scoped_ptr<BlobDataHandle> handle_;
55 scoped_refptr<FileSystemContext> file_system_context_;
56 scoped_refptr<base::SingleThreadTaskRunner> file_runner_;
47 scoped_ptr<BlobReader> reader_; 57 scoped_ptr<BlobReader> reader_;
48 scoped_ptr<BlobDataHandle> handle_;
49 58
50 DISALLOW_COPY_AND_ASSIGN(UploadBlobElementReader); 59 DISALLOW_COPY_AND_ASSIGN(UploadBlobElementReader);
51 }; 60 };
52 61
53 } // namespace storage 62 } // namespace storage
54 #endif // STORAGE_BROWSER_BLOB_UPLOAD_BLOB_ELEMENT_READER_H_ 63 #endif // STORAGE_BROWSER_BLOB_UPLOAD_BLOB_ELEMENT_READER_H_
OLDNEW
« no previous file with comments | « content/browser/loader/upload_data_stream_builder_unittest.cc ('k') | storage/browser/blob/upload_blob_element_reader.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698