| OLD | NEW |
| 1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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/blob_data_snapshot.h" | 5 #include "storage/browser/blob/blob_data_snapshot.h" |
| 6 | 6 |
| 7 namespace storage { | 7 namespace storage { |
| 8 | 8 |
| 9 BlobDataSnapshot::BlobDataSnapshot( | 9 BlobDataSnapshot::BlobDataSnapshot( |
| 10 const std::string& uuid, | 10 const std::string& uuid, |
| 11 const std::string& content_type, | 11 const std::string& content_type, |
| 12 const std::string& content_disposition, | 12 const std::string& content_disposition, |
| 13 const std::vector<scoped_refptr<BlobDataItem>>& items) | 13 const std::vector<scoped_refptr<BlobDataItem>>& items) |
| 14 : uuid_(uuid), | 14 : uuid_(uuid), |
| 15 content_type_(content_type), | 15 content_type_(content_type), |
| 16 content_disposition_(content_disposition), | 16 content_disposition_(content_disposition), |
| 17 items_(items) { | 17 items_(items) { |
| 18 } | 18 } |
| 19 | 19 |
| 20 BlobDataSnapshot::BlobDataSnapshot(const std::string& uuid, |
| 21 const std::string& content_type, |
| 22 const std::string& content_disposition) |
| 23 : uuid_(uuid), |
| 24 content_type_(content_type), |
| 25 content_disposition_(content_disposition) { |
| 26 } |
| 27 |
| 20 BlobDataSnapshot::BlobDataSnapshot(const BlobDataSnapshot& other) | 28 BlobDataSnapshot::BlobDataSnapshot(const BlobDataSnapshot& other) |
| 21 : uuid_(other.uuid_), | 29 : uuid_(other.uuid_), |
| 22 content_type_(other.content_type_), | 30 content_type_(other.content_type_), |
| 23 content_disposition_(other.content_disposition_), | 31 content_disposition_(other.content_disposition_), |
| 24 items_(other.items_) { | 32 items_(other.items_) { |
| 25 } | 33 } |
| 26 | 34 |
| 27 BlobDataSnapshot::~BlobDataSnapshot() { | 35 BlobDataSnapshot::~BlobDataSnapshot() { |
| 28 } | 36 } |
| 29 | 37 |
| 30 size_t BlobDataSnapshot::GetMemoryUsage() const { | 38 size_t BlobDataSnapshot::GetMemoryUsage() const { |
| 31 int64 memory = 0; | 39 int64 memory = 0; |
| 32 for (const auto& data_item : items_) { | 40 for (const auto& data_item : items_) { |
| 33 if (data_item->type() == DataElement::TYPE_BYTES) | 41 if (data_item->type() == DataElement::TYPE_BYTES) |
| 34 memory += data_item->length(); | 42 memory += data_item->length(); |
| 35 } | 43 } |
| 36 return memory; | 44 return memory; |
| 37 } | 45 } |
| 38 | 46 |
| 39 } // namespace storage | 47 } // namespace storage |
| OLD | NEW |