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_item.h" | 5 #include "storage/browser/blob/blob_data_item.h" |
6 | 6 |
7 namespace storage { | 7 namespace storage { |
8 | 8 |
9 BlobDataItem::BlobDataItem(scoped_ptr<DataElement> item, | 9 uint64 BlobDataItem::GetLength() const { |
10 scoped_refptr<ShareableFileReference> file_handle) | 10 if (type() == DataElement::TYPE_DISK_CACHE_ENTRY) |
11 : item_(item.Pass()), file_handle_(file_handle) { | 11 return disk_cache_entry_->GetDataSize(disk_cache_stream_index_); |
| 12 return item_->length(); |
12 } | 13 } |
| 14 |
| 15 uint64 BlobDataItem::GetOffset() const { |
| 16 if (type() == DataElement::TYPE_DISK_CACHE_ENTRY) |
| 17 return 0; |
| 18 return item_->offset(); |
| 19 } |
| 20 |
13 BlobDataItem::BlobDataItem(scoped_ptr<DataElement> item) : item_(item.Pass()) { | 21 BlobDataItem::BlobDataItem(scoped_ptr<DataElement> item) : item_(item.Pass()) { |
14 } | 22 } |
| 23 |
| 24 BlobDataItem::BlobDataItem( |
| 25 scoped_ptr<DataElement> item, |
| 26 const scoped_refptr<ShareableFileReference>& file_handle) |
| 27 : item_(item.Pass()), |
| 28 file_handle_(file_handle) { |
| 29 } |
| 30 |
| 31 BlobDataItem::BlobDataItem(scoped_ptr<DataElement> item, |
| 32 scoped_ptr<ExtraData> extra_data, |
| 33 disk_cache::ScopedEntryPtr disk_cache_entry, |
| 34 int disk_cache_stream_index) |
| 35 : item_(item.Pass()), |
| 36 extra_data_(extra_data.Pass()), |
| 37 disk_cache_entry_(disk_cache_entry.Pass()), |
| 38 disk_cache_stream_index_(disk_cache_stream_index) { |
| 39 } |
| 40 |
15 BlobDataItem::~BlobDataItem() { | 41 BlobDataItem::~BlobDataItem() { |
16 } | 42 } |
17 | 43 |
18 } // namespace storage | 44 } // namespace storage |
OLD | NEW |