OLD | NEW |
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_DATA_STREAM_H_ | 5 #ifndef NET_BASE_UPLOAD_DATA_STREAM_H_ |
6 #define NET_BASE_UPLOAD_DATA_STREAM_H_ | 6 #define NET_BASE_UPLOAD_DATA_STREAM_H_ |
7 | 7 |
8 #include "base/gtest_prod_util.h" | 8 #include "base/gtest_prod_util.h" |
9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
10 #include "base/memory/scoped_vector.h" | 10 #include "base/memory/scoped_vector.h" |
(...skipping 16 matching lines...) Expand all Loading... |
27 // Constructs a non-chunked data stream. | 27 // Constructs a non-chunked data stream. |
28 // |element_readers| is cleared by this ctor. | 28 // |element_readers| is cleared by this ctor. |
29 UploadDataStream(ScopedVector<UploadElementReader>* element_readers, | 29 UploadDataStream(ScopedVector<UploadElementReader>* element_readers, |
30 int64 identifier); | 30 int64 identifier); |
31 | 31 |
32 // Constructs a chunked data stream. | 32 // Constructs a chunked data stream. |
33 UploadDataStream(Chunked chunked, int64 identifier); | 33 UploadDataStream(Chunked chunked, int64 identifier); |
34 | 34 |
35 ~UploadDataStream(); | 35 ~UploadDataStream(); |
36 | 36 |
| 37 // Creates UploadDataStream with a reader. |
| 38 static UploadDataStream* CreateWithReader( |
| 39 scoped_ptr<UploadElementReader> reader, |
| 40 int64 identifier); |
| 41 |
37 // Initializes the stream. This function must be called before calling any | 42 // Initializes the stream. This function must be called before calling any |
38 // other method. It is not valid to call any method (other than the | 43 // other method. It is not valid to call any method (other than the |
39 // destructor) if Init() returns a failure. This method can be called multiple | 44 // destructor) if Init() returns a failure. This method can be called multiple |
40 // times. Calling this method after a Init() success results in resetting the | 45 // times. Calling this method after a Init() success results in resetting the |
41 // state. | 46 // state. |
42 // | 47 // |
43 // Does the initialization synchronously and returns the result if possible, | 48 // Does the initialization synchronously and returns the result if possible, |
44 // otherwise returns ERR_IO_PENDING and runs the callback with the result. | 49 // otherwise returns ERR_IO_PENDING and runs the callback with the result. |
45 // | 50 // |
46 // Returns OK on success. Returns ERR_UPLOAD_FILE_CHANGED if the expected | 51 // Returns OK on success. Returns ERR_UPLOAD_FILE_CHANGED if the expected |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
162 // TODO(satish): Remove this once we have a better way to unit test POST | 167 // TODO(satish): Remove this once we have a better way to unit test POST |
163 // requests with chunked uploads. | 168 // requests with chunked uploads. |
164 static bool merge_chunks_; | 169 static bool merge_chunks_; |
165 | 170 |
166 DISALLOW_COPY_AND_ASSIGN(UploadDataStream); | 171 DISALLOW_COPY_AND_ASSIGN(UploadDataStream); |
167 }; | 172 }; |
168 | 173 |
169 } // namespace net | 174 } // namespace net |
170 | 175 |
171 #endif // NET_BASE_UPLOAD_DATA_STREAM_H_ | 176 #endif // NET_BASE_UPLOAD_DATA_STREAM_H_ |
OLD | NEW |