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 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
10 #include "net/base/net_export.h" | 10 #include "net/base/net_export.h" |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
58 | 58 |
59 bool is_chunked() const { return upload_data_->is_chunked(); } | 59 bool is_chunked() const { return upload_data_->is_chunked(); } |
60 | 60 |
61 // Returns true if all data has been consumed from this upload data | 61 // Returns true if all data has been consumed from this upload data |
62 // stream. | 62 // stream. |
63 bool IsEOF() const; | 63 bool IsEOF() const; |
64 | 64 |
65 // Returns true if the upload data in the stream is entirely in memory. | 65 // Returns true if the upload data in the stream is entirely in memory. |
66 bool IsInMemory() const; | 66 bool IsInMemory() const; |
67 | 67 |
68 // This method is provided only to be used by unit tests. | 68 // This method is provided only to be used by unit tests. |
Ryan Sleevi
2012/07/06 20:20:03
nit: This method is -> These methods are
However,
ramant (doing other things)
2012/07/06 22:55:42
Done.
| |
69 static bool merge_chunks() { return merge_chunks_; } | |
69 static void set_merge_chunks(bool merge) { merge_chunks_ = merge; } | 70 static void set_merge_chunks(bool merge) { merge_chunks_ = merge; } |
70 | 71 |
71 private: | 72 private: |
72 scoped_refptr<UploadData> upload_data_; | 73 scoped_refptr<UploadData> upload_data_; |
73 | 74 |
74 // Index of the current upload element (i.e. the element currently being | 75 // Index of the current upload element (i.e. the element currently being |
75 // read). The index is used as a cursor to iterate over elements in | 76 // read). The index is used as a cursor to iterate over elements in |
76 // |upload_data_|. | 77 // |upload_data_|. |
77 size_t element_index_; | 78 size_t element_index_; |
78 | 79 |
79 // Size and current read position within the upload data stream. | 80 // Size and current read position within the upload data stream. |
80 uint64 total_size_; | 81 uint64 total_size_; |
81 uint64 current_position_; | 82 uint64 current_position_; |
82 | 83 |
83 // True if the initialization was successful. | 84 // True if the initialization was successful. |
84 bool initialized_successfully_; | 85 bool initialized_successfully_; |
85 | 86 |
86 // TODO(satish): Remove this once we have a better way to unit test POST | 87 // TODO(satish): Remove this once we have a better way to unit test POST |
87 // requests with chunked uploads. | 88 // requests with chunked uploads. |
88 static bool merge_chunks_; | 89 static bool merge_chunks_; |
89 | 90 |
90 DISALLOW_COPY_AND_ASSIGN(UploadDataStream); | 91 DISALLOW_COPY_AND_ASSIGN(UploadDataStream); |
91 }; | 92 }; |
92 | 93 |
93 } // namespace net | 94 } // namespace net |
94 | 95 |
95 #endif // NET_BASE_UPLOAD_DATA_STREAM_H_ | 96 #endif // NET_BASE_UPLOAD_DATA_STREAM_H_ |
OLD | NEW |