OLD | NEW |
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" | |
13 #include "net/base/completion_callback.h" | 12 #include "net/base/completion_callback.h" |
14 #include "net/base/net_export.h" | 13 #include "net/base/net_export.h" |
15 #include "net/base/upload_data_stream.h" | 14 #include "net/base/upload_data_stream.h" |
16 | 15 |
17 namespace net { | 16 namespace net { |
18 | 17 |
19 class IOBuffer; | 18 class IOBuffer; |
20 | 19 |
21 // Class with a push-based interface for uploading data. Buffers all data until | 20 // 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 | 21 // the request is completed. Not recommended for uploading large amounts of |
(...skipping 18 matching lines...) Expand all Loading... |
41 | 40 |
42 int ReadChunk(IOBuffer* buf, int buf_len); | 41 int ReadChunk(IOBuffer* buf, int buf_len); |
43 | 42 |
44 // Index and offset of next element of |upload_data_| to be read. | 43 // Index and offset of next element of |upload_data_| to be read. |
45 size_t read_index_; | 44 size_t read_index_; |
46 size_t read_offset_; | 45 size_t read_offset_; |
47 | 46 |
48 // True once all data has been appended to the stream. | 47 // True once all data has been appended to the stream. |
49 bool all_data_appended_; | 48 bool all_data_appended_; |
50 | 49 |
51 ScopedVector<std::vector<char>> upload_data_; | 50 std::vector<scoped_ptr<std::vector<char>>> upload_data_; |
52 | 51 |
53 // Buffer to write the next read's data to. Only set when a call to | 52 // Buffer to write the next read's data to. Only set when a call to |
54 // ReadInternal reads no data. | 53 // ReadInternal reads no data. |
55 scoped_refptr<IOBuffer> read_buffer_; | 54 scoped_refptr<IOBuffer> read_buffer_; |
56 int read_buffer_len_; | 55 int read_buffer_len_; |
57 | 56 |
58 DISALLOW_COPY_AND_ASSIGN(ChunkedUploadDataStream); | 57 DISALLOW_COPY_AND_ASSIGN(ChunkedUploadDataStream); |
59 }; | 58 }; |
60 | 59 |
61 } // namespace net | 60 } // namespace net |
62 | 61 |
63 #endif // NET_BASE_CHUNKED_UPLOAD_DATA_STREAM_H_ | 62 #endif // NET_BASE_CHUNKED_UPLOAD_DATA_STREAM_H_ |
OLD | NEW |