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

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

Issue 1108083002: Create blobs from Disk Cache entries. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: omg, fix the correct base::Unretained... Created 5 years, 6 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_builder.h" 5 #include "storage/browser/blob/blob_data_builder.h"
6 6
7 #include "base/time/time.h" 7 #include "base/time/time.h"
8 #include "net/disk_cache/disk_cache.h"
8 #include "storage/browser/blob/shareable_file_reference.h" 9 #include "storage/browser/blob/shareable_file_reference.h"
9 10
10 namespace storage { 11 namespace storage {
11 12
12 BlobDataBuilder::BlobDataBuilder(const std::string& uuid) : uuid_(uuid) { 13 BlobDataBuilder::BlobDataBuilder(const std::string& uuid) : uuid_(uuid) {
13 } 14 }
14 BlobDataBuilder::~BlobDataBuilder() { 15 BlobDataBuilder::~BlobDataBuilder() {
15 } 16 }
16 17
17 void BlobDataBuilder::AppendData(const char* data, size_t length) { 18 void BlobDataBuilder::AppendData(const char* data, size_t length) {
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 uint64_t offset, 54 uint64_t offset,
54 uint64_t length, 55 uint64_t length,
55 const base::Time& expected_modification_time) { 56 const base::Time& expected_modification_time) {
56 DCHECK(length > 0); 57 DCHECK(length > 0);
57 scoped_ptr<DataElement> element(new DataElement()); 58 scoped_ptr<DataElement> element(new DataElement());
58 element->SetToFileSystemUrlRange(url, offset, length, 59 element->SetToFileSystemUrlRange(url, offset, length,
59 expected_modification_time); 60 expected_modification_time);
60 items_.push_back(new BlobDataItem(element.Pass())); 61 items_.push_back(new BlobDataItem(element.Pass()));
61 } 62 }
62 63
64 void BlobDataBuilder::AppendDiskCacheEntry(
65 const scoped_refptr<DataHandle>& data_handle,
66 disk_cache::Entry* disk_cache_entry,
67 int disk_cache_stream_index) {
68 scoped_ptr<DataElement> element(new DataElement());
69 element->SetToDiskCacheEntryRange(
70 0U, disk_cache_entry->GetDataSize(disk_cache_stream_index));
71 items_.push_back(
72 new BlobDataItem(element.Pass(), data_handle, disk_cache_entry,
73 disk_cache_stream_index));
74 }
75
63 } // namespace storage 76 } // namespace storage
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698