| 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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 // Returns the total size of the data stream and the current position. | 67 // Returns the total size of the data stream and the current position. |
| 68 // size() is not to be used to determine whether the stream has ended | 68 // size() is not to be used to determine whether the stream has ended |
| 69 // because it is possible for the stream to end before its size is reached, | 69 // because it is possible for the stream to end before its size is reached, |
| 70 // for example, if the file is truncated. When the data is chunked, size() | 70 // for example, if the file is truncated. When the data is chunked, size() |
| 71 // always returns zero. | 71 // always returns zero. |
| 72 uint64 size() const { return total_size_; } | 72 uint64 size() const { return total_size_; } |
| 73 uint64 position() const { return current_position_; } | 73 uint64 position() const { return current_position_; } |
| 74 | 74 |
| 75 bool is_chunked() const; | 75 bool is_chunked() const; |
| 76 | 76 |
| 77 const ScopedVector<UploadElementReader>& element_readers() const { |
| 78 return element_readers_; |
| 79 } |
| 80 |
| 77 // Returns true if all data has been consumed from this upload data | 81 // Returns true if all data has been consumed from this upload data |
| 78 // stream. | 82 // stream. |
| 79 bool IsEOF() const; | 83 bool IsEOF() const; |
| 80 | 84 |
| 81 // Returns true if the upload data in the stream is entirely in memory. | 85 // Returns true if the upload data in the stream is entirely in memory. |
| 82 bool IsInMemory() const; | 86 bool IsInMemory() const; |
| 83 | 87 |
| 84 private: | 88 private: |
| 85 friend class SpdyHttpStreamSpdy2Test; | 89 friend class SpdyHttpStreamSpdy2Test; |
| 86 friend class SpdyHttpStreamSpdy3Test; | 90 friend class SpdyHttpStreamSpdy3Test; |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 153 // TODO(satish): Remove this once we have a better way to unit test POST | 157 // TODO(satish): Remove this once we have a better way to unit test POST |
| 154 // requests with chunked uploads. | 158 // requests with chunked uploads. |
| 155 static bool merge_chunks_; | 159 static bool merge_chunks_; |
| 156 | 160 |
| 157 DISALLOW_COPY_AND_ASSIGN(UploadDataStream); | 161 DISALLOW_COPY_AND_ASSIGN(UploadDataStream); |
| 158 }; | 162 }; |
| 159 | 163 |
| 160 } // namespace net | 164 } // namespace net |
| 161 | 165 |
| 162 #endif // NET_BASE_UPLOAD_DATA_STREAM_H_ | 166 #endif // NET_BASE_UPLOAD_DATA_STREAM_H_ |
| OLD | NEW |