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

Unified Diff: webkit/browser/blob/blob_storage_context.cc

Issue 23223003: Chromium Blob hacking (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 3 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
« no previous file with comments | « webkit/browser/blob/blob_storage_context.h ('k') | webkit/browser/blob/blob_storage_context_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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) {
« no previous file with comments | « webkit/browser/blob/blob_storage_context.h ('k') | webkit/browser/blob/blob_storage_context_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698