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> | 7 #include <stdint.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <limits> | 10 #include <limits> |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 | 76 |
77 void BlobConsolidation::AddBlobItem(const std::string& uuid, | 77 void BlobConsolidation::AddBlobItem(const std::string& uuid, |
78 uint64_t offset, | 78 uint64_t offset, |
79 uint64_t length) { | 79 uint64_t length) { |
80 if (length == 0) | 80 if (length == 0) |
81 return; | 81 return; |
82 consolidated_items_.push_back( | 82 consolidated_items_.push_back( |
83 ConsolidatedItem(DataElement::TYPE_BLOB, offset, length)); | 83 ConsolidatedItem(DataElement::TYPE_BLOB, offset, length)); |
84 ConsolidatedItem& item = consolidated_items_.back(); | 84 ConsolidatedItem& item = consolidated_items_.back(); |
85 item.blob_uuid = uuid; | 85 item.blob_uuid = uuid; |
| 86 referenced_blobs_.insert(uuid); |
86 } | 87 } |
87 | 88 |
88 void BlobConsolidation::AddFileSystemItem(const GURL& url, | 89 void BlobConsolidation::AddFileSystemItem(const GURL& url, |
89 uint64_t offset, | 90 uint64_t offset, |
90 uint64_t length, | 91 uint64_t length, |
91 double expected_modification_time) { | 92 double expected_modification_time) { |
92 if (length == 0) | 93 if (length == 0) |
93 return; | 94 return; |
94 consolidated_items_.push_back( | 95 consolidated_items_.push_back( |
95 ConsolidatedItem(DataElement::TYPE_FILE_FILESYSTEM, offset, length)); | 96 ConsolidatedItem(DataElement::TYPE_FILE_FILESYSTEM, offset, length)); |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
156 consolidated_size - memory_read); | 157 consolidated_size - memory_read); |
157 memcpy(static_cast<char*>(memory_out) + memory_read, | 158 memcpy(static_cast<char*>(memory_out) + memory_read, |
158 item.data[mid].data() + offset_from_mid, read_size); | 159 item.data[mid].data() + offset_from_mid, read_size); |
159 offset_from_mid = 0; | 160 offset_from_mid = 0; |
160 memory_read += read_size; | 161 memory_read += read_size; |
161 } | 162 } |
162 return ReadStatus::OK; | 163 return ReadStatus::OK; |
163 } | 164 } |
164 | 165 |
165 } // namespace content | 166 } // namespace content |
OLD | NEW |