OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #include "net/disk_cache/blockfile/backend_impl.h" | 5 #include "net/disk_cache/blockfile/backend_impl.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "base/files/file.h" | 9 #include "base/files/file.h" |
10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
(...skipping 23 matching lines...) Expand all Loading... |
34 | 34 |
35 // Provide a BackendImpl object to macros from histogram_macros.h. | 35 // Provide a BackendImpl object to macros from histogram_macros.h. |
36 #define CACHE_UMA_BACKEND_IMPL_OBJ this | 36 #define CACHE_UMA_BACKEND_IMPL_OBJ this |
37 | 37 |
38 using base::Time; | 38 using base::Time; |
39 using base::TimeDelta; | 39 using base::TimeDelta; |
40 using base::TimeTicks; | 40 using base::TimeTicks; |
41 | 41 |
42 namespace { | 42 namespace { |
43 | 43 |
44 const char* kIndexName = "index"; | 44 const char kIndexName[] = "index"; |
45 | 45 |
46 // Seems like ~240 MB correspond to less than 50k entries for 99% of the people. | 46 // Seems like ~240 MB correspond to less than 50k entries for 99% of the people. |
47 // Note that the actual target is to keep the index table load factor under 55% | 47 // Note that the actual target is to keep the index table load factor under 55% |
48 // for most users. | 48 // for most users. |
49 const int k64kEntriesStore = 240 * 1000 * 1000; | 49 const int k64kEntriesStore = 240 * 1000 * 1000; |
50 const int kBaseTableLen = 64 * 1024; | 50 const int kBaseTableLen = 64 * 1024; |
51 | 51 |
52 // Avoid trimming the cache for the first 5 minutes (10 timer ticks). | 52 // Avoid trimming the cache for the first 5 minutes (10 timer ticks). |
53 const int kTrimDelay = 10; | 53 const int kTrimDelay = 10; |
54 | 54 |
(...skipping 2030 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2085 if (total_memory > kMaxBuffersSize || total_memory <= 0) | 2085 if (total_memory > kMaxBuffersSize || total_memory <= 0) |
2086 total_memory = kMaxBuffersSize; | 2086 total_memory = kMaxBuffersSize; |
2087 | 2087 |
2088 done = true; | 2088 done = true; |
2089 } | 2089 } |
2090 | 2090 |
2091 return static_cast<int>(total_memory); | 2091 return static_cast<int>(total_memory); |
2092 } | 2092 } |
2093 | 2093 |
2094 } // namespace disk_cache | 2094 } // namespace disk_cache |
OLD | NEW |