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

Side by Side Diff: net/disk_cache/simple/simple_index.h

Issue 2918893002: evict larger entries first (Closed)
Patch Set: use rank instead of time Created 3 years, 6 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 (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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 NET_DISK_CACHE_SIMPLE_SIMPLE_INDEX_H_ 5 #ifndef NET_DISK_CACHE_SIMPLE_SIMPLE_INDEX_H_
6 #define NET_DISK_CACHE_SIMPLE_SIMPLE_INDEX_H_ 6 #define NET_DISK_CACHE_SIMPLE_SIMPLE_INDEX_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <list> 10 #include <list>
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 bool Deserialize(base::PickleIterator* it); 63 bool Deserialize(base::PickleIterator* it);
64 64
65 static base::TimeDelta GetLowerEpsilonForTimeComparisons() { 65 static base::TimeDelta GetLowerEpsilonForTimeComparisons() {
66 return base::TimeDelta::FromSeconds(1); 66 return base::TimeDelta::FromSeconds(1);
67 } 67 }
68 static base::TimeDelta GetUpperEpsilonForTimeComparisons() { 68 static base::TimeDelta GetUpperEpsilonForTimeComparisons() {
69 return base::TimeDelta(); 69 return base::TimeDelta();
70 } 70 }
71 71
72 static const int kOnDiskSizeBytes = 16; 72 static const int kOnDiskSizeBytes = 16;
73 static const int kEstimatedEntryOverhead = 512;
73 74
74 private: 75 private:
75 friend class SimpleIndexFileTest; 76 friend class SimpleIndexFileTest;
76 77
77 // There are tens of thousands of instances of EntryMetadata in memory, so the 78 // There are tens of thousands of instances of EntryMetadata in memory, so the
78 // size of each entry matters. Even when the values used to set these members 79 // size of each entry matters. Even when the values used to set these members
79 // are originally calculated as >32-bit types, the actual necessary size for 80 // are originally calculated as >32-bit types, the actual necessary size for
80 // each shouldn't exceed 32 bits, so we use 32-bit types here. 81 // each shouldn't exceed 32 bits, so we use 32-bit types here.
81 uint32_t last_used_time_seconds_since_epoch_; 82 uint32_t last_used_time_seconds_since_epoch_;
82 uint32_t entry_size_; // Storage size in bytes. 83 uint32_t entry_size_; // Storage size in bytes.
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
245 246
246 // Set to true when the app is on the background. When the app is in the 247 // Set to true when the app is on the background. When the app is in the
247 // background we can write the index much more frequently, to insure fresh 248 // background we can write the index much more frequently, to insure fresh
248 // index on next startup. 249 // index on next startup.
249 bool app_on_background_; 250 bool app_on_background_;
250 }; 251 };
251 252
252 } // namespace disk_cache 253 } // namespace disk_cache
253 254
254 #endif // NET_DISK_CACHE_SIMPLE_SIMPLE_INDEX_H_ 255 #endif // NET_DISK_CACHE_SIMPLE_SIMPLE_INDEX_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698