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

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/fixes Created 4 years, 11 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..e89fab40da5fb83901eeff27239d964cb80c0fb0 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() {}
@@ -60,7 +60,7 @@ BlobStorageRegistry::~BlobStorageRegistry() {
BlobStorageRegistry::Entry* BlobStorageRegistry::CreateEntry(
const std::string& uuid) {
DCHECK(!ContainsKey(blob_map_, uuid));
- Entry* entry = new Entry(1, BlobState::RESERVED);
+ Entry* entry = new Entry(1, BlobState::PENDING);
blob_map_.add(uuid, make_scoped_ptr(entry));
return entry;
}
@@ -69,6 +69,10 @@ 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 +81,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