Index: blimp/common/blob_cache/blob_cache.h |
diff --git a/blimp/common/blob_cache/blob_cache.h b/blimp/common/blob_cache/blob_cache.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..6b2c684490df5b6cf72d35faf161953f735ede89 |
--- /dev/null |
+++ b/blimp/common/blob_cache/blob_cache.h |
@@ -0,0 +1,39 @@ |
+// 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_BLOB_CACHE_H_ |
+#define BLIMP_COMMON_BLOB_CACHE_BLOB_CACHE_H_ |
+ |
+#include <string> |
+#include <vector> |
+ |
+#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" |
+ |
+namespace blimp { |
+ |
+typedef base::RefCountedData<std::vector<uint8_t>> RefCountedVector; |
vmpstr
2016/04/13 23:48:02
I prefer "using RefCountedVector = base::RefCounte
nyquist
2016/04/14 19:33:22
Done.
|
+ |
+// An interface for a cache of blobs. |
+class BLIMP_COMMON_EXPORT BlobCache { |
+ public: |
+ virtual ~BlobCache() {} |
+ |
+ // Returns true if there is a cache item |id|. |
+ virtual bool Contains(const std::string& id) const = 0; |
+ |
+ // Stores |data| with the identifier |id| in the cache. |
+ // Command is ignored if there is already a cache item stored under |id|. |
+ virtual void Put(const std::string& id, |
+ scoped_refptr<RefCountedVector> data) = 0; |
+ |
+ // Returns a pointer to the cache item |id|, or nullptr if no cache item |
+ // exists under that identifier. |
+ virtual scoped_refptr<RefCountedVector> Get(const std::string& id) const = 0; |
+}; |
+ |
+} // namespace blimp |
+ |
+#endif // BLIMP_COMMON_BLOB_CACHE_BLOB_CACHE_H_ |