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 |
| 11 #include "base/macros.h" |
| 12 #include "base/memory/ref_counted.h" |
| 13 #include "blimp/common/blimp_common_export.h" |
| 14 #include "blimp/common/blob_cache/blob_cache.h" |
| 15 |
| 16 namespace blimp { |
| 17 |
| 18 // InMemoryBlobCache provides an in-memory implementation of BlobCache that |
| 19 // never evicts items. |
| 20 class BLIMP_COMMON_EXPORT InMemoryBlobCache : public BlobCache { |
| 21 public: |
| 22 InMemoryBlobCache(); |
| 23 ~InMemoryBlobCache() override; |
| 24 |
| 25 // BlobCache implementation. |
| 26 bool Contains(BlobId& id) const override; |
| 27 void Put(BlobId& id, BlobData data) override; |
| 28 BlobData Get(BlobId& id) const override; |
| 29 |
| 30 private: |
| 31 std::map<BlobId, BlobData> cache_; |
| 32 |
| 33 DISALLOW_COPY_AND_ASSIGN(InMemoryBlobCache); |
| 34 }; |
| 35 |
| 36 } // namespace blimp |
| 37 |
| 38 #endif // BLIMP_COMMON_BLOB_CACHE_IN_MEMORY_BLOB_CACHE_H_ |
OLD | NEW |