• Trent Apted's avatar
    Modularize the Piex wasm used for loading RAW images on ChromeOS. · 5a03bdd6
    Trent Apted authored
    Currently Piex wasm loads into a global window.Module object as a side-
    effect of importing the wasm JS glue. This approach may inhibit other
    wasm modules loading into the same JS context.
    
    To fix, configure emscripten to wrap the Piex module in a loader
    function that returns a promise, and capture it into a unique identifier
    on initialization.
    
    This approach lends itself to on-demand loading of the wasm, so now the
    wasm subsystem is only initialized when required, rather than whenever
    the image loader extension starts up. That is, on the first request to
    refresh the thumbnail for a RAW image, which should occur rarely.
    
    Re-ran the Makefile at emscripten 1.38.33 (same as r815044), and ensured
    that my local sdk created identical files before adding MODULARIZE flags.
    
    Ran the separate test.sh. Test coverage also provided in browser_tests.
    
    Bug: b/175505626
    Cq-Include-Trybots: luci.chrome.try:linux-chromeos-chrome
    Change-Id: I533a8d8028f6913efe0739c5e5cf80864addbe0f
    Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2584634Reviewed-by: default avatarNoel Gordon <noel@chromium.org>
    Commit-Queue: Trent Apted <tapted@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#836985}
    5a03bdd6
piex_loader.js 23.7 KB