• lazyboy's avatar
    Remove some UI->FILE->UI thread hops in ExecuteCodeFunction. · b19fcfe2
    lazyboy authored
    There are 3 types of tasks in ExecuteCodeFunction that require FILE thread:
    a) Reading the file content (for non-component extension files)
    b) Retrieving the file GURL of the script file from base::FilePath
    c) content l10n (if the script is CSS)
    
    This CL does all of these in on UI->FILE hop and doesn't require
    additional FILE thread hop.
    Previously, the most common case, i.e. chrome.tabs.executeScript()
    with {file:...}, would require UI->FILE->UI->FILE->UI. With this CL
    this become UI->FILE->UI.
    
    This CL accomplishes this with adding an optional callback to FileReader,
    to specify additional tasks to be run on FILE thread.
    
    So the thread hop changes are:
    Component extension's executeScript() with file:... url would stay same.
    *All* other means of executing script file:... url, e.g.
    chrome.tabs.executeScript(,{file:..}) would require two (UI->FILE->UI) less
    thread hops, whee!
    
    BUG=622464
    Test=None, internal only change.
    
    Review-Url: https://codereview.chromium.org/2301713002
    Cr-Commit-Position: refs/heads/master@{#419023}
    b19fcfe2
file_reader.h 1.83 KB