Index: webkit/browser/blob/blob_storage_context.cc |
diff --git a/webkit/browser/blob/blob_storage_context.cc b/webkit/browser/blob/blob_storage_context.cc |
index 4a0260736a03251eb2a92b7ac1a307d202ba87c4..34a1bee59df78b0dbf010f5308d3c14ef14cd303 100644 |
--- a/webkit/browser/blob/blob_storage_context.cc |
+++ b/webkit/browser/blob/blob_storage_context.cc |
@@ -94,6 +94,14 @@ scoped_ptr<BlobDataHandle> BlobStorageContext::AddFinishedBlob( |
return handle.Pass(); |
} |
+std::string BlobStorageContext::LookupUuidFromDeprecatedURL( |
+ const GURL& url) { |
+ BlobURLMap::const_iterator found = deprecated_blob_urls_.find(url); |
+ if (found == deprecated_blob_urls_.end()) |
+ return std::string(); |
+ return found->second; |
+} |
+ |
void BlobStorageContext::StartBuildingBlob(const std::string& uuid) { |
DCHECK(!IsInUse(uuid) && !uuid.empty()); |
blob_map_[uuid] = BlobMapEntry(1, BEING_BUILT, new BlobData(uuid)); |
@@ -146,7 +154,10 @@ void BlobStorageContext::AppendBlobDataItem( |
item.expected_modification_time()); |
break; |
case BlobData::Item::TYPE_BLOB: { |
- scoped_ptr<BlobDataHandle> src = GetBlobDataFromUUID(item.blob_uuid()); |
+ scoped_ptr<BlobDataHandle> src = GetBlobDataFromUUID( |
+ item.blob_uuid().empty() |
+ ? LookupUuidFromDeprecatedURL(item.blob_url()) |
+ : item.blob_uuid()); |
if (src) |
exceeded_memory = !ExpandStorageItems(target_blob_data, |
src->data(), |
@@ -222,6 +233,21 @@ void BlobStorageContext::RevokePublicBlobURL(const GURL& blob_url) { |
public_blob_urls_.erase(blob_url); |
} |
+void BlobStorageContext::DeprecatedRegisterPrivateBlobURL( |
+ const GURL& url, const std::string& uuid) { |
+ if (!IsInUse(uuid)) |
+ return; |
+ IncrementBlobRefCount(uuid); |
+ deprecated_blob_urls_[url] = uuid; |
+} |
+ |
+void BlobStorageContext::DeprecatedRevokePrivateBlobURL(const GURL& url) { |
+ if (deprecated_blob_urls_.find(url) == deprecated_blob_urls_.end()) |
+ return; |
+ DecrementBlobRefCount(deprecated_blob_urls_[url]); |
+ deprecated_blob_urls_.erase(url); |
+} |
+ |
bool BlobStorageContext::ExpandStorageItems( |
BlobData* target_blob_data, BlobData* src_blob_data, |
uint64 offset, uint64 length) { |