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

Side by Side Diff: net/disk_cache/blockfile/backend_worker_v3.cc

Issue 1535363003: Switch to standard integer types in net/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: stddef Created 5 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 unified diff | Download patch
« no previous file with comments | « net/disk_cache/blockfile/backend_worker_v3.h ('k') | net/disk_cache/blockfile/bitmap.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_worker_v3.h" 5 #include "net/disk_cache/blockfile/backend_worker_v3.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include <limits> 9 #include <limits>
10 10
(...skipping 24 matching lines...) Expand all
35 // Seems like ~240 MB correspond to less than 50k entries for 99% of the people. 35 // Seems like ~240 MB correspond to less than 50k entries for 99% of the people.
36 // Note that the actual target is to keep the index table load factor under 55% 36 // Note that the actual target is to keep the index table load factor under 55%
37 // for most users. 37 // for most users.
38 const int k64kEntriesStore = 240 * 1000 * 1000; 38 const int k64kEntriesStore = 240 * 1000 * 1000;
39 const int kBaseTableLen = 64 * 1024; 39 const int kBaseTableLen = 64 * 1024;
40 const int kDefaultCacheSize = 80 * 1024 * 1024; 40 const int kDefaultCacheSize = 80 * 1024 * 1024;
41 41
42 // Avoid trimming the cache for the first 5 minutes (10 timer ticks). 42 // Avoid trimming the cache for the first 5 minutes (10 timer ticks).
43 const int kTrimDelay = 10; 43 const int kTrimDelay = 10;
44 44
45 int DesiredIndexTableLen(int32 storage_size) { 45 int DesiredIndexTableLen(int32_t storage_size) {
46 if (storage_size <= k64kEntriesStore) 46 if (storage_size <= k64kEntriesStore)
47 return kBaseTableLen; 47 return kBaseTableLen;
48 if (storage_size <= k64kEntriesStore * 2) 48 if (storage_size <= k64kEntriesStore * 2)
49 return kBaseTableLen * 2; 49 return kBaseTableLen * 2;
50 if (storage_size <= k64kEntriesStore * 4) 50 if (storage_size <= k64kEntriesStore * 4)
51 return kBaseTableLen * 4; 51 return kBaseTableLen * 4;
52 if (storage_size <= k64kEntriesStore * 8) 52 if (storage_size <= k64kEntriesStore * 8)
53 return kBaseTableLen * 8; 53 return kBaseTableLen * 8;
54 54
55 // The biggest storage_size for int32 requires a 4 MB table. 55 // The biggest storage_size for int32_t requires a 4 MB table.
56 return kBaseTableLen * 16; 56 return kBaseTableLen * 16;
57 } 57 }
58 58
59 int MaxStorageSizeForTable(int table_len) { 59 int MaxStorageSizeForTable(int table_len) {
60 return table_len * (k64kEntriesStore / kBaseTableLen); 60 return table_len * (k64kEntriesStore / kBaseTableLen);
61 } 61 }
62 62
63 size_t GetIndexSize(int table_len) { 63 size_t GetIndexSize(int table_len) {
64 size_t table_size = sizeof(disk_cache::CacheAddr) * table_len; 64 size_t table_size = sizeof(disk_cache::CacheAddr) * table_len;
65 return sizeof(disk_cache::IndexHeader) + table_size; 65 return sizeof(disk_cache::IndexHeader) + table_size;
(...skipping 396 matching lines...) Expand 10 before | Expand all | Expand 10 after
462 #endif // defined(V3_NOT_JUST_YET_READY). 462 #endif // defined(V3_NOT_JUST_YET_READY).
463 463
464 int BackendImplV3::Worker::Init(const CompletionCallback& callback) { 464 int BackendImplV3::Worker::Init(const CompletionCallback& callback) {
465 return net::ERR_FAILED; 465 return net::ERR_FAILED;
466 } 466 }
467 467
468 BackendImplV3::Worker::~Worker() { 468 BackendImplV3::Worker::~Worker() {
469 } 469 }
470 470
471 } // namespace disk_cache 471 } // namespace disk_cache
OLDNEW
« no previous file with comments | « net/disk_cache/blockfile/backend_worker_v3.h ('k') | net/disk_cache/blockfile/bitmap.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698