| OLD | NEW |
| 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 #ifndef STORAGE_BROWSER_BLOB_BLOB_STORAGE_REGISTRY_H_ | 5 #ifndef STORAGE_BROWSER_BLOB_BLOB_STORAGE_REGISTRY_H_ |
| 6 #define STORAGE_BROWSER_BLOB_BLOB_STORAGE_REGISTRY_H_ | 6 #define STORAGE_BROWSER_BLOB_BLOB_STORAGE_REGISTRY_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 | 9 |
| 10 #include <map> | 10 #include <map> |
| 11 #include <memory> | 11 #include <memory> |
| 12 #include <string> | 12 #include <string> |
| 13 #include <unordered_map> |
| 13 #include <vector> | 14 #include <vector> |
| 14 | 15 |
| 15 #include "base/callback_forward.h" | 16 #include "base/callback_forward.h" |
| 16 #include "base/containers/scoped_ptr_hash_map.h" | |
| 17 #include "base/macros.h" | 17 #include "base/macros.h" |
| 18 #include "storage/browser/storage_browser_export.h" | 18 #include "storage/browser/storage_browser_export.h" |
| 19 #include "storage/common/blob_storage/blob_storage_constants.h" | 19 #include "storage/common/blob_storage/blob_storage_constants.h" |
| 20 | 20 |
| 21 class GURL; | 21 class GURL; |
| 22 | 22 |
| 23 namespace storage { | 23 namespace storage { |
| 24 class BlobEntry; | 24 class BlobEntry; |
| 25 | 25 |
| 26 // This class stores the blob data in the various states of construction, as | 26 // This class stores the blob data in the various states of construction, as |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 | 63 |
| 64 // Returns the entry from the given url, and optionally populates the uuid for | 64 // Returns the entry from the given url, and optionally populates the uuid for |
| 65 // that entry. Returns a nullptr if the mapping or entry doesn't exist. | 65 // that entry. Returns a nullptr if the mapping or entry doesn't exist. |
| 66 BlobEntry* GetEntryFromURL(const GURL& url, std::string* uuid); | 66 BlobEntry* GetEntryFromURL(const GURL& url, std::string* uuid); |
| 67 | 67 |
| 68 size_t blob_count() const { return blob_map_.size(); } | 68 size_t blob_count() const { return blob_map_.size(); } |
| 69 size_t url_count() const { return url_to_uuid_.size(); } | 69 size_t url_count() const { return url_to_uuid_.size(); } |
| 70 | 70 |
| 71 private: | 71 private: |
| 72 friend class ViewBlobInternalsJob; | 72 friend class ViewBlobInternalsJob; |
| 73 using BlobMap = | |
| 74 base::ScopedPtrHashMap<std::string, std::unique_ptr<BlobEntry>>; | |
| 75 using URLMap = std::map<GURL, std::string>; | |
| 76 | 73 |
| 77 BlobMap blob_map_; | 74 std::unordered_map<std::string, std::unique_ptr<BlobEntry>> blob_map_; |
| 78 URLMap url_to_uuid_; | 75 std::map<GURL, std::string> url_to_uuid_; |
| 79 | 76 |
| 80 DISALLOW_COPY_AND_ASSIGN(BlobStorageRegistry); | 77 DISALLOW_COPY_AND_ASSIGN(BlobStorageRegistry); |
| 81 }; | 78 }; |
| 82 | 79 |
| 83 } // namespace storage | 80 } // namespace storage |
| 84 #endif // STORAGE_BROWSER_BLOB_BLOB_STORAGE_REGISTRY_H_ | 81 #endif // STORAGE_BROWSER_BLOB_BLOB_STORAGE_REGISTRY_H_ |
| OLD | NEW |