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

Side by Side 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 5 years 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 "base/bind.h" 7 #include "base/bind.h"
8 #include "base/callback.h" 8 #include "base/callback.h"
9 #include "base/location.h" 9 #include "base/location.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 } 68 }
69 69
70 BlobStorageRegistry::Entry* BlobStorageRegistry::GetEntry( 70 BlobStorageRegistry::Entry* BlobStorageRegistry::GetEntry(
71 const std::string& uuid) { 71 const std::string& uuid) {
72 BlobMap::iterator found = blob_map_.find(uuid); 72 BlobMap::iterator found = blob_map_.find(uuid);
73 if (found == blob_map_.end()) 73 if (found == blob_map_.end())
74 return nullptr; 74 return nullptr;
75 return found->second; 75 return found->second;
76 } 76 }
77 77
78 const BlobStorageRegistry::Entry* BlobStorageRegistry::GetEntry(
79 const std::string& uuid) const {
80 return const_cast<BlobStorageRegistry*>(this)->GetEntry(uuid);
81 }
82
78 bool BlobStorageRegistry::CreateUrlMapping(const GURL& blob_url, 83 bool BlobStorageRegistry::CreateUrlMapping(const GURL& blob_url,
79 const std::string& uuid) { 84 const std::string& uuid) {
80 DCHECK(!BlobUrlHasRef(blob_url)); 85 DCHECK(!BlobUrlHasRef(blob_url));
81 if (blob_map_.find(uuid) == blob_map_.end() || IsURLMapped(blob_url)) 86 if (blob_map_.find(uuid) == blob_map_.end() || IsURLMapped(blob_url))
82 return false; 87 return false;
83 url_to_uuid_[blob_url] = uuid; 88 url_to_uuid_[blob_url] = uuid;
84 return true; 89 return true;
85 } 90 }
86 91
87 bool BlobStorageRegistry::DeleteURLMapping(const GURL& blob_url, 92 bool BlobStorageRegistry::DeleteURLMapping(const GURL& blob_url,
(...skipping 19 matching lines...) Expand all
107 url_to_uuid_.find(BlobUrlHasRef(url) ? ClearBlobUrlRef(url) : url); 112 url_to_uuid_.find(BlobUrlHasRef(url) ? ClearBlobUrlRef(url) : url);
108 if (found == url_to_uuid_.end()) 113 if (found == url_to_uuid_.end())
109 return nullptr; 114 return nullptr;
110 Entry* entry = GetEntry(found->second); 115 Entry* entry = GetEntry(found->second);
111 if (entry && uuid) 116 if (entry && uuid)
112 uuid->assign(found->second); 117 uuid->assign(found->second);
113 return entry; 118 return entry;
114 } 119 }
115 120
116 } // namespace storage 121 } // namespace storage
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698