Chromium Code Reviews| Index: webkit/browser/blob/blob_storage_host.cc |
| diff --git a/webkit/browser/blob/blob_storage_host.cc b/webkit/browser/blob/blob_storage_host.cc |
| index eebf3fbace720170519a33de841bd7792ca38c81..f9a1cfb2afb508d57e35951e82f494d636aaeaa3 100644 |
| --- a/webkit/browser/blob/blob_storage_host.cc |
| +++ b/webkit/browser/blob/blob_storage_host.cc |
| @@ -5,6 +5,7 @@ |
| #include "webkit/browser/blob/blob_storage_host.h" |
| #include "base/sequenced_task_runner.h" |
| +#include "base/strings/string_util.h" |
| #include "url/gurl.h" |
| #include "webkit/browser/blob/blob_data_handle.h" |
| #include "webkit/browser/blob/blob_storage_context.h" |
| @@ -98,6 +99,49 @@ bool BlobStorageHost::RevokePublicBlobURL(const GURL& blob_url) { |
| return true; |
| } |
| +namespace { |
| +bool IsPrivateBlobURL(const GURL& url) { |
| + return StartsWithASCII(url.spec(), "blob:blobinternal", true); |
| +} |
| +} |
| + |
| +void BlobStorageHost::DeprecatedRegisterBlobURL( |
| + const GURL& private_url, const std::string& uuid) { |
| + DCHECK(IsPrivateBlobURL(private_url)); |
| + if (!context_.get()) |
| + return; |
| + context_->DeprecatedRegisterPrivateBlobURL(private_url, uuid); |
| + private_blob_urls_.insert(private_url); |
| +} |
| + |
| +void BlobStorageHost::DeprecatedCloneBlobURL( |
| + const GURL& url, const GURL& src_private_url) { |
| + // This method is used in two ways. |
| + // 1. During serialization/deserialization to 'clone' and existing blob. |
|
kinuko
2013/08/21 10:22:20
nit: and -> an
|
| + // In this case the src and dest urls are 'private' blob urls. |
| + // 2. To register public blob urls. In this case the dest url is a |
| + // 'public' blob url. |
| + DCHECK(IsPrivateBlobURL(src_private_url)); |
| + if (!context_.get()) |
| + return; |
| + std::string uuid = context_->LookupUuidFromDeprecatedURL(src_private_url); |
| + if (IsPrivateBlobURL(url)) |
| + DeprecatedRegisterBlobURL(url, uuid); |
| + else |
| + ignore_result(RegisterPublicBlobURL(url, uuid)); |
| +} |
| + |
| +void BlobStorageHost::DeprecatedRevokeBlobURL(const GURL& url) { |
| + if (!context_.get()) |
| + return; |
| + if (IsPrivateBlobURL(url)) { |
| + context_->DeprecatedRevokePrivateBlobURL(url); |
| + private_blob_urls_.insert(url); |
|
ericu
2013/08/21 23:26:09
Why insert the url into private_blob_urls here?
michaeln
2013/08/27 23:24:06
Done (duh)
|
| + } else { |
| + ignore_result(RevokePublicBlobURL(url)); |
| + } |
| +} |
| + |
| bool BlobStorageHost::IsInUseInHost(const std::string& uuid) { |
| return blobs_inuse_map_.find(uuid) != blobs_inuse_map_.end(); |
| } |