summaryrefslogtreecommitdiffstats
path: root/storage/browser
diff options
context:
space:
mode:
authorcmumford <cmumford@chromium.org>2015-03-13 19:39:27 -0700
committerCommit bot <commit-bot@chromium.org>2015-03-14 02:39:58 +0000
commit3a61739491730a1acd96c09a6ae7b79825eb445f (patch)
tree1afa956d9d8c9f922cff38e997b06a06b22a9e7e /storage/browser
parente3b16f181ab489621ca9866f472e012e33b6e9c0 (diff)
downloadchromium_src-3a61739491730a1acd96c09a6ae7b79825eb445f.zip
chromium_src-3a61739491730a1acd96c09a6ae7b79825eb445f.tar.gz
chromium_src-3a61739491730a1acd96c09a6ae7b79825eb445f.tar.bz2
IndexedDB: Fixed support for empty blobs.
This solution allows empty blobs (and files) to be created. Most tests for this change are Blink layout tests, so will land in a separate CL. BUG=399323 Review URL: https://codereview.chromium.org/942633004 Cr-Commit-Position: refs/heads/master@{#320636}
Diffstat (limited to 'storage/browser')
-rw-r--r--storage/browser/blob/blob_data_builder.cc4
-rw-r--r--storage/browser/blob/blob_storage_context.cc1
-rw-r--r--storage/browser/blob/blob_url_request_job.cc2
3 files changed, 3 insertions, 4 deletions
diff --git a/storage/browser/blob/blob_data_builder.cc b/storage/browser/blob/blob_data_builder.cc
index 51946c8..7c305a2 100644
--- a/storage/browser/blob/blob_data_builder.cc
+++ b/storage/browser/blob/blob_data_builder.cc
@@ -15,7 +15,8 @@ BlobDataBuilder::~BlobDataBuilder() {
}
void BlobDataBuilder::AppendData(const char* data, size_t length) {
- DCHECK(length > 0);
+ if (!length)
+ return;
scoped_ptr<DataElement> element(new DataElement());
element->SetToBytes(data, length);
items_.push_back(new BlobDataItem(element.Pass()));
@@ -25,7 +26,6 @@ void BlobDataBuilder::AppendFile(const base::FilePath& file_path,
uint64_t offset,
uint64_t length,
const base::Time& expected_modification_time) {
- DCHECK(length > 0);
scoped_ptr<DataElement> element(new DataElement());
element->SetToFilePathRange(file_path, offset, length,
expected_modification_time);
diff --git a/storage/browser/blob/blob_storage_context.cc b/storage/browser/blob/blob_storage_context.cc
index 71e8939..45c4f8c 100644
--- a/storage/browser/blob/blob_storage_context.cc
+++ b/storage/browser/blob/blob_storage_context.cc
@@ -313,7 +313,6 @@ bool BlobStorageContext::AppendAllocatedBlobItem(
const DataElement& data_element = blob_item->data_element();
uint64 length = data_element.length();
uint64 offset = data_element.offset();
- DCHECK_GT(length, 0u);
UMA_HISTOGRAM_COUNTS("Storage.Blob.StorageSizeBeforeAppend",
memory_usage_ / 1024);
switch (data_element.type()) {
diff --git a/storage/browser/blob/blob_url_request_job.cc b/storage/browser/blob/blob_url_request_job.cc
index 0c938aa..7a79dbc 100644
--- a/storage/browser/blob/blob_url_request_job.cc
+++ b/storage/browser/blob/blob_url_request_job.cc
@@ -345,7 +345,7 @@ bool BlobURLRequestJob::ReadItem() {
// If nothing to read for current item, advance to next item.
if (bytes_to_read == 0) {
AdvanceItem();
- return ReadItem();
+ return true;
}
// Do the reading.