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

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

Issue 942633004: IndexedDB: Fixed support for empty blobs. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Removed IndexedDBContext::GetOriginBlobFileCount Created 5 years, 9 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 "storage/browser/blob/shareable_file_reference.h" 8 #include "storage/browser/blob/shareable_file_reference.h"
9 9
10 namespace storage { 10 namespace storage {
11 11
12 BlobDataBuilder::BlobDataBuilder(const std::string& uuid) : uuid_(uuid) { 12 BlobDataBuilder::BlobDataBuilder(const std::string& uuid) : uuid_(uuid) {
13 } 13 }
14 BlobDataBuilder::~BlobDataBuilder() { 14 BlobDataBuilder::~BlobDataBuilder() {
15 } 15 }
16 16
17 void BlobDataBuilder::AppendData(const char* data, size_t length) { 17 void BlobDataBuilder::AppendData(const char* data, size_t length) {
18 DCHECK(length > 0); 18 DCHECK(length > 0);
michaeln 2015/03/09 21:15:18 While your here, can you convert this to an early
cmumford 2015/03/09 22:05:11 Done.
19 scoped_ptr<DataElement> element(new DataElement()); 19 scoped_ptr<DataElement> element(new DataElement());
20 element->SetToBytes(data, length); 20 element->SetToBytes(data, length);
21 items_.push_back(new BlobDataItem(element.Pass())); 21 items_.push_back(new BlobDataItem(element.Pass()));
22 } 22 }
23 23
24 void BlobDataBuilder::AppendFile(const base::FilePath& file_path, 24 void BlobDataBuilder::AppendFile(const base::FilePath& file_path,
25 uint64_t offset, 25 uint64_t offset,
26 uint64_t length, 26 uint64_t length,
27 const base::Time& expected_modification_time) { 27 const base::Time& expected_modification_time) {
28 DCHECK(length > 0);
29 scoped_ptr<DataElement> element(new DataElement()); 28 scoped_ptr<DataElement> element(new DataElement());
30 element->SetToFilePathRange(file_path, offset, length, 29 element->SetToFilePathRange(file_path, offset, length,
31 expected_modification_time); 30 expected_modification_time);
32 items_.push_back( 31 items_.push_back(
33 new BlobDataItem(element.Pass(), ShareableFileReference::Get(file_path))); 32 new BlobDataItem(element.Pass(), ShareableFileReference::Get(file_path)));
34 } 33 }
35 34
36 void BlobDataBuilder::AppendBlob(const std::string& uuid, 35 void BlobDataBuilder::AppendBlob(const std::string& uuid,
37 uint64_t offset, 36 uint64_t offset,
38 uint64_t length) { 37 uint64_t length) {
(...skipping 15 matching lines...) Expand all
54 uint64_t length, 53 uint64_t length,
55 const base::Time& expected_modification_time) { 54 const base::Time& expected_modification_time) {
56 DCHECK(length > 0); 55 DCHECK(length > 0);
57 scoped_ptr<DataElement> element(new DataElement()); 56 scoped_ptr<DataElement> element(new DataElement());
58 element->SetToFileSystemUrlRange(url, offset, length, 57 element->SetToFileSystemUrlRange(url, offset, length,
59 expected_modification_time); 58 expected_modification_time);
60 items_.push_back(new BlobDataItem(element.Pass())); 59 items_.push_back(new BlobDataItem(element.Pass()));
61 } 60 }
62 61
63 } // namespace storage 62 } // namespace storage
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698