• Leszek Swirski's avatar
    Cache code for inline scripts · fc4e797b
    Leszek Swirski authored
    This enables code caching for <script> tags whose source code is embedded
    in the HTML. External scripts store their cached code on metadata
    associated with the external script resource; now, inline scripts store
    their cached code on metadata associated with the HTML document's
    RawResource.
    
    To allow multiple inline scripts per HTML page, the RawResource metadata
    can hold multiple code caches. These are keyed by the SHA-256 hash of the
    script's source, which is a large enough hash that we don't have to worry
    about collisions, and thus don't have to store the script's source in the
    cache.
    
    The multi-script metadata has a simple serialization format optimized for
    easy serialize/deserialize:
    
        marker (uint32)
        num_entries (int)
        key 1 (Key type)
        len data 1 (size_t)
        type data 1
        data for key 1
        ...
        key N (Key type)
        len data N (size_t)
        type data N
        data for key N
    
    Inline scripts receive a CachedMetadataHandler implementation which is a
    view onto this multi-script handler.
    
    Bug: chromium:823663
    Change-Id: Ib14edfaf460aa8bfc90cfe12b8a6b4b7af050de7
    Reviewed-on: https://chromium-review.googlesource.com/893401
    Commit-Queue: Leszek Swirski <leszeks@chromium.org>
    Reviewed-by: default avatarHiroshige Hayashizaki <hiroshige@chromium.org>
    Reviewed-by: default avatarKinuko Yasuda <kinuko@chromium.org>
    Reviewed-by: default avatarKouhei Ueno <kouhei@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#547671}
    fc4e797b
runtime_features.cc 17.2 KB