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

Unified Diff: net/disk_cache/v3/eviction_v3.h

Issue 17507006: Disk cache v3 ref2 Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Incl IndexTable cl Created 7 years, 1 month 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
« no previous file with comments | « net/disk_cache/v3/entry_impl_v3.cc ('k') | net/disk_cache/v3/eviction_v3.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/disk_cache/v3/eviction_v3.h
===================================================================
--- net/disk_cache/v3/eviction_v3.h (revision 232523)
+++ net/disk_cache/v3/eviction_v3.h (working copy)
@@ -2,37 +2,41 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef NET_DISK_CACHE_EVICTION_H_
-#define NET_DISK_CACHE_EVICTION_H_
+#ifndef NET_DISK_CACHE_V3_EVICTION_V3_H_
+#define NET_DISK_CACHE_V3_EVICTION_V3_H_
#include "base/basictypes.h"
#include "base/memory/weak_ptr.h"
-#include "net/disk_cache/disk_format.h"
-#include "net/disk_cache/rankings.h"
+#include "net/base/completion_callback.h"
+#include "net/disk_cache/v3/disk_format_v3.h"
+#include "net/disk_cache/v3/index_table.h"
namespace disk_cache {
-class BackendImpl;
-class EntryImpl;
+class BackendImplV3;
+class EntryImplV3;
// This class implements the eviction algorithm for the cache and it is tightly
// integrated with BackendImpl.
-class Eviction {
+class EvictionV3 {
public:
- Eviction();
- ~Eviction();
+ EvictionV3();
+ ~EvictionV3();
- void Init(BackendImpl* backend);
+ void Init(BackendImplV3* backend);
void Stop();
// Deletes entries from the cache until the current size is below the limit.
// If empty is true, the whole cache will be trimmed, regardless of being in
// use.
- void TrimCache(bool empty);
+ void TrimCache();
+ int TrimAllCache(const net::CompletionCallback& callback);
// Notifications of interesting events for a given entry.
- void OnOpenEntry(EntryImpl* entry);
- void OnCreateEntry(EntryImpl* entry);
+ void OnOpenEntry(EntryImplV3* entry);
+ void OnCreateEntry(EntryImplV3* entry);
+ void OnResurrectEntry(EntryImplV3* entry);
+ void OnEvictEntryComplete();
// Testing interface.
void SetTestMode();
@@ -43,32 +47,41 @@
void DelayedTrim();
bool ShouldTrim();
bool ShouldTrimDeleted();
- bool EvictEntry(CacheRankingsBlock* node, bool empty, Rankings::List list);
+ int EvictEntry(uint32 hash, Addr address);
- void TrimCacheV2(bool empty);
+ // Returns false when done trimming the cache.
+ bool TrimCacheImpl();
void TrimDeleted(bool empty);
- bool NodeIsOldEnough(CacheRankingsBlock* node, int list);
- int SelectListByLength(Rankings::ScopedRankingsBlock* next);
- void ReportListStats();
+ int GetTimestampForGoup(int group);
- BackendImpl* backend_;
- Rankings* rankings_;
- IndexHeader* header_;
+ bool EvictionV3::CellIsOldEnough(const CellList& cells, int multiplier);
+ EntryGroup SelectListByLength();
+ void ReportListStats(int time1, int time2, int time3);
+
+ BackendImplV3* backend_;
+ IndexTable* index_;
+ IndexHeaderV3* header_;
int max_size_;
int trim_delays_;
int index_size_;
- bool new_eviction_;
+ bool lru_;
bool first_trim_;
bool trimming_;
bool delay_trim_;
bool init_;
bool test_mode_;
- base::WeakPtrFactory<Eviction> ptr_factory_;
+ bool empty_;
+ base::WeakPtrFactory<EvictionV3> ptr_factory_;
+ CellList no_use_cells_;
+ CellList low_use_cells_;
+ CellList high_use_cells_;
+ CellList* cells_to_evict_;
+ net::CompletionCallback callback_;
- DISALLOW_COPY_AND_ASSIGN(Eviction);
+ DISALLOW_COPY_AND_ASSIGN(EvictionV3);
};
} // namespace disk_cache
-#endif // NET_DISK_CACHE_EVICTION_H_
+#endif // NET_DISK_CACHE_V3_EVICTION_V3_H_
« no previous file with comments | « net/disk_cache/v3/entry_impl_v3.cc ('k') | net/disk_cache/v3/eviction_v3.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698