• manuk's avatar
    [omnibox] Truncate clipboard text for the omnibox. · 0c76c29e
    manuk authored
    When the clipboard contains large text, certain user interactions with
    the omnibox (e.g. right click) exhibit a significant delay. Previously,
    when the clipboard contained more than 32*1024 characters, we skipped
    classifying the text and disabled the 'Paste and Go / Search' context
    menu item as those were the largest sources of delay. However, at
    around 130 million characters, sanitizing the text begins to contribute
    significant delay (3-4 seconds) as well. Additionally, certain user
    actions fetch and sanitize the clipboard text multiple times; e.g.,
    right clicking the omnibox fetches the clipboard 5 times; then
    selecting 'paste' fetches the clipboard 2 additional times; these calls
    accumulate an ~18 second delay.
    
    This CL: (1) removes the earlier truncations and (2) instead truncates
    the clipboard text when it is fetched, and therefore before it is
    sanitized. Additionally, (3) it increased the truncation length to
    url::kMaxURLChars (2*1024*1024) characters. This is sufficient to keep
    the right click delay under 9 seconds while also leaving greater safe
    room for potentially long URLs (google images serves data URLs up to at
    least 30k characters).
    
    Bug: 543675
    Change-Id: I8c3df3dc262747d57e37cd766d84efa12d8d94ee
    Reviewed-on: https://chromium-review.googlesource.com/c/1474192
    Commit-Queue: manuk hovanesian <manukh@chromium.org>
    Reviewed-by: default avatarTommy Li <tommycli@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#632813}
    0c76c29e
clipboard_utils.cc 1.66 KB