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_H_ | 5 #ifndef NET_BASE_UPLOAD_DATA_H_ |
6 #define NET_BASE_UPLOAD_DATA_H_ | 6 #define NET_BASE_UPLOAD_DATA_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
216 | 216 |
217 // Returns true if the upload data is entirely in memory (i.e. the | 217 // Returns true if the upload data is entirely in memory (i.e. the |
218 // upload data is not chunked, and all elemnts are of TYPE_BYTES). | 218 // upload data is not chunked, and all elemnts are of TYPE_BYTES). |
219 bool IsInMemory() const; | 219 bool IsInMemory() const; |
220 | 220 |
221 // Resets the offset of each upload data element to zero, so that the | 221 // Resets the offset of each upload data element to zero, so that the |
222 // upload data can be reread. This can happen if the same upload data is | 222 // upload data can be reread. This can happen if the same upload data is |
223 // reused for a new UploadDataStream. | 223 // reused for a new UploadDataStream. |
224 void ResetOffset(); | 224 void ResetOffset(); |
225 | 225 |
226 std::vector<Element>* elements() { | 226 const std::vector<Element>* elements() const { |
227 return &elements_; | 227 return &elements_; |
228 } | 228 } |
229 | 229 |
| 230 std::vector<Element>* elements_mutable() { |
| 231 return &elements_; |
| 232 } |
| 233 |
230 void SetElements(const std::vector<Element>& elements); | 234 void SetElements(const std::vector<Element>& elements); |
231 | 235 |
232 void swap_elements(std::vector<Element>* elements) { | 236 void swap_elements(std::vector<Element>* elements) { |
233 elements_.swap(*elements); | 237 elements_.swap(*elements); |
234 } | 238 } |
235 | 239 |
236 // Identifies a particular upload instance, which is used by the cache to | 240 // Identifies a particular upload instance, which is used by the cache to |
237 // formulate a cache key. This value should be unique across browser | 241 // formulate a cache key. This value should be unique across browser |
238 // sessions. A value of 0 is used to indicate an unspecified identifier. | 242 // sessions. A value of 0 is used to indicate an unspecified identifier. |
239 void set_identifier(int64 id) { identifier_ = id; } | 243 void set_identifier(int64 id) { identifier_ = id; } |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
276 | 280 |
277 inline bool operator!=(const UploadData::Element& a, | 281 inline bool operator!=(const UploadData::Element& a, |
278 const UploadData::Element& b) { | 282 const UploadData::Element& b) { |
279 return !(a == b); | 283 return !(a == b); |
280 } | 284 } |
281 #endif // defined(UNIT_TEST) | 285 #endif // defined(UNIT_TEST) |
282 | 286 |
283 } // namespace net | 287 } // namespace net |
284 | 288 |
285 #endif // NET_BASE_UPLOAD_DATA_H_ | 289 #endif // NET_BASE_UPLOAD_DATA_H_ |
OLD | NEW |