OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include <utility> |
| 6 |
| 7 #include "base/callback.h" |
| 8 #include "base/containers/hash_tables.h" |
| 9 #include "base/metrics/histogram.h" |
| 10 #include "storage/browser/blob/blob_data_handle.h" |
| 11 #include "storage/browser/blob/blob_data_item.h" |
| 12 #include "storage/browser/blob/blob_entry.h" |
| 13 #include "storage/browser/blob/shareable_blob_data_item.h" |
| 14 #include "storage/common/data_element.h" |
| 15 |
| 16 namespace storage { |
| 17 |
| 18 BlobEntry::ItemCopyEntry::ItemCopyEntry( |
| 19 scoped_refptr<ShareableBlobDataItem> source_item, |
| 20 size_t source_item_offset, |
| 21 scoped_refptr<ShareableBlobDataItem> dest_item) |
| 22 : source_item(std::move(source_item)), |
| 23 source_item_offset(source_item_offset), |
| 24 dest_item(std::move(dest_item)) {} |
| 25 |
| 26 BlobEntry::ItemCopyEntry::ItemCopyEntry(ItemCopyEntry&& other) = default; |
| 27 BlobEntry::ItemCopyEntry& BlobEntry::ItemCopyEntry::operator=( |
| 28 BlobEntry::ItemCopyEntry&& rhs) = default; |
| 29 BlobEntry::ItemCopyEntry::~ItemCopyEntry() {} |
| 30 |
| 31 BlobEntry::BuildingState::BuildingState( |
| 32 bool transport_items_present, |
| 33 TransportAllowedCallback transport_allowed_callback, |
| 34 size_t num_building_dependent_blobs) |
| 35 : transport_items_present(transport_items_present), |
| 36 transport_allowed_callback(transport_allowed_callback), |
| 37 num_building_dependent_blobs(num_building_dependent_blobs) {} |
| 38 |
| 39 BlobEntry::BuildingState::~BuildingState() {} |
| 40 |
| 41 BlobEntry::BlobEntry(const std::string& content_type, |
| 42 const std::string& content_disposition) |
| 43 : content_type_(content_type), content_disposition_(content_disposition) {} |
| 44 BlobEntry::~BlobEntry() {} |
| 45 |
| 46 void BlobEntry::AppendSharedBlobItem( |
| 47 scoped_refptr<ShareableBlobDataItem> item) { |
| 48 DCHECK(item); |
| 49 if (!items_.empty()) { |
| 50 offsets_.push_back(size_); |
| 51 } |
| 52 size_ += item->item()->length(); |
| 53 items_.push_back(std::move(item)); |
| 54 } |
| 55 |
| 56 const std::vector<scoped_refptr<ShareableBlobDataItem>>& BlobEntry::items() |
| 57 const { |
| 58 return items_; |
| 59 } |
| 60 |
| 61 void BlobEntry::ClearItems() { |
| 62 items_.clear(); |
| 63 } |
| 64 |
| 65 void BlobEntry::ClearOffsets() { |
| 66 offsets_.clear(); |
| 67 } |
| 68 |
| 69 } // namespace storage |
OLD | NEW |