Changes between Version 2 and Version 4 of Ticket #7253


Ignore:
Timestamp:
02/03/2019 07:56:48 AM (9 months ago)
Author:
mjethani
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #7253

    • Property Summary changed from Pre-render icons for badge to Pre-render icons for badge on Chromium
  • Ticket #7253 – Description

    v2 v4  
    66Based on my experimental patch: 
    77 
    8  * Rendering the icons into `ImageData` objects once takes less than 0.1% of the extension's total startup time 
    9  * The `ImageData` objects cached in memory take up ~44 KB 
     8 * Rendering the icons into `ImageData` objects once takes less than 0.5% of the extension's total startup time 
     9 * The `ImageData` objects cached in memory take up ~12 KB 
    1010 * Overall savings in CPU usage for typical browsing can be ~5-10% at least 
     11 
     12Since this is for Chrome only, we have to render only the 16x16 and 32x32 versions of the icons (19x19 and 38x38 are no longer required after https://crbug.com/564926). 
    1113 
    1214PS: I got this idea [https://github.com/gorhill/uBlock/blob/5b7a3c99830abf9bb062ddf83ab5718e3495d102/platform/chromium/vapi-background.js#L693 from uBlock Origin]. 
    1315 
    1416=== What to change === 
    15 In `lib/icon.js`, render the non-whitelisted and whitelisted versions of the icons of all sizes into `ImageData` objects, and pass these objects to `BrowserAction.prototype.setIcon` as an additional parameter. 
     17In `lib/icon.js`, render the non-whitelisted and whitelisted versions of the icons of the 16x16 and 32x32 sizes into `ImageData` objects, and pass these objects to `BrowserAction.prototype.setIcon` as an additional parameter. 
    1618 
    1719In `ext/background.js`, if the `imageData` parameter is set, pass the value to `chrome.browserAction.setIcon`; otherwise pass `path` as usual.