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

Unified Diff: net/disk_cache/memory/mem_rankings.cc

Issue 1715833002: Reland: Refactor and shorten in-memory cache. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix typo in comment Created 4 years, 10 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 side-by-side diff with in-line comments
Download patch
Index: net/disk_cache/memory/mem_rankings.cc
diff --git a/net/disk_cache/memory/mem_rankings.cc b/net/disk_cache/memory/mem_rankings.cc
deleted file mode 100644
index ba5e00b9938be26194e300135b1e7c443291f851..0000000000000000000000000000000000000000
--- a/net/disk_cache/memory/mem_rankings.cc
+++ /dev/null
@@ -1,67 +0,0 @@
-// Copyright (c) 2006-2008 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.
-
-#include "net/disk_cache/memory/mem_rankings.h"
-
-#include "base/logging.h"
-#include "net/disk_cache/memory/mem_entry_impl.h"
-
-namespace disk_cache {
-
-MemRankings::~MemRankings() {
- DCHECK(!head_ && !tail_);
-}
-
-void MemRankings::Insert(MemEntryImpl* node) {
- if (head_)
- head_->set_prev(node);
-
- if (!tail_)
- tail_ = node;
-
- node->set_prev(NULL);
- node->set_next(head_);
- head_ = node;
-}
-
-void MemRankings::Remove(MemEntryImpl* node) {
- MemEntryImpl* prev = node->prev();
- MemEntryImpl* next = node->next();
-
- if (head_ == node)
- head_ = next;
-
- if (tail_ == node)
- tail_ = prev;
-
- if (prev)
- prev->set_next(next);
-
- if (next)
- next->set_prev(prev);
-
- node->set_next(NULL);
- node->set_prev(NULL);
-}
-
-void MemRankings::UpdateRank(MemEntryImpl* node) {
- Remove(node);
- Insert(node);
-}
-
-MemEntryImpl* MemRankings::GetNext(MemEntryImpl* node) {
- if (!node)
- return head_;
-
- return node->next();
-}
-
-MemEntryImpl* MemRankings::GetPrev(MemEntryImpl* node) {
- if (!node)
- return tail_;
-
- return node->prev();
-}
-
-} // namespace disk_cache

Powered by Google App Engine
This is Rietveld 408576698