Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(420)

Side by Side Diff: storage/browser/blob/blob_data_item.cc

Issue 1108083002: Create blobs from Disk Cache entries. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 uint64 BlobDataItem::GetLength() const {
10 if (type() == DataElement::TYPE_DISK_CACHE_ENTRY)
11 return disk_cache_entry_->GetDataSize(disk_cache_stream_index_);
12 return item_->length();
13 }
14
15 uint64 BlobDataItem::GetOffset() const {
16 if (type() == DataElement::TYPE_DISK_CACHE_ENTRY)
michaeln 2015/06/12 22:35:09 does this break blob.slice()?
17 return 0;
18 return item_->offset();
19 }
20
9 BlobDataItem::BlobDataItem(scoped_ptr<DataElement> item, 21 BlobDataItem::BlobDataItem(scoped_ptr<DataElement> item,
10 scoped_refptr<ShareableFileReference> file_handle) 22 scoped_refptr<ShareableFileReference> file_handle)
11 : item_(item.Pass()), file_handle_(file_handle) { 23 : item_(item.Pass()),
24 file_handle_(file_handle) {
12 } 25 }
26
13 BlobDataItem::BlobDataItem(scoped_ptr<DataElement> item) : item_(item.Pass()) { 27 BlobDataItem::BlobDataItem(scoped_ptr<DataElement> item) : item_(item.Pass()) {
14 } 28 }
29
30 BlobDataItem::BlobDataItem(scoped_ptr<DataElement> item,
31 disk_cache::ScopedEntryPtr disk_cache_entry,
32 int disk_cache_stream_index)
33 : item_(item.Pass()),
34 disk_cache_entry_(disk_cache_entry.Pass()),
35 disk_cache_stream_index_(disk_cache_stream_index) {
36 }
37
15 BlobDataItem::~BlobDataItem() { 38 BlobDataItem::~BlobDataItem() {
16 } 39 }
17 40
18 } // namespace storage 41 } // namespace storage
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698