| Index: webkit/tools/test_shell/test_shell_webblobregistry_impl.cc
|
| ===================================================================
|
| --- webkit/tools/test_shell/test_shell_webblobregistry_impl.cc (revision 186525)
|
| +++ webkit/tools/test_shell/test_shell_webblobregistry_impl.cc (working copy)
|
| @@ -11,20 +11,21 @@
|
| #include "third_party/WebKit/Source/Platform/chromium/public/WebURL.h"
|
| #include "webkit/base/file_path_string_conversions.h"
|
| #include "webkit/blob/blob_data.h"
|
| -#include "webkit/blob/blob_storage_controller.h"
|
| +#include "webkit/blob/blob_storage_context.h"
|
|
|
| using WebKit::WebBlobData;
|
| +using WebKit::WebString;
|
| using WebKit::WebURL;
|
| using webkit_blob::BlobData;
|
|
|
| namespace {
|
|
|
| MessageLoop* g_io_thread;
|
| -webkit_blob::BlobStorageController* g_blob_storage_controller;
|
| +webkit_blob::BlobStorageContext* g_blob_storage_context;
|
|
|
| // Creates a new BlobData from WebBlobData.
|
| -BlobData* NewBlobData(const WebBlobData& data) {
|
| - BlobData* blob = new BlobData;
|
| +BlobData* NewBlobData(const std::string& uuid, const WebBlobData& data) {
|
| + BlobData* blob = new BlobData(uuid);
|
| size_t i = 0;
|
| WebBlobData::Item item;
|
| while (data.itemAt(i++, item)) {
|
| @@ -48,7 +49,7 @@
|
| case WebBlobData::Item::TypeBlob:
|
| if (item.length) {
|
| blob->AppendBlob(
|
| - item.blobURL,
|
| + item.blobUUID.utf8(),
|
| static_cast<uint64>(item.offset),
|
| static_cast<uint64>(item.length));
|
| }
|
| @@ -66,59 +67,85 @@
|
|
|
| /* static */
|
| void TestShellWebBlobRegistryImpl::InitializeOnIOThread(
|
| - webkit_blob::BlobStorageController* blob_storage_controller) {
|
| + webkit_blob::BlobStorageContext* blob_storage_context) {
|
| g_io_thread = MessageLoop::current();
|
| - g_blob_storage_controller = blob_storage_controller;
|
| + g_blob_storage_context = blob_storage_context;
|
| }
|
|
|
| /* static */
|
| void TestShellWebBlobRegistryImpl::Cleanup() {
|
| g_io_thread = NULL;
|
| - g_blob_storage_controller = NULL;
|
| + g_blob_storage_context = NULL;
|
| }
|
|
|
| -void TestShellWebBlobRegistryImpl::registerBlobURL(
|
| - const WebURL& url, WebBlobData& data) {
|
| +void TestShellWebBlobRegistryImpl::registerBlobData(
|
| + const WebString& uuid, const WebBlobData& data) {
|
| DCHECK(g_io_thread);
|
| - GURL thread_safe_url = url; // WebURL uses refcounted strings.
|
| g_io_thread->PostTask(FROM_HERE, base::Bind(
|
| &TestShellWebBlobRegistryImpl::AddFinishedBlob, this,
|
| - thread_safe_url, make_scoped_refptr(NewBlobData(data))));
|
| + make_scoped_refptr(NewBlobData(uuid.utf8(), data))));
|
| }
|
|
|
| -void TestShellWebBlobRegistryImpl::registerBlobURL(
|
| - const WebURL& url, const WebURL& src_url) {
|
| +void TestShellWebBlobRegistryImpl::addBlobDataRef(const WebKit::WebString& uuid) {
|
| DCHECK(g_io_thread);
|
| + std::string thread_safe_uuid = uuid.utf8();
|
| + g_io_thread->PostTask(FROM_HERE, base::Bind(
|
| + &TestShellWebBlobRegistryImpl::AddBlobDataRef, this, thread_safe_uuid));
|
| +}
|
| +
|
| +void TestShellWebBlobRegistryImpl::removeBlobDataRef(const WebKit::WebString& uuid) {
|
| + DCHECK(g_io_thread);
|
| + std::string thread_safe_uuid = uuid.utf8();
|
| + g_io_thread->PostTask(FROM_HERE, base::Bind(
|
| + &TestShellWebBlobRegistryImpl::RemoveBlobDataRef, this, thread_safe_uuid));
|
| +}
|
| +
|
| +void TestShellWebBlobRegistryImpl::registerPublicBlobURL(
|
| + const WebURL& url, const WebKit::WebString& uuid) {
|
| + DCHECK(g_io_thread);
|
| GURL thread_safe_url = url;
|
| - GURL thread_safe_src_url = src_url;
|
| + std::string thread_safe_uuid = uuid.utf8();
|
| g_io_thread->PostTask(FROM_HERE, base::Bind(
|
| - &TestShellWebBlobRegistryImpl::CloneBlob, this,
|
| - thread_safe_url, thread_safe_src_url));
|
| + &TestShellWebBlobRegistryImpl::RegisterPublicBlobURL, this,
|
| + thread_safe_url, thread_safe_uuid));
|
| }
|
|
|
| -void TestShellWebBlobRegistryImpl::unregisterBlobURL(const WebURL& url) {
|
| +void TestShellWebBlobRegistryImpl::revokePublicBlobURL(const WebURL& url) {
|
| DCHECK(g_io_thread);
|
| GURL thread_safe_url = url;
|
| g_io_thread->PostTask(FROM_HERE, base::Bind(
|
| - &TestShellWebBlobRegistryImpl::RemoveBlob, this,
|
| + &TestShellWebBlobRegistryImpl::RevokePublicBlobURL, this,
|
| thread_safe_url));
|
| }
|
|
|
| TestShellWebBlobRegistryImpl::TestShellWebBlobRegistryImpl() {}
|
|
|
| void TestShellWebBlobRegistryImpl::AddFinishedBlob(
|
| - const GURL& url, BlobData* blob_data) {
|
| - DCHECK(g_blob_storage_controller);
|
| - g_blob_storage_controller->AddFinishedBlob(url, blob_data);
|
| + BlobData* blob_data) {
|
| + DCHECK(g_blob_storage_context);
|
| + g_blob_storage_context->AddFinishedBlob(blob_data);
|
| }
|
|
|
| -void TestShellWebBlobRegistryImpl::CloneBlob(
|
| - const GURL& url, const GURL& src_url) {
|
| - DCHECK(g_blob_storage_controller);
|
| - g_blob_storage_controller->CloneBlob(url, src_url);
|
| +void TestShellWebBlobRegistryImpl::AddBlobDataRef(
|
| + const std::string& uuid) {
|
| + DCHECK(g_blob_storage_context);
|
| + g_blob_storage_context->IncrementBlobRefCount(uuid);
|
| }
|
|
|
| -void TestShellWebBlobRegistryImpl::RemoveBlob(const GURL& url) {
|
| - DCHECK(g_blob_storage_controller);
|
| - g_blob_storage_controller->RemoveBlob(url);
|
| +void TestShellWebBlobRegistryImpl::RemoveBlobDataRef(
|
| + const std::string& uuid) {
|
| + DCHECK(g_blob_storage_context);
|
| + g_blob_storage_context->DecrementBlobRefCount(uuid);
|
| }
|
| +
|
| +void TestShellWebBlobRegistryImpl::RegisterPublicBlobURL(
|
| + const GURL& url, const std::string& uuid) {
|
| + DCHECK(g_blob_storage_context);
|
| + g_blob_storage_context->RegisterPublicBlobURL(url, uuid);
|
| +}
|
| +
|
| +void TestShellWebBlobRegistryImpl::RevokePublicBlobURL(const GURL& url) {
|
| + DCHECK(g_blob_storage_context);
|
| + g_blob_storage_context->RevokePublicBlobURL(url);
|
| +}
|
| +
|
|
|