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

Unified Diff: base/memory/mru_cache.h

Issue 8770035: Save pipelining capabilities for the most used hosts between sessions. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Put Capability in its own file Created 9 years 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 side-by-side diff with in-line comments
Download patch
Index: base/memory/mru_cache.h
diff --git a/base/memory/mru_cache.h b/base/memory/mru_cache.h
index 434e5925e46bf92c3920cbb288eae55a92870ef8..6105c78a0e3c11651a86948f6b66d1340638697a 100644
--- a/base/memory/mru_cache.h
+++ b/base/memory/mru_cache.h
@@ -150,6 +150,15 @@ class MRUCacheBase {
return reverse_iterator(Erase((++pos).base()));
}
+ // Updates the |max_size_| of the cache to |new_max_size| and evicts entries,
+ // if necessary, to satisfy the new maximum.
+ void SetMaxSize(size_t new_max_size) {
mmenke 2011/12/06 15:50:38 You're going to need a signoff from an owner of ba
James Simonsen 2011/12/06 19:57:49 Yeah, Will's an owner and he's already given LGTM
+ if (new_max_size < max_size_) {
+ ShrinkToSize(new_max_size);
+ }
+ max_size_ = new_max_size;
+ }
+
// Shrinks the cache so it only holds |new_size| items. If |new_size| is
// bigger or equal to the current number of items, this will do nothing.
void ShrinkToSize(size_type new_size) {
@@ -181,12 +190,12 @@ class MRUCacheBase {
// can keep them as you insert or delete things (as long as you don't delete
// the one you are pointing to) and they will still be valid.
iterator begin() { return ordering_.begin(); }
- const_iterator begin() const { ordering_.begin(); }
+ const_iterator begin() const { return ordering_.begin(); }
iterator end() { return ordering_.end(); }
const_iterator end() const { return ordering_.end(); }
reverse_iterator rbegin() { return ordering_.rbegin(); }
- const_reverse_iterator rbegin() const { ordering_.rbegin(); }
+ const_reverse_iterator rbegin() const { return ordering_.rbegin(); }
reverse_iterator rend() { return ordering_.rend(); }
const_reverse_iterator rend() const { return ordering_.rend(); }
« no previous file with comments | « no previous file | chrome/browser/net/http_server_properties_manager.h » ('j') | net/http/http_server_properties_impl.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698