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

Unified Diff: webkit/fileapi/local_file_system_operation.cc

Issue 11410019: ********** Chromium Blob hacking (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 7 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: webkit/fileapi/local_file_system_operation.cc
===================================================================
--- webkit/fileapi/local_file_system_operation.cc (revision 183651)
+++ webkit/fileapi/local_file_system_operation.cc (working copy)
@@ -10,7 +10,9 @@
#include "base/utf_string_conversions.h"
#include "net/base/escape.h"
#include "net/url_request/url_request_context.h"
+#include "webkit/blob/blob_storage_context.h"
#include "webkit/blob/shareable_file_reference.h"
+#include "webkit/blob/blob_url_request_job_factory.h"
#include "webkit/fileapi/async_file_util.h"
#include "webkit/fileapi/cross_operation_delegate.h"
#include "webkit/fileapi/file_observers.h"
@@ -248,10 +250,11 @@
void LocalFileSystemOperation::Write(
const net::URLRequestContext* url_request_context,
const FileSystemURL& url,
- const GURL& blob_url,
+ scoped_ptr<webkit_blob::BlobDataHandle> blob,
int64 offset,
const WriteCallback& callback) {
- GetWriteClosure(url_request_context, url, blob_url, offset, callback).Run();
+ GetWriteClosure(url_request_context, url, blob.Pass(), offset, callback)
+ .Run();
}
void LocalFileSystemOperation::Truncate(const FileSystemURL& url, int64 length,
@@ -584,7 +587,7 @@
base::Closure LocalFileSystemOperation::GetWriteClosure(
const net::URLRequestContext* url_request_context,
const FileSystemURL& url,
- const GURL& blob_url,
+ scoped_ptr<webkit_blob::BlobDataHandle> blob_handle,
int64 offset,
const WriteCallback& callback) {
DCHECK(SetPendingOperationType(kOperationWrite));
@@ -608,15 +611,19 @@
base::PLATFORM_FILE_ERROR_SECURITY);
}
- DCHECK(blob_url.is_valid());
file_writer_delegate_.reset(new FileWriterDelegate(
base::Bind(&LocalFileSystemOperation::DidWrite,
weak_factory_.GetWeakPtr(), url),
writer.Pass()));
write_callback_ = callback;
+
+ // Use a URLRequest to read the blob data that's to be written to the file.
scoped_ptr<net::URLRequest> blob_request(url_request_context->CreateRequest(
- blob_url, file_writer_delegate_.get()));
+ GURL("blob://see_user_data/"), file_writer_delegate_.get()));
+ webkit_blob::BlobProtocolHandler::SetRequestedBlobDataHandle(
+ blob_request.get(),
+ blob_handle.Pass());
return base::Bind(&FileWriterDelegate::Start,
base::Unretained(file_writer_delegate_.get()),
« no previous file with comments | « webkit/fileapi/local_file_system_operation.h ('k') | webkit/fileapi/syncable/syncable_file_system_operation.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698