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

Side by Side Diff: storage/browser/blob/blob_storage_registry.cc

Issue 2236453002: storage: Use stl utilities from the base namespace (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 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 unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "storage/browser/blob/blob_storage_registry.h" 5 #include "storage/browser/blob/blob_storage_registry.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <memory> 9 #include <memory>
10 10
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 BlobStorageRegistry::~BlobStorageRegistry() { 56 BlobStorageRegistry::~BlobStorageRegistry() {
57 // Note: We don't bother calling the construction complete callbacks, as we 57 // Note: We don't bother calling the construction complete callbacks, as we
58 // are only being destructed at the end of the life of the browser process. 58 // are only being destructed at the end of the life of the browser process.
59 // So it shouldn't matter. 59 // So it shouldn't matter.
60 } 60 }
61 61
62 BlobStorageRegistry::Entry* BlobStorageRegistry::CreateEntry( 62 BlobStorageRegistry::Entry* BlobStorageRegistry::CreateEntry(
63 const std::string& uuid, 63 const std::string& uuid,
64 const std::string& content_type, 64 const std::string& content_type,
65 const std::string& content_disposition) { 65 const std::string& content_disposition) {
66 DCHECK(!ContainsKey(blob_map_, uuid)); 66 DCHECK(!base::ContainsKey(blob_map_, uuid));
67 std::unique_ptr<Entry> entry(new Entry(1, BlobState::PENDING)); 67 std::unique_ptr<Entry> entry(new Entry(1, BlobState::PENDING));
68 entry->content_type = content_type; 68 entry->content_type = content_type;
69 entry->content_disposition = content_disposition; 69 entry->content_disposition = content_disposition;
70 Entry* entry_ptr = entry.get(); 70 Entry* entry_ptr = entry.get();
71 blob_map_.add(uuid, std::move(entry)); 71 blob_map_.add(uuid, std::move(entry));
72 return entry_ptr; 72 return entry_ptr;
73 } 73 }
74 74
75 bool BlobStorageRegistry::DeleteEntry(const std::string& uuid) { 75 bool BlobStorageRegistry::DeleteEntry(const std::string& uuid) {
76 return blob_map_.erase(uuid) == 1; 76 return blob_map_.erase(uuid) == 1;
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 URLMap::iterator found = url_to_uuid_.find(blob_url); 108 URLMap::iterator found = url_to_uuid_.find(blob_url);
109 if (found == url_to_uuid_.end()) 109 if (found == url_to_uuid_.end())
110 return false; 110 return false;
111 if (uuid) 111 if (uuid)
112 uuid->assign(found->second); 112 uuid->assign(found->second);
113 url_to_uuid_.erase(found); 113 url_to_uuid_.erase(found);
114 return true; 114 return true;
115 } 115 }
116 116
117 bool BlobStorageRegistry::IsURLMapped(const GURL& blob_url) const { 117 bool BlobStorageRegistry::IsURLMapped(const GURL& blob_url) const {
118 return ContainsKey(url_to_uuid_, blob_url); 118 return base::ContainsKey(url_to_uuid_, blob_url);
119 } 119 }
120 120
121 BlobStorageRegistry::Entry* BlobStorageRegistry::GetEntryFromURL( 121 BlobStorageRegistry::Entry* BlobStorageRegistry::GetEntryFromURL(
122 const GURL& url, 122 const GURL& url,
123 std::string* uuid) { 123 std::string* uuid) {
124 URLMap::iterator found = 124 URLMap::iterator found =
125 url_to_uuid_.find(BlobUrlHasRef(url) ? ClearBlobUrlRef(url) : url); 125 url_to_uuid_.find(BlobUrlHasRef(url) ? ClearBlobUrlRef(url) : url);
126 if (found == url_to_uuid_.end()) 126 if (found == url_to_uuid_.end())
127 return nullptr; 127 return nullptr;
128 Entry* entry = GetEntry(found->second); 128 Entry* entry = GetEntry(found->second);
129 if (entry && uuid) 129 if (entry && uuid)
130 uuid->assign(found->second); 130 uuid->assign(found->second);
131 return entry; 131 return entry;
132 } 132 }
133 133
134 } // namespace storage 134 } // namespace storage
OLDNEW
« no previous file with comments | « storage/browser/blob/blob_reader.cc ('k') | storage/browser/fileapi/copy_or_move_operation_delegate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698