| Index: content/browser/fileapi/chrome_blob_storage_context.cc
|
| diff --git a/content/browser/fileapi/chrome_blob_storage_context.cc b/content/browser/fileapi/chrome_blob_storage_context.cc
|
| index 97151a83f67426d6483882bb675f13a9deab6e32..fce0bed906621b099fcd5aa647f9c4dd3a6b294a 100644
|
| --- a/content/browser/fileapi/chrome_blob_storage_context.cc
|
| +++ b/content/browser/fileapi/chrome_blob_storage_context.cc
|
| @@ -5,8 +5,11 @@
|
| #include "content/browser/fileapi/chrome_blob_storage_context.h"
|
|
|
| #include "base/bind.h"
|
| +#include "base/guid.h"
|
| +#include "content/public/browser/blob_handle.h"
|
| #include "content/public/browser/browser_context.h"
|
| #include "content/public/browser/browser_thread.h"
|
| +#include "webkit/browser/blob/blob_data_handle.h"
|
| #include "webkit/browser/blob/blob_storage_context.h"
|
|
|
| using base::UserDataAdapter;
|
| @@ -14,6 +17,26 @@ using webkit_blob::BlobStorageContext;
|
|
|
| namespace content {
|
|
|
| +namespace {
|
| +
|
| +class BlobHandleImpl : public BlobHandle {
|
| + public:
|
| + BlobHandleImpl(scoped_ptr<webkit_blob::BlobDataHandle> handle)
|
| + : handle_(handle.Pass()) {
|
| + }
|
| +
|
| + virtual ~BlobHandleImpl() {}
|
| +
|
| + virtual std::string GetUUID() OVERRIDE {
|
| + return handle_->uuid();
|
| + }
|
| +
|
| + private:
|
| + scoped_ptr<webkit_blob::BlobDataHandle> handle_;
|
| +};
|
| +
|
| +} // namespace
|
| +
|
| static const char* kBlobStorageContextKeyName = "content_blob_storage_context";
|
|
|
| ChromeBlobStorageContext::ChromeBlobStorageContext() {}
|
| @@ -43,6 +66,25 @@ void ChromeBlobStorageContext::InitializeOnIOThread() {
|
| context_.reset(new BlobStorageContext());
|
| }
|
|
|
| +scoped_ptr<BlobHandle> ChromeBlobStorageContext::CreateMemoryBackedBlob(
|
| + const char* data, size_t length) {
|
| + DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
|
| +
|
| + std::string uuid(base::GenerateGUID());
|
| + scoped_refptr<webkit_blob::BlobData> blob_data =
|
| + new webkit_blob::BlobData(uuid);
|
| + blob_data->AppendData(data, length);
|
| +
|
| + scoped_ptr<webkit_blob::BlobDataHandle> blob_data_handle =
|
| + context_->AddFinishedBlob(blob_data.get());
|
| + if (!blob_data_handle)
|
| + return scoped_ptr<BlobHandle>();
|
| +
|
| + scoped_ptr<BlobHandle> blob_handle(
|
| + new BlobHandleImpl(blob_data_handle.Pass()));
|
| + return blob_handle.Pass();
|
| +}
|
| +
|
| ChromeBlobStorageContext::~ChromeBlobStorageContext() {}
|
|
|
| void ChromeBlobStorageContext::DeleteOnCorrectThread() const {
|
|
|