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

Unified Diff: content/browser/indexed_db/indexed_db_backing_store.cc

Issue 942633004: IndexedDB: Fixed support for empty blobs. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Deleted CREATE_NEW_FILE. Creating file before using FileStreamWriter. Created 5 years, 10 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 side-by-side diff with in-line comments
Download patch
Index: content/browser/indexed_db/indexed_db_backing_store.cc
diff --git a/content/browser/indexed_db/indexed_db_backing_store.cc b/content/browser/indexed_db/indexed_db_backing_store.cc
index 4ae9ed4f236722b4c76dbcb62ee677b4223794c9..9a8421f5d403138c7110a97c7d720496aa337f10 100644
--- a/content/browser/indexed_db/indexed_db_backing_store.cc
+++ b/content/browser/indexed_db/indexed_db_backing_store.cc
@@ -2360,11 +2360,8 @@ class LocalWriteClosure : public FileWriterDelegate::DelegateWriteCallback,
net::URLRequestContext* request_context) {
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO));
scoped_ptr<storage::FileStreamWriter> writer(
- storage::FileStreamWriter::CreateForLocalFile(
- task_runner_.get(),
- file_path,
- 0,
- storage::FileStreamWriter::CREATE_NEW_FILE));
+ storage::FileStreamWriter::CreateForLocalFile(task_runner_.get(),
+ file_path, 0));
scoped_ptr<FileWriterDelegate> delegate(new FileWriterDelegate(
writer.Pass(), storage::FlushPolicy::FLUSH_ON_COMPLETION));
@@ -2456,6 +2453,11 @@ bool IndexedDBBackingStore::WriteBlobFile(
DCHECK(descriptor.url().is_valid());
scoped_refptr<LocalWriteClosure> write_closure(
new LocalWriteClosure(chained_blob_writer, task_runner_.get()));
+ {
+ // FileStreamWriter needs an existing file, so create one now.
+ base::File file(path,
jsbell 2015/03/03 01:01:48 Should we do this in WriteBlobToFileOnIOThread ins
cmumford 2015/03/03 22:26:09 Can't do file I/O on that thread - only reason why
+ base::File::FLAG_CREATE_ALWAYS | base::File::FLAG_WRITE);
michaeln 2015/03/03 00:02:51 nit: ditto file.Close()
cmumford 2015/03/03 22:26:09 Done.
+ }
content::BrowserThread::PostTask(
content::BrowserThread::IO,
FROM_HERE,

Powered by Google App Engine
This is Rietveld 408576698