| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 STORAGE_COMMON_BLOB_STORAGE_BLOB_ITEM_BYTES_RESPONSE_H_ | 5 #ifndef STORAGE_COMMON_BLOB_STORAGE_BLOB_ITEM_BYTES_RESPONSE_H_ |
| 6 #define STORAGE_COMMON_BLOB_STORAGE_BLOB_ITEM_BYTES_RESPONSE_H_ | 6 #define STORAGE_COMMON_BLOB_STORAGE_BLOB_ITEM_BYTES_RESPONSE_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 #include <algorithm> | 10 #include <algorithm> |
| 11 #include <ostream> | 11 #include <ostream> |
| 12 #include <vector> | 12 #include <vector> |
| 13 | 13 |
| 14 #include "base/time/time.h" |
| 14 #include "storage/common/storage_common_export.h" | 15 #include "storage/common/storage_common_export.h" |
| 15 | 16 |
| 16 namespace storage { | 17 namespace storage { |
| 17 | 18 |
| 18 // This class is serialized over IPC to send blob item data, or to signal that | 19 // This class is serialized over IPC to send blob item data, or to signal that |
| 19 // the memory has been populated. | 20 // the memory has been populated in shared memory or a file. |
| 20 struct STORAGE_COMMON_EXPORT BlobItemBytesResponse { | 21 struct STORAGE_COMMON_EXPORT BlobItemBytesResponse { |
| 21 // not using std::numeric_limits<T>::max() because of non-C++11 builds. | 22 // not using std::numeric_limits<T>::max() because of non-C++11 builds. |
| 22 static const size_t kInvalidIndex = SIZE_MAX; | 23 static const uint32_t kInvalidIndex = UINT32_MAX; |
| 23 | 24 |
| 24 BlobItemBytesResponse(); | 25 BlobItemBytesResponse(); |
| 25 explicit BlobItemBytesResponse(size_t request_number); | 26 explicit BlobItemBytesResponse(uint32_t request_number); |
| 26 BlobItemBytesResponse(const BlobItemBytesResponse& other); | 27 BlobItemBytesResponse(const BlobItemBytesResponse& other); |
| 27 ~BlobItemBytesResponse(); | 28 ~BlobItemBytesResponse(); |
| 28 | 29 |
| 29 char* allocate_mutable_data(size_t size) { | 30 char* allocate_mutable_data(uint32_t size) { |
| 30 inline_data.resize(size); | 31 inline_data.resize(size); |
| 31 return &inline_data[0]; | 32 return &inline_data[0]; |
| 32 } | 33 } |
| 33 | 34 |
| 34 size_t request_number; | 35 uint32_t request_number; |
| 35 std::vector<char> inline_data; | 36 std::vector<char> inline_data; |
| 37 base::Time time_file_modified; |
| 36 }; | 38 }; |
| 37 | 39 |
| 38 STORAGE_COMMON_EXPORT void PrintTo(const BlobItemBytesResponse& response, | 40 STORAGE_COMMON_EXPORT void PrintTo(const BlobItemBytesResponse& response, |
| 39 std::ostream* os); | 41 std::ostream* os); |
| 40 | 42 |
| 41 STORAGE_COMMON_EXPORT bool operator==(const BlobItemBytesResponse& a, | 43 STORAGE_COMMON_EXPORT bool operator==(const BlobItemBytesResponse& a, |
| 42 const BlobItemBytesResponse& b); | 44 const BlobItemBytesResponse& b); |
| 43 | 45 |
| 44 STORAGE_COMMON_EXPORT bool operator!=(const BlobItemBytesResponse& a, | 46 STORAGE_COMMON_EXPORT bool operator!=(const BlobItemBytesResponse& a, |
| 45 const BlobItemBytesResponse& b); | 47 const BlobItemBytesResponse& b); |
| 46 | 48 |
| 47 } // namespace storage | 49 } // namespace storage |
| 48 | 50 |
| 49 #endif // STORAGE_COMMON_BLOB_STORAGE_BLOB_ITEM_BYTES_RESPONSE_H_ | 51 #endif // STORAGE_COMMON_BLOB_STORAGE_BLOB_ITEM_BYTES_RESPONSE_H_ |
| OLD | NEW |