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 #include "blimp/common/blob_cache/infinite_blob_cache.h" |
| 6 |
| 7 #include "base/logging.h" |
| 8 #include "base/sha1.h" |
| 9 #include "base/strings/string_number_conversions.h" |
| 10 #include "base/strings/string_util.h" |
| 11 |
| 12 namespace blimp { |
| 13 |
| 14 InfiniteBlobCache::InfiniteBlobCache() {} |
| 15 |
| 16 InfiniteBlobCache::~InfiniteBlobCache() {} |
| 17 |
| 18 void InfiniteBlobCache::Put(const std::string& id, |
| 19 scoped_refptr<RefCountedVector> data) { |
| 20 map_.insert(std::make_pair(id, data)); |
| 21 } |
| 22 |
| 23 bool InfiniteBlobCache::Contains(const std::string& id) const { |
| 24 return map_.find(id) != map_.end(); |
| 25 } |
| 26 |
| 27 scoped_refptr<RefCountedVector> InfiniteBlobCache::Get( |
| 28 const std::string& id) const { |
| 29 if (!Contains(id)) |
| 30 return nullptr; |
| 31 |
| 32 return map_.find(id)->second; |
| 33 } |
| 34 |
| 35 } // namespace blimp |
OLD | NEW |