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

Side by Side Diff: net/base/upload_file_element_reader.h

Issue 140733002: Revert 244982 "Revert 244857 "net: Remove classes which were use..." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: rebase Created 6 years, 11 months 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 | Annotate | Revision Log
« no previous file with comments | « net/base/upload_data.cc ('k') | net/base/upload_file_element_reader.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 NET_BASE_UPLOAD_FILE_ELEMENT_READER_H_ 5 #ifndef NET_BASE_UPLOAD_FILE_ELEMENT_READER_H_
6 #define NET_BASE_UPLOAD_FILE_ELEMENT_READER_H_ 6 #define NET_BASE_UPLOAD_FILE_ELEMENT_READER_H_
7 7
8 #include "base/compiler_specific.h" 8 #include "base/compiler_specific.h"
9 #include "base/files/file_path.h" 9 #include "base/files/file_path.h"
10 #include "base/gtest_prod_util.h" 10 #include "base/gtest_prod_util.h"
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 const uint64 range_length_; 99 const uint64 range_length_;
100 const base::Time expected_modification_time_; 100 const base::Time expected_modification_time_;
101 ScopedFileStreamPtr file_stream_; 101 ScopedFileStreamPtr file_stream_;
102 uint64 content_length_; 102 uint64 content_length_;
103 uint64 bytes_remaining_; 103 uint64 bytes_remaining_;
104 base::WeakPtrFactory<UploadFileElementReader> weak_ptr_factory_; 104 base::WeakPtrFactory<UploadFileElementReader> weak_ptr_factory_;
105 105
106 DISALLOW_COPY_AND_ASSIGN(UploadFileElementReader); 106 DISALLOW_COPY_AND_ASSIGN(UploadFileElementReader);
107 }; 107 };
108 108
109 // An UploadElementReader implementation for file which performs file operation
110 // synchronously.
111 // Use this class only if the thread is IO allowed.
112 class NET_EXPORT UploadFileElementReaderSync : public UploadElementReader {
113 public:
114 UploadFileElementReaderSync(const base::FilePath& path,
115 uint64 range_offset,
116 uint64 range_length,
117 const base::Time& expected_modification_time);
118 virtual ~UploadFileElementReaderSync();
119
120 // UploadElementReader overrides:
121 virtual int Init(const CompletionCallback& callback) OVERRIDE;
122 virtual uint64 GetContentLength() const OVERRIDE;
123 virtual uint64 BytesRemaining() const OVERRIDE;
124 virtual int Read(IOBuffer* buf,
125 int buf_length,
126 const CompletionCallback& callback) OVERRIDE;
127
128 private:
129 const base::FilePath path_;
130 const uint64 range_offset_;
131 const uint64 range_length_;
132 const base::Time expected_modification_time_;
133 scoped_ptr<FileStream> file_stream_;
134 uint64 content_length_;
135 uint64 bytes_remaining_;
136
137 DISALLOW_COPY_AND_ASSIGN(UploadFileElementReaderSync);
138 };
139
140 } // namespace net 109 } // namespace net
141 110
142 #endif // NET_BASE_UPLOAD_FILE_ELEMENT_READER_H_ 111 #endif // NET_BASE_UPLOAD_FILE_ELEMENT_READER_H_
OLDNEW
« no previous file with comments | « net/base/upload_data.cc ('k') | net/base/upload_file_element_reader.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698