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

Side by Side Diff: components/dom_distiller/core/distilled_content_store.h

Issue 983223004: base: Remove non-const refs from the MRUCache implementation. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 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
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 COMPONENTS_DOM_DISTILLER_CORE_DOM_DISTILLER_CONTENT_STORE_H_ 5 #ifndef COMPONENTS_DOM_DISTILLER_CORE_DOM_DISTILLER_CONTENT_STORE_H_
6 #define COMPONENTS_DOM_DISTILLER_CORE_DOM_DISTILLER_CONTENT_STORE_H_ 6 #define COMPONENTS_DOM_DISTILLER_CORE_DOM_DISTILLER_CONTENT_STORE_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 // Synchronously saves the content. 56 // Synchronously saves the content.
57 void InjectContent(const ArticleEntry& entry, 57 void InjectContent(const ArticleEntry& entry,
58 const DistilledArticleProto& proto); 58 const DistilledArticleProto& proto);
59 59
60 private: 60 private:
61 // The CacheDeletor gets called when anything is removed from the ContentMap. 61 // The CacheDeletor gets called when anything is removed from the ContentMap.
62 class CacheDeletor { 62 class CacheDeletor {
63 public: 63 public:
64 explicit CacheDeletor(InMemoryContentStore* store); 64 explicit CacheDeletor(InMemoryContentStore* store);
65 ~CacheDeletor(); 65 ~CacheDeletor();
66 void operator()(const DistilledArticleProto& proto); 66 void operator()(DistilledArticleProto* proto);
67 67
68 private: 68 private:
69 InMemoryContentStore* store_; 69 InMemoryContentStore* store_;
70 }; 70 };
71 71
72 void AddUrlToIdMapping(const ArticleEntry& entry, 72 void AddUrlToIdMapping(const ArticleEntry& entry,
73 const DistilledArticleProto& proto); 73 const DistilledArticleProto& proto);
74 74
75 void EraseUrlToIdMapping(const DistilledArticleProto& proto); 75 void EraseUrlToIdMapping(const DistilledArticleProto& proto);
76 76
77 typedef base::MRUCacheBase<std::string, 77 typedef base::MRUCacheBase<std::string,
78 DistilledArticleProto, 78 DistilledArticleProto,
79 InMemoryContentStore::CacheDeletor> ContentMap; 79 InMemoryContentStore::CacheDeletor> ContentMap;
80 typedef base::hash_map<std::string, std::string> UrlMap; 80 typedef base::hash_map<std::string, std::string> UrlMap;
81 81
82 ContentMap cache_; 82 ContentMap cache_;
83 UrlMap url_to_id_; 83 UrlMap url_to_id_;
84 }; 84 };
85 85
86 } // dom_distiller 86 } // dom_distiller
87 87
88 #endif // COMPONENTS_DOM_DISTILLER_CORE_DOM_DISTILLER_CONTENT_CACHE_H_ 88 #endif // COMPONENTS_DOM_DISTILLER_CORE_DOM_DISTILLER_CONTENT_CACHE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698