Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 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 | 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 BLIMP_COMMON_BLOB_CACHE_IN_MEMORY_BLOB_CACHE_H_ | 5 #ifndef BLIMP_COMMON_BLOB_CACHE_IN_MEMORY_BLOB_CACHE_H_ |
| 6 #define BLIMP_COMMON_BLOB_CACHE_IN_MEMORY_BLOB_CACHE_H_ | 6 #define BLIMP_COMMON_BLOB_CACHE_IN_MEMORY_BLOB_CACHE_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | |
| 10 | 11 |
| 11 #include "base/macros.h" | 12 #include "base/macros.h" |
| 12 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
| 13 #include "blimp/common/blimp_common_export.h" | 14 #include "blimp/common/blimp_common_export.h" |
| 14 #include "blimp/common/blob_cache/blob_cache.h" | 15 #include "blimp/common/blob_cache/blob_cache.h" |
| 15 | 16 |
| 16 namespace blimp { | 17 namespace blimp { |
| 17 | 18 |
| 18 // InMemoryBlobCache provides an in-memory implementation of BlobCache that | 19 // InMemoryBlobCache provides an in-memory implementation of BlobCache that |
| 19 // never evicts items. | 20 // never evicts items. |
| 20 class BLIMP_COMMON_EXPORT InMemoryBlobCache : public BlobCache { | 21 class BLIMP_COMMON_EXPORT InMemoryBlobCache : public BlobCache { |
| 21 public: | 22 public: |
| 22 InMemoryBlobCache(); | 23 InMemoryBlobCache(); |
| 23 ~InMemoryBlobCache() override; | 24 ~InMemoryBlobCache() override; |
| 24 | 25 |
| 25 // BlobCache implementation. | 26 // BlobCache implementation. |
| 27 std::vector<std::string> GetCacheState() const override; | |
|
Wez
2016/06/21 00:33:33
std::string->BlobId
Kevin M
2016/06/21 21:23:51
Done.
| |
| 26 bool Contains(const BlobId& id) const override; | 28 bool Contains(const BlobId& id) const override; |
| 27 void Put(const BlobId& id, BlobDataPtr data) override; | 29 void Put(const BlobId& id, BlobDataPtr data) override; |
| 28 BlobDataPtr Get(const BlobId& id) const override; | 30 BlobDataPtr Get(const BlobId& id) const override; |
| 29 | 31 |
| 30 private: | 32 private: |
| 31 std::map<const BlobId, BlobDataPtr> cache_; | 33 std::map<const BlobId, BlobDataPtr> cache_; |
| 32 | 34 |
| 33 DISALLOW_COPY_AND_ASSIGN(InMemoryBlobCache); | 35 DISALLOW_COPY_AND_ASSIGN(InMemoryBlobCache); |
| 34 }; | 36 }; |
| 35 | 37 |
| 36 } // namespace blimp | 38 } // namespace blimp |
| 37 | 39 |
| 38 #endif // BLIMP_COMMON_BLOB_CACHE_IN_MEMORY_BLOB_CACHE_H_ | 40 #endif // BLIMP_COMMON_BLOB_CACHE_IN_MEMORY_BLOB_CACHE_H_ |
| OLD | NEW |