Changeset 70732 in webkit
- Timestamp:
- Oct 27, 2010 5:42:35 PM (13 years ago)
- Location:
- trunk/WebKit/mac
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebKit/mac/ChangeLog
r70723 r70732 1 2010-10-27 Pratik Solanki <psolanki@apple.com> 2 3 Reviewed by Darin Adler. 4 5 Improve memSize calculation in [WebView _setCacheModel] 6 https://bugs.webkit.org/show_bug.cgi?id=48484 7 8 * WebView/WebView.mm: 9 (roundUpToPowerOf2): Added. Utility function to calculate the nearest power of 2. 10 (+[WebView _setCacheModel:]): Update memSize calculation to set it to the next 11 bigger power of 2. Also update WebCore cache settings. 12 1 13 2010-10-26 Darin Adler <darin@apple.com> 2 14 -
trunk/WebKit/mac/WebView/WebView.mm
r70723 r70732 5309 5309 @implementation WebView (WebFileInternal) 5310 5310 5311 static inline uint64_t roundUpToPowerOf2(uint64_t num) 5312 { 5313 return powf(2.0, ceilf(log2f(num))); 5314 } 5315 5311 5316 + (void)_setCacheModel:(WebCacheModel)cacheModel 5312 5317 { … … 5318 5323 nsurlCacheDirectory = NSHomeDirectory(); 5319 5324 5320 // As a fudge factor, use 1000 instead of 1024, in case the reported byte 5321 // count doesn't align exactly to a megabyte boundary. 5322 uint64_t memSize = WebMemorySize() / 1024 / 1000; 5325 static uint64_t memSize = roundUpToPowerOf2(WebMemorySize() / 1024 / 1024); 5323 5326 unsigned long long diskFreeSize = WebVolumeFreeSize(nsurlCacheDirectory) / 1024 / 1000; 5324 5327 NSURLCache *nsurlCache = [NSURLCache sharedURLCache]; … … 5340 5343 5341 5344 // Object cache capacities (in bytes) 5342 if (memSize >= 2048) 5345 if (memSize >= 4096) 5346 cacheTotalCapacity = 128 * 1024 * 1024; 5347 else if (memSize >= 2048) 5343 5348 cacheTotalCapacity = 96 * 1024 * 1024; 5344 else if (memSize >= 1536)5345 cacheTotalCapacity = 64 * 1024 * 1024;5346 5349 else if (memSize >= 1024) 5347 5350 cacheTotalCapacity = 32 * 1024 * 1024; … … 5372 5375 5373 5376 // Object cache capacities (in bytes) 5374 if (memSize >= 2048) 5377 if (memSize >= 4096) 5378 cacheTotalCapacity = 128 * 1024 * 1024; 5379 else if (memSize >= 2048) 5375 5380 cacheTotalCapacity = 96 * 1024 * 1024; 5376 else if (memSize >= 1536)5377 cacheTotalCapacity = 64 * 1024 * 1024;5378 5381 else if (memSize >= 1024) 5379 5382 cacheTotalCapacity = 32 * 1024 * 1024; … … 5424 5427 // browsing pattern. Even growth above 128MB can have substantial 5425 5428 // value / MB for some content / browsing patterns.) 5426 if (memSize >= 2048) 5429 if (memSize >= 4096) 5430 cacheTotalCapacity = 192 * 1024 * 1024; 5431 else if (memSize >= 2048) 5427 5432 cacheTotalCapacity = 128 * 1024 * 1024; 5428 else if (memSize >= 1536)5429 cacheTotalCapacity = 96 * 1024 * 1024;5430 5433 else if (memSize >= 1024) 5431 5434 cacheTotalCapacity = 64 * 1024 * 1024;
Note: See TracChangeset
for help on using the changeset viewer.