| 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_ELEMENT_H_ | 5 #ifndef NET_BASE_UPLOAD_ELEMENT_H_ |
| 6 #define NET_BASE_UPLOAD_ELEMENT_H_ | 6 #define NET_BASE_UPLOAD_ELEMENT_H_ |
| 7 | 7 |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 | 70 |
| 71 private: | 71 private: |
| 72 Type type_; | 72 Type type_; |
| 73 std::vector<char> buf_; | 73 std::vector<char> buf_; |
| 74 const char* bytes_start_; | 74 const char* bytes_start_; |
| 75 uint64 bytes_length_; | 75 uint64 bytes_length_; |
| 76 FilePath file_path_; | 76 FilePath file_path_; |
| 77 uint64 file_range_offset_; | 77 uint64 file_range_offset_; |
| 78 uint64 file_range_length_; | 78 uint64 file_range_length_; |
| 79 base::Time expected_file_modification_time_; | 79 base::Time expected_file_modification_time_; |
| 80 |
| 81 DISALLOW_COPY_AND_ASSIGN(UploadElement); |
| 80 }; | 82 }; |
| 81 | 83 |
| 82 #if defined(UNIT_TEST) | 84 #if defined(UNIT_TEST) |
| 83 inline bool operator==(const UploadElement& a, | 85 inline bool operator==(const UploadElement& a, |
| 84 const UploadElement& b) { | 86 const UploadElement& b) { |
| 85 if (a.type() != b.type()) | 87 if (a.type() != b.type()) |
| 86 return false; | 88 return false; |
| 87 if (a.type() == UploadElement::TYPE_BYTES) | 89 if (a.type() == UploadElement::TYPE_BYTES) |
| 88 return a.bytes_length() == b.bytes_length() && | 90 return a.bytes_length() == b.bytes_length() && |
| 89 memcmp(a.bytes(), b.bytes(), b.bytes_length()) == 0; | 91 memcmp(a.bytes(), b.bytes(), b.bytes_length()) == 0; |
| 90 if (a.type() == UploadElement::TYPE_FILE) { | 92 if (a.type() == UploadElement::TYPE_FILE) { |
| 91 return a.file_path() == b.file_path() && | 93 return a.file_path() == b.file_path() && |
| 92 a.file_range_offset() == b.file_range_offset() && | 94 a.file_range_offset() == b.file_range_offset() && |
| 93 a.file_range_length() == b.file_range_length() && | 95 a.file_range_length() == b.file_range_length() && |
| 94 a.expected_file_modification_time() == | 96 a.expected_file_modification_time() == |
| 95 b.expected_file_modification_time(); | 97 b.expected_file_modification_time(); |
| 96 } | 98 } |
| 97 return false; | 99 return false; |
| 98 } | 100 } |
| 99 | 101 |
| 100 inline bool operator!=(const UploadElement& a, | 102 inline bool operator!=(const UploadElement& a, |
| 101 const UploadElement& b) { | 103 const UploadElement& b) { |
| 102 return !(a == b); | 104 return !(a == b); |
| 103 } | 105 } |
| 104 #endif // defined(UNIT_TEST) | 106 #endif // defined(UNIT_TEST) |
| 105 | 107 |
| 106 } // namespace net | 108 } // namespace net |
| 107 | 109 |
| 108 #endif // NET_BASE_UPLOAD_ELEMENT_H_ | 110 #endif // NET_BASE_UPLOAD_ELEMENT_H_ |
| OLD | NEW |