Bug 48484

Summary: Improve memSize calculation in [WebView _setCacheModel]
Product: WebKit Reporter: Pratik Solanki <psolanki>
Component: WebKit Misc.Assignee: Nobody <webkit-unassigned>
Severity: Normal CC: commit-queue, ddkilzer, ggaren
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Mac   
OS: OS X 10.5   
Description Flags
Patch none

Description Pratik Solanki 2010-10-27 16:39:35 PDT
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.
Comment 1 Pratik Solanki 2010-10-27 17:16:25 PDT
Created attachment 72118 [details]
Comment 2 Darin Adler 2010-10-27 17:23:27 PDT
Comment on attachment 72118 [details]

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 3 WebKit Commit Bot 2010-10-27 17:42:45 PDT
Comment on attachment 72118 [details]

Clearing flags on attachment: 72118

Committed r70732: <http://trac.webkit.org/changeset/70732>
Comment 4 WebKit Commit Bot 2010-10-27 17:42:50 PDT
All reviewed patches have been landed.  Closing bug.