| 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 9ddcb99b555ed11cdcbeb0228307e518e77c6ba8..883bd071a548eda9aae28237fc17334492a1a538 100644
|
| --- a/storage/browser/blob/blob_storage_registry.cc
|
| +++ b/storage/browser/blob/blob_storage_registry.cc
|
| @@ -9,15 +9,13 @@
|
| #include <memory>
|
|
|
| #include "base/bind.h"
|
| -#include "base/callback.h"
|
| #include "base/location.h"
|
| #include "base/logging.h"
|
| -#include "base/message_loop/message_loop.h"
|
| #include "base/stl_util.h"
|
| +#include "storage/browser/blob/internal_blob_data.h"
|
| #include "url/gurl.h"
|
|
|
| namespace storage {
|
| -using BlobState = BlobStorageRegistry::BlobState;
|
|
|
| namespace {
|
| // We can't use GURL directly for these hash fragment manipulations
|
| @@ -38,18 +36,6 @@ GURL ClearBlobUrlRef(const GURL& url) {
|
|
|
| } // namespace
|
|
|
| -BlobStorageRegistry::Entry::Entry(int refcount, BlobState state)
|
| - : refcount(refcount), state(state) {}
|
| -
|
| -BlobStorageRegistry::Entry::~Entry() {}
|
| -
|
| -bool BlobStorageRegistry::Entry::TestAndSetState(BlobState expected,
|
| - BlobState set) {
|
| - if (state != expected)
|
| - return false;
|
| - state = set;
|
| - return true;
|
| -}
|
|
|
| BlobStorageRegistry::BlobStorageRegistry() {}
|
|
|
| @@ -59,15 +45,14 @@ BlobStorageRegistry::~BlobStorageRegistry() {
|
| // So it shouldn't matter.
|
| }
|
|
|
| -BlobStorageRegistry::Entry* BlobStorageRegistry::CreateEntry(
|
| +InternalBlobData* BlobStorageRegistry::CreateEntry(
|
| const std::string& uuid,
|
| const std::string& content_type,
|
| const std::string& content_disposition) {
|
| - DCHECK(!base::ContainsKey(blob_map_, uuid));
|
| - std::unique_ptr<Entry> entry(new Entry(1, BlobState::PENDING));
|
| - entry->content_type = content_type;
|
| - entry->content_disposition = content_disposition;
|
| - Entry* entry_ptr = entry.get();
|
| + DCHECK(!ContainsKey(blob_map_, uuid));
|
| + std::unique_ptr<InternalBlobData> entry(
|
| + new InternalBlobData(content_type, content_disposition));
|
| + InternalBlobData* entry_ptr = entry.get();
|
| blob_map_.add(uuid, std::move(entry));
|
| return entry_ptr;
|
| }
|
| @@ -80,15 +65,14 @@ bool BlobStorageRegistry::HasEntry(const std::string& uuid) const {
|
| return blob_map_.find(uuid) != blob_map_.end();
|
| }
|
|
|
| -BlobStorageRegistry::Entry* BlobStorageRegistry::GetEntry(
|
| - const std::string& uuid) {
|
| +InternalBlobData* BlobStorageRegistry::GetEntry(const std::string& uuid) {
|
| BlobMap::iterator found = blob_map_.find(uuid);
|
| if (found == blob_map_.end())
|
| return nullptr;
|
| return found->second;
|
| }
|
|
|
| -const BlobStorageRegistry::Entry* BlobStorageRegistry::GetEntry(
|
| +const InternalBlobData* BlobStorageRegistry::GetEntry(
|
| const std::string& uuid) const {
|
| return const_cast<BlobStorageRegistry*>(this)->GetEntry(uuid);
|
| }
|
| @@ -118,14 +102,13 @@ bool BlobStorageRegistry::IsURLMapped(const GURL& blob_url) const {
|
| return base::ContainsKey(url_to_uuid_, blob_url);
|
| }
|
|
|
| -BlobStorageRegistry::Entry* BlobStorageRegistry::GetEntryFromURL(
|
| - const GURL& url,
|
| - std::string* uuid) {
|
| +InternalBlobData* BlobStorageRegistry::GetEntryFromURL(const GURL& url,
|
| + std::string* uuid) {
|
| URLMap::iterator found =
|
| url_to_uuid_.find(BlobUrlHasRef(url) ? ClearBlobUrlRef(url) : url);
|
| if (found == url_to_uuid_.end())
|
| return nullptr;
|
| - Entry* entry = GetEntry(found->second);
|
| + InternalBlobData* entry = GetEntry(found->second);
|
| if (entry && uuid)
|
| uuid->assign(found->second);
|
| return entry;
|
|
|