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

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

Issue 667923003: Standardize usage of virtual/override/final in net/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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
« no previous file with comments | « net/base/capturing_net_log.h ('k') | net/base/directory_lister_unittest.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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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_CHUNKED_UPLOAD_DATA_STREAM_H_ 5 #ifndef NET_BASE_CHUNKED_UPLOAD_DATA_STREAM_H_
6 #define NET_BASE_CHUNKED_UPLOAD_DATA_STREAM_H_ 6 #define NET_BASE_CHUNKED_UPLOAD_DATA_STREAM_H_
7 7
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/macros.h" 10 #include "base/macros.h"
11 #include "base/memory/ref_counted.h" 11 #include "base/memory/ref_counted.h"
12 #include "base/memory/scoped_vector.h" 12 #include "base/memory/scoped_vector.h"
13 #include "net/base/completion_callback.h" 13 #include "net/base/completion_callback.h"
14 #include "net/base/net_export.h" 14 #include "net/base/net_export.h"
15 #include "net/base/upload_data_stream.h" 15 #include "net/base/upload_data_stream.h"
16 16
17 namespace net { 17 namespace net {
18 18
19 class IOBuffer; 19 class IOBuffer;
20 20
21 // Class with a push-based interface for uploading data. Buffers all data until 21 // Class with a push-based interface for uploading data. Buffers all data until
22 // the request is completed. Not recommended for uploading large amounts of 22 // the request is completed. Not recommended for uploading large amounts of
23 // seekable data, due to this buffering behavior. 23 // seekable data, due to this buffering behavior.
24 class NET_EXPORT ChunkedUploadDataStream : public UploadDataStream { 24 class NET_EXPORT ChunkedUploadDataStream : public UploadDataStream {
25 public: 25 public:
26 ChunkedUploadDataStream(int64 identifier); 26 ChunkedUploadDataStream(int64 identifier);
27 27
28 virtual ~ChunkedUploadDataStream(); 28 ~ChunkedUploadDataStream() override;
29 29
30 // Adds data to the stream. |is_done| should be true if this is the last 30 // Adds data to the stream. |is_done| should be true if this is the last
31 // data to be appended. |data_len| must not be 0 unless |is_done| is true. 31 // data to be appended. |data_len| must not be 0 unless |is_done| is true.
32 // Once called with |is_done| being true, must never be called again. 32 // Once called with |is_done| being true, must never be called again.
33 // TODO(mmenke): Consider using IOBuffers instead, to reduce data copies. 33 // TODO(mmenke): Consider using IOBuffers instead, to reduce data copies.
34 void AppendData(const char* data, int data_len, bool is_done); 34 void AppendData(const char* data, int data_len, bool is_done);
35 35
36 private: 36 private:
37 // UploadDataStream implementation. 37 // UploadDataStream implementation.
38 virtual int InitInternal() override; 38 int InitInternal() override;
39 virtual int ReadInternal(IOBuffer* buf, int buf_len) override; 39 int ReadInternal(IOBuffer* buf, int buf_len) override;
40 virtual void ResetInternal() override; 40 void ResetInternal() override;
41 41
42 int ReadChunk(IOBuffer* buf, int buf_len); 42 int ReadChunk(IOBuffer* buf, int buf_len);
43 43
44 // Index and offset of next element of |upload_data_| to be read. 44 // Index and offset of next element of |upload_data_| to be read.
45 size_t read_index_; 45 size_t read_index_;
46 size_t read_offset_; 46 size_t read_offset_;
47 47
48 // True once all data has been appended to the stream. 48 // True once all data has been appended to the stream.
49 bool all_data_appended_; 49 bool all_data_appended_;
50 50
51 ScopedVector<std::vector<char>> upload_data_; 51 ScopedVector<std::vector<char>> upload_data_;
52 52
53 // Buffer to write the next read's data to. Only set when a call to 53 // Buffer to write the next read's data to. Only set when a call to
54 // ReadInternal reads no data. 54 // ReadInternal reads no data.
55 scoped_refptr<IOBuffer> read_buffer_; 55 scoped_refptr<IOBuffer> read_buffer_;
56 int read_buffer_len_; 56 int read_buffer_len_;
57 57
58 DISALLOW_COPY_AND_ASSIGN(ChunkedUploadDataStream); 58 DISALLOW_COPY_AND_ASSIGN(ChunkedUploadDataStream);
59 }; 59 };
60 60
61 } // namespace net 61 } // namespace net
62 62
63 #endif // NET_BASE_CHUNKED_UPLOAD_DATA_STREAM_H_ 63 #endif // NET_BASE_CHUNKED_UPLOAD_DATA_STREAM_H_
OLDNEW
« no previous file with comments | « net/base/capturing_net_log.h ('k') | net/base/directory_lister_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698