Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(883)

Side by Side Diff: blimp/common/blob_cache/in_memory_blob_cache.h

Issue 1867653002: Initial version of Blimp BlobCache. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed comments from kmarshall, except swap Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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(const std::string& id) const override;
27 void Put(const std::string& id,
28 scoped_refptr<RefCountedVector> data) override;
29 scoped_refptr<RefCountedVector> Get(const std::string& id) const override;
30
31 private:
32 typedef std::map<std::string, scoped_refptr<RefCountedVector>> Cache;
Kevin M 2016/04/15 17:28:51 The typedef is kind of unnecessary here, since you
nyquist 2016/04/16 00:25:29 Done.
33 Cache map_;
34
35 DISALLOW_COPY_AND_ASSIGN(InMemoryBlobCache);
36 };
37
38 } // namespace blimp
39
40 #endif // BLIMP_COMMON_BLOB_CACHE_IN_MEMORY_BLOB_CACHE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698