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 #include "content/child/blob_storage/blob_consolidation.h" | 5 #include "content/child/blob_storage/blob_consolidation.h" |
6 | 6 |
| 7 #include <stdint.h> |
| 8 |
7 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <limits> |
8 #include <string> | 11 #include <string> |
9 | 12 |
10 using storage::DataElement; | 13 using storage::DataElement; |
11 using blink::WebThreadSafeData; | 14 using blink::WebThreadSafeData; |
12 | 15 |
13 namespace content { | 16 namespace content { |
14 | 17 |
15 using ReadStatus = BlobConsolidation::ReadStatus; | 18 using ReadStatus = BlobConsolidation::ReadStatus; |
16 | 19 |
17 BlobConsolidation::ConsolidatedItem::ConsolidatedItem() | 20 BlobConsolidation::ConsolidatedItem::ConsolidatedItem() |
18 : type(DataElement::TYPE_UNKNOWN), | 21 : type(DataElement::TYPE_UNKNOWN), |
19 offset(0), | 22 offset(0), |
20 length(kuint64max), | 23 length(std::numeric_limits<uint64_t>::max()), |
21 expected_modification_time(0) { | 24 expected_modification_time(0) {} |
22 } | |
23 | 25 |
24 BlobConsolidation::ConsolidatedItem::~ConsolidatedItem() { | 26 BlobConsolidation::ConsolidatedItem::~ConsolidatedItem() { |
25 } | 27 } |
26 | 28 |
27 BlobConsolidation::ConsolidatedItem::ConsolidatedItem(DataElement::Type type, | 29 BlobConsolidation::ConsolidatedItem::ConsolidatedItem(DataElement::Type type, |
28 uint64_t offset, | 30 uint64_t offset, |
29 uint64_t length) | 31 uint64_t length) |
30 : type(type), | 32 : type(type), |
31 offset(offset), | 33 offset(offset), |
32 length(length), | 34 length(length), |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 consolidated_size - memory_read); | 153 consolidated_size - memory_read); |
152 memcpy(static_cast<char*>(memory_out) + memory_read, | 154 memcpy(static_cast<char*>(memory_out) + memory_read, |
153 item.data[mid].data() + offset_from_mid, read_size); | 155 item.data[mid].data() + offset_from_mid, read_size); |
154 offset_from_mid = 0; | 156 offset_from_mid = 0; |
155 memory_read += read_size; | 157 memory_read += read_size; |
156 } | 158 } |
157 return ReadStatus::OK; | 159 return ReadStatus::OK; |
158 } | 160 } |
159 | 161 |
160 } // namespace content | 162 } // namespace content |
OLD | NEW |