| Index: chrome/browser/sync_file_system/local/canned_syncable_file_system.cc
|
| diff --git a/chrome/browser/sync_file_system/local/canned_syncable_file_system.cc b/chrome/browser/sync_file_system/local/canned_syncable_file_system.cc
|
| index 3a2d71d8b5d7e867b407e680550ebf44ccf02e3d..20bf12ccbefc6499dece43c582f78400fbe39f6c 100644
|
| --- a/chrome/browser/sync_file_system/local/canned_syncable_file_system.cc
|
| +++ b/chrome/browser/sync_file_system/local/canned_syncable_file_system.cc
|
| @@ -10,6 +10,7 @@
|
| #include "base/bind.h"
|
| #include "base/bind_helpers.h"
|
| #include "base/file_util.h"
|
| +#include "base/guid.h"
|
| #include "base/message_loop/message_loop_proxy.h"
|
| #include "base/run_loop.h"
|
| #include "base/single_thread_task_runner.h"
|
| @@ -147,11 +148,13 @@ class WriteHelper {
|
| public:
|
| WriteHelper() : bytes_written_(0) {}
|
| WriteHelper(MockBlobURLRequestContext* request_context,
|
| - const GURL& blob_url,
|
| const std::string& blob_data)
|
| : bytes_written_(0),
|
| request_context_(request_context),
|
| - blob_data_(new ScopedTextBlob(*request_context, blob_url, blob_data)) {}
|
| + blob_data_(new ScopedTextBlob(*request_context,
|
| + base::GenerateGUID(),
|
| + blob_data)) {
|
| + }
|
|
|
| ~WriteHelper() {
|
| if (request_context_) {
|
| @@ -160,6 +163,8 @@ class WriteHelper {
|
| }
|
| }
|
|
|
| + ScopedTextBlob* scoped_text_blob() const { return blob_data_.get(); }
|
| +
|
| void DidWrite(const base::Callback<void(int64 result)>& completion_callback,
|
| PlatformFileError error, int64 bytes, bool complete) {
|
| if (error == base::PLATFORM_FILE_OK) {
|
| @@ -448,14 +453,15 @@ PlatformFileError CannedSyncableFileSystem::ReadDirectory(
|
|
|
| int64 CannedSyncableFileSystem::Write(
|
| net::URLRequestContext* url_request_context,
|
| - const FileSystemURL& url, const GURL& blob_url) {
|
| + const FileSystemURL& url,
|
| + scoped_ptr<webkit_blob::BlobDataHandle> blob_data_handle) {
|
| return RunOnThread<int64>(io_task_runner_.get(),
|
| FROM_HERE,
|
| base::Bind(&CannedSyncableFileSystem::DoWrite,
|
| base::Unretained(this),
|
| url_request_context,
|
| url,
|
| - blob_url));
|
| + base::Passed(&blob_data_handle)));
|
| }
|
|
|
| int64 CannedSyncableFileSystem::WriteString(
|
| @@ -626,11 +632,13 @@ void CannedSyncableFileSystem::DoReadDirectory(
|
|
|
| void CannedSyncableFileSystem::DoWrite(
|
| net::URLRequestContext* url_request_context,
|
| - const FileSystemURL& url, const GURL& blob_url,
|
| + const FileSystemURL& url,
|
| + scoped_ptr<webkit_blob::BlobDataHandle> blob_data_handle,
|
| const WriteCallback& callback) {
|
| EXPECT_TRUE(is_filesystem_opened_);
|
| WriteHelper* helper = new WriteHelper;
|
| - operation_runner()->Write(url_request_context, url, blob_url, 0,
|
| + operation_runner()->Write(url_request_context, url,
|
| + blob_data_handle.Pass(), 0,
|
| base::Bind(&WriteHelper::DidWrite,
|
| base::Owned(helper), callback));
|
| }
|
| @@ -641,9 +649,9 @@ void CannedSyncableFileSystem::DoWriteString(
|
| const WriteCallback& callback) {
|
| MockBlobURLRequestContext* url_request_context(
|
| new MockBlobURLRequestContext(file_system_context_.get()));
|
| - const GURL blob_url(std::string("blob:") + data);
|
| - WriteHelper* helper = new WriteHelper(url_request_context, blob_url, data);
|
| - operation_runner()->Write(url_request_context, url, blob_url, 0,
|
| + WriteHelper* helper = new WriteHelper(url_request_context, data);
|
| + operation_runner()->Write(url_request_context, url,
|
| + helper->scoped_text_blob()->GetBlobDataHandle(), 0,
|
| base::Bind(&WriteHelper::DidWrite,
|
| base::Owned(helper), callback));
|
| }
|
|
|