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