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

Unified Diff: storage/browser/blob/blob_storage_registry.cc

Issue 1234813004: [BlobAsync] Asynchronous Blob Construction Final Patch (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@blob-protocol-change
Patch Set: comments Created 4 years, 9 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
Index: storage/browser/blob/blob_storage_registry.cc
diff --git a/storage/browser/blob/blob_storage_registry.cc b/storage/browser/blob/blob_storage_registry.cc
index 8ee624f7cec39f83b0e09880fbbe0fdd542c9b1a..56c04829fbfe6c28f0dd9db7995a4d3f9ca74dab 100644
--- a/storage/browser/blob/blob_storage_registry.cc
+++ b/storage/browser/blob/blob_storage_registry.cc
@@ -37,7 +37,7 @@ GURL ClearBlobUrlRef(const GURL& url) {
} // namespace
BlobStorageRegistry::Entry::Entry(int refcount, BlobState state)
- : refcount(refcount), state(state), exceeded_memory(false) {}
+ : refcount(refcount), state(state) {}
BlobStorageRegistry::Entry::~Entry() {}
@@ -58,17 +58,26 @@ BlobStorageRegistry::~BlobStorageRegistry() {
}
BlobStorageRegistry::Entry* BlobStorageRegistry::CreateEntry(
- const std::string& uuid) {
+ const std::string& uuid,
+ const std::string& content_type,
+ const std::string& content_disposition) {
DCHECK(!ContainsKey(blob_map_, uuid));
- Entry* entry = new Entry(1, BlobState::RESERVED);
- blob_map_.add(uuid, make_scoped_ptr(entry));
- return entry;
+ scoped_ptr<Entry> entry(new Entry(1, BlobState::PENDING));
+ entry->content_type = content_type;
+ entry->content_disposition = content_disposition;
+ Entry* entry_ptr = entry.get();
+ blob_map_.add(uuid, std::move(entry));
+ return entry_ptr;
}
bool BlobStorageRegistry::DeleteEntry(const std::string& uuid) {
return blob_map_.erase(uuid) == 1;
}
+bool BlobStorageRegistry::HasEntry(const std::string& uuid) const {
+ return blob_map_.find(uuid) != blob_map_.end();
+}
+
BlobStorageRegistry::Entry* BlobStorageRegistry::GetEntry(
const std::string& uuid) {
BlobMap::iterator found = blob_map_.find(uuid);
@@ -77,6 +86,11 @@ BlobStorageRegistry::Entry* BlobStorageRegistry::GetEntry(
return found->second;
}
+const BlobStorageRegistry::Entry* BlobStorageRegistry::GetEntry(
+ const std::string& uuid) const {
+ return const_cast<BlobStorageRegistry*>(this)->GetEntry(uuid);
+}
+
bool BlobStorageRegistry::CreateUrlMapping(const GURL& blob_url,
const std::string& uuid) {
DCHECK(!BlobUrlHasRef(blob_url));

Powered by Google App Engine
This is Rietveld 408576698