Commit aecef39c authored by avi's avatar avi Committed by Commit bot

Remove base::ScopedPtrHashMap from storage/.

BUG=579229

Review-Url: https://codereview.chromium.org/2604913002
Cr-Commit-Position: refs/heads/master@{#440872}
parent 3171a243
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
#include "base/bind.h" #include "base/bind.h"
#include "base/location.h" #include "base/location.h"
#include "base/logging.h" #include "base/logging.h"
#include "base/stl_util.h" #include "base/memory/ptr_util.h"
#include "storage/browser/blob/blob_entry.h" #include "storage/browser/blob/blob_entry.h"
#include "url/gurl.h" #include "url/gurl.h"
...@@ -49,11 +49,11 @@ BlobEntry* BlobStorageRegistry::CreateEntry( ...@@ -49,11 +49,11 @@ BlobEntry* BlobStorageRegistry::CreateEntry(
const std::string& uuid, const std::string& uuid,
const std::string& content_type, const std::string& content_type,
const std::string& content_disposition) { const std::string& content_disposition) {
DCHECK(!ContainsKey(blob_map_, uuid)); DCHECK(blob_map_.find(uuid) == blob_map_.end());
std::unique_ptr<BlobEntry> entry( std::unique_ptr<BlobEntry> entry =
new BlobEntry(content_type, content_disposition)); base::MakeUnique<BlobEntry>(content_type, content_disposition);
BlobEntry* entry_ptr = entry.get(); BlobEntry* entry_ptr = entry.get();
blob_map_.add(uuid, std::move(entry)); blob_map_[uuid] = std::move(entry);
return entry_ptr; return entry_ptr;
} }
...@@ -66,10 +66,10 @@ bool BlobStorageRegistry::HasEntry(const std::string& uuid) const { ...@@ -66,10 +66,10 @@ bool BlobStorageRegistry::HasEntry(const std::string& uuid) const {
} }
BlobEntry* BlobStorageRegistry::GetEntry(const std::string& uuid) { BlobEntry* BlobStorageRegistry::GetEntry(const std::string& uuid) {
BlobMap::iterator found = blob_map_.find(uuid); auto found = blob_map_.find(uuid);
if (found == blob_map_.end()) if (found == blob_map_.end())
return nullptr; return nullptr;
return found->second; return found->second.get();
} }
const BlobEntry* BlobStorageRegistry::GetEntry(const std::string& uuid) const { const BlobEntry* BlobStorageRegistry::GetEntry(const std::string& uuid) const {
...@@ -88,7 +88,7 @@ bool BlobStorageRegistry::CreateUrlMapping(const GURL& blob_url, ...@@ -88,7 +88,7 @@ bool BlobStorageRegistry::CreateUrlMapping(const GURL& blob_url,
bool BlobStorageRegistry::DeleteURLMapping(const GURL& blob_url, bool BlobStorageRegistry::DeleteURLMapping(const GURL& blob_url,
std::string* uuid) { std::string* uuid) {
DCHECK(!BlobUrlHasRef(blob_url)); DCHECK(!BlobUrlHasRef(blob_url));
URLMap::iterator found = url_to_uuid_.find(blob_url); auto found = url_to_uuid_.find(blob_url);
if (found == url_to_uuid_.end()) if (found == url_to_uuid_.end())
return false; return false;
if (uuid) if (uuid)
...@@ -98,12 +98,12 @@ bool BlobStorageRegistry::DeleteURLMapping(const GURL& blob_url, ...@@ -98,12 +98,12 @@ bool BlobStorageRegistry::DeleteURLMapping(const GURL& blob_url,
} }
bool BlobStorageRegistry::IsURLMapped(const GURL& blob_url) const { bool BlobStorageRegistry::IsURLMapped(const GURL& blob_url) const {
return base::ContainsKey(url_to_uuid_, blob_url); return url_to_uuid_.find(blob_url) != url_to_uuid_.end();
} }
BlobEntry* BlobStorageRegistry::GetEntryFromURL(const GURL& url, BlobEntry* BlobStorageRegistry::GetEntryFromURL(const GURL& url,
std::string* uuid) { std::string* uuid) {
URLMap::iterator found = auto found =
url_to_uuid_.find(BlobUrlHasRef(url) ? ClearBlobUrlRef(url) : url); url_to_uuid_.find(BlobUrlHasRef(url) ? ClearBlobUrlRef(url) : url);
if (found == url_to_uuid_.end()) if (found == url_to_uuid_.end())
return nullptr; return nullptr;
......
...@@ -10,10 +10,10 @@ ...@@ -10,10 +10,10 @@
#include <map> #include <map>
#include <memory> #include <memory>
#include <string> #include <string>
#include <unordered_map>
#include <vector> #include <vector>
#include "base/callback_forward.h" #include "base/callback_forward.h"
#include "base/containers/scoped_ptr_hash_map.h"
#include "base/macros.h" #include "base/macros.h"
#include "storage/browser/storage_browser_export.h" #include "storage/browser/storage_browser_export.h"
#include "storage/common/blob_storage/blob_storage_constants.h" #include "storage/common/blob_storage/blob_storage_constants.h"
...@@ -70,12 +70,9 @@ class STORAGE_EXPORT BlobStorageRegistry { ...@@ -70,12 +70,9 @@ class STORAGE_EXPORT BlobStorageRegistry {
private: private:
friend class ViewBlobInternalsJob; friend class ViewBlobInternalsJob;
using BlobMap =
base::ScopedPtrHashMap<std::string, std::unique_ptr<BlobEntry>>;
using URLMap = std::map<GURL, std::string>;
BlobMap blob_map_; std::unordered_map<std::string, std::unique_ptr<BlobEntry>> blob_map_;
URLMap url_to_uuid_; std::map<GURL, std::string> url_to_uuid_;
DISALLOW_COPY_AND_ASSIGN(BlobStorageRegistry); DISALLOW_COPY_AND_ASSIGN(BlobStorageRegistry);
}; };
......
...@@ -153,8 +153,7 @@ int ViewBlobInternalsJob::GetData( ...@@ -153,8 +153,7 @@ int ViewBlobInternalsJob::GetData(
} }
void ViewBlobInternalsJob::GenerateHTML(std::string* out) const { void ViewBlobInternalsJob::GenerateHTML(std::string* out) const {
for (BlobStorageRegistry::BlobMap::const_iterator iter = for (auto iter = blob_storage_context_->registry().blob_map_.begin();
blob_storage_context_->registry().blob_map_.begin();
iter != blob_storage_context_->registry().blob_map_.end(); ++iter) { iter != blob_storage_context_->registry().blob_map_.end(); ++iter) {
AddHTMLBoldText(iter->first, out); AddHTMLBoldText(iter->first, out);
GenerateHTMLForBlobData(*iter->second, iter->second->content_type(), GenerateHTMLForBlobData(*iter->second, iter->second->content_type(),
...@@ -163,8 +162,7 @@ void ViewBlobInternalsJob::GenerateHTML(std::string* out) const { ...@@ -163,8 +162,7 @@ void ViewBlobInternalsJob::GenerateHTML(std::string* out) const {
} }
if (!blob_storage_context_->registry().url_to_uuid_.empty()) { if (!blob_storage_context_->registry().url_to_uuid_.empty()) {
AddHorizontalRule(out); AddHorizontalRule(out);
for (BlobStorageRegistry::URLMap::const_iterator iter = for (auto iter = blob_storage_context_->registry().url_to_uuid_.begin();
blob_storage_context_->registry().url_to_uuid_.begin();
iter != blob_storage_context_->registry().url_to_uuid_.end(); ++iter) { iter != blob_storage_context_->registry().url_to_uuid_.end(); ++iter) {
AddHTMLBoldText(iter->first.spec(), out); AddHTMLBoldText(iter->first.spec(), out);
StartHTMLList(out); StartHTMLList(out);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment