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

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

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