Chromium Code Reviews| Index: blimp/common/blob_cache/infinite_blob_cache.h |
| diff --git a/blimp/common/blob_cache/infinite_blob_cache.h b/blimp/common/blob_cache/infinite_blob_cache.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..48855492e6c69c43d867c1d90b68b787fda4b2f9 |
| --- /dev/null |
| +++ b/blimp/common/blob_cache/infinite_blob_cache.h |
| @@ -0,0 +1,42 @@ |
| +// Copyright 2016 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef BLIMP_COMMON_BLOB_CACHE_INFINITE_BLOB_CACHE_H_ |
| +#define BLIMP_COMMON_BLOB_CACHE_INFINITE_BLOB_CACHE_H_ |
| + |
| +#include <map> |
| +#include <string> |
| +#include <vector> |
| + |
| +#include "base/macros.h" |
| +#include "base/memory/ref_counted.h" |
| +#include "base/memory/scoped_ptr.h" |
|
Kevin M
2016/04/13 23:29:52
Remove
nyquist
2016/04/14 19:33:22
Done.
|
| +#include "blimp/common/blimp_common_export.h" |
| +#include "blimp/common/blob_cache/blob_cache.h" |
| + |
| +namespace blimp { |
| + |
| +// InfiniteBlobCache provides an in-memory implementation of BlobCache that |
| +// never evicts items. |
| +class BLIMP_COMMON_EXPORT InfiniteBlobCache : public BlobCache { |
|
vmpstr
2016/04/13 23:48:02
Since there's only one implementation of BlobCache
nyquist
2016/04/14 19:33:22
The plan is definitely later to use a different im
|
| + public: |
| + InfiniteBlobCache(); |
| + ~InfiniteBlobCache() override; |
| + |
| + // BlobCache implementation. |
| + bool Contains(const std::string& id) const override; |
| + void Put(const std::string& id, |
| + scoped_refptr<RefCountedVector> data) override; |
| + scoped_refptr<RefCountedVector> Get(const std::string& id) const override; |
| + |
| + private: |
| + typedef std::map<std::string, scoped_refptr<RefCountedVector>> Cache; |
| + Cache map_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(InfiniteBlobCache); |
| +}; |
| + |
| +} // namespace blimp |
| + |
| +#endif // BLIMP_COMMON_BLOB_CACHE_INFINITE_BLOB_CACHE_H_ |