In [WebView _setCacheModel], we use a fudge factor for the memory size // As a fudge factor, use 1000 instead of 1024, in case the reported byte // count doesn't align exactly to a megabyte boundary. uint64_t memSize = WebMemorySize() / 1024 / 1000; Instead of doing that, we should just round up the memSize to a multiple of 2 and update the code to check for 4MB/2MB/1MB/512KB memory levels.
Created attachment 72118 [details] Patch
Comment on attachment 72118 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=72118&action=review Changes look fine. I have a comment or two, but nothing we couldn’t tweak later. > WebKit/mac/WebView/WebView.mm:5324 > + static uint64_t memSize = roundUpToPowerOf2(WebMemorySize() / 1024 / 1024); Is it really worthwhile to store this in a global? Paying 8 bytes of global memory to avoid doing this math more than once might be the wrong tradeoff since we do this computation only when the cache model is changed.
Comment on attachment 72118 [details] Patch Clearing flags on attachment: 72118 Committed r70732: <http://trac.webkit.org/changeset/70732>
All reviewed patches have been landed. Closing bug.