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

Unified Diff: chrome/browser/sync_file_system/local/canned_syncable_file_system.cc

Issue 23223003: Chromium Blob hacking (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 4 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: 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 15e34199658a0e4d928b4b1f945cdf0765e320e0..a8ff563d67ed020bdb435cddca1732a95d992536 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
@@ -146,11 +146,11 @@ class WriteHelper {
public:
WriteHelper() : bytes_written_(0) {}
WriteHelper(MockBlobURLRequestContext* request_context,
- const GURL& blob_url,
+ const std::string& blob_id,
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, blob_id, blob_data)) {}
~WriteHelper() {
if (request_context_) {
@@ -159,6 +159,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) {
@@ -447,14 +449,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(
@@ -625,11 +628,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));
}
@@ -640,9 +645,10 @@ 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,
+ const std::string blob_id(std::string("blob:") + data);
ericu 2013/08/21 23:26:09 What's this blob_id for? Why are you putting the
michaeln 2013/08/27 23:24:06 Done.
+ WriteHelper* helper = new WriteHelper(url_request_context, blob_id, data);
+ operation_runner()->Write(url_request_context, url,
+ helper->scoped_text_blob()->GetBlobDataHandle(), 0,
base::Bind(&WriteHelper::DidWrite,
base::Owned(helper), callback));
}

Powered by Google App Engine
This is Rietveld 408576698