| OLD | NEW |
| (Empty) |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef BLIMP_COMMON_BLOB_CACHE_IN_MEMORY_BLOB_CACHE_H_ | |
| 6 #define BLIMP_COMMON_BLOB_CACHE_IN_MEMORY_BLOB_CACHE_H_ | |
| 7 | |
| 8 #include <map> | |
| 9 #include <string> | |
| 10 #include <vector> | |
| 11 | |
| 12 #include "base/macros.h" | |
| 13 #include "base/memory/ref_counted.h" | |
| 14 #include "blimp/common/blimp_common_export.h" | |
| 15 #include "blimp/common/blob_cache/blob_cache.h" | |
| 16 | |
| 17 namespace blimp { | |
| 18 | |
| 19 // InMemoryBlobCache provides an in-memory implementation of BlobCache that | |
| 20 // never evicts items. | |
| 21 class BLIMP_COMMON_EXPORT InMemoryBlobCache : public BlobCache { | |
| 22 public: | |
| 23 InMemoryBlobCache(); | |
| 24 ~InMemoryBlobCache() override; | |
| 25 | |
| 26 // BlobCache implementation. | |
| 27 std::vector<BlobId> GetCachedBlobIds() const override; | |
| 28 bool Contains(const BlobId& id) const override; | |
| 29 void Put(const BlobId& id, BlobDataPtr data) override; | |
| 30 BlobDataPtr Get(const BlobId& id) const override; | |
| 31 | |
| 32 private: | |
| 33 std::map<const BlobId, BlobDataPtr> cache_; | |
| 34 | |
| 35 DISALLOW_COPY_AND_ASSIGN(InMemoryBlobCache); | |
| 36 }; | |
| 37 | |
| 38 } // namespace blimp | |
| 39 | |
| 40 #endif // BLIMP_COMMON_BLOB_CACHE_IN_MEMORY_BLOB_CACHE_H_ | |
| OLD | NEW |