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 "storage/browser/blob/internal_blob_data.h" | 5 #include "storage/browser/blob/internal_blob_data.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <memory> | 9 #include <memory> |
10 #include <utility> | 10 #include <utility> |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 } | 51 } |
52 | 52 |
53 const std::vector<scoped_refptr<ShareableBlobDataItem>>& | 53 const std::vector<scoped_refptr<ShareableBlobDataItem>>& |
54 InternalBlobData::items() const { | 54 InternalBlobData::items() const { |
55 return items_; | 55 return items_; |
56 } | 56 } |
57 | 57 |
58 void InternalBlobData::RemoveBlobFromShareableItems( | 58 void InternalBlobData::RemoveBlobFromShareableItems( |
59 const std::string& blob_uuid) { | 59 const std::string& blob_uuid) { |
60 for (auto& data_item : items_) { | 60 for (auto& data_item : items_) { |
61 data_item->referencing_blobs().erase(blob_uuid); | 61 data_item->referencing_blobs_mutable()->erase(blob_uuid); |
62 } | 62 } |
63 } | 63 } |
64 | 64 |
65 size_t InternalBlobData::GetUnsharedMemoryUsage() const { | 65 size_t InternalBlobData::GetUnsharedMemoryUsage() const { |
66 size_t memory = 0; | 66 size_t memory = 0; |
67 base::hash_set<void*> seen_items; | 67 base::hash_set<void*> seen_items; |
68 for (const auto& data_item : items_) { | 68 for (const auto& data_item : items_) { |
69 if (data_item->item()->type() != DataElement::TYPE_BYTES || | 69 if (data_item->item()->type() != DataElement::TYPE_BYTES || |
70 data_item->referencing_blobs().size() > 1 || | 70 data_item->referencing_blobs().size() > 1 || |
71 seen_items.find(data_item.get()) != seen_items.end()) { | 71 seen_items.find(data_item.get()) != seen_items.end()) { |
(...skipping 16 matching lines...) Expand all Loading... |
88 if (data_item->referencing_blobs().size() == 1 && | 88 if (data_item->referencing_blobs().size() == 1 && |
89 seen_items.find(data_item.get()) == seen_items.end()) { | 89 seen_items.find(data_item.get()) == seen_items.end()) { |
90 *unshared_memory += data_item->item()->length(); | 90 *unshared_memory += data_item->item()->length(); |
91 seen_items.insert(data_item.get()); | 91 seen_items.insert(data_item.get()); |
92 } | 92 } |
93 } | 93 } |
94 } | 94 } |
95 } | 95 } |
96 | 96 |
97 } // namespace storage | 97 } // namespace storage |
OLD | NEW |