• Ben Kelly's avatar
    Fetch: Delay buffering Response data. · 298d8e0c
    Ben Kelly authored
    When a service worker executes code like `evt.respondWith(fetch(r))` we
    should be able to directly pass the fetch's resulting mojo::DataPipe
    through without any data copying.  This previously did not work,
    however, since the BufferingBytesConsumer would immediately start
    buffering the Response body data.
    
    This CL fixes this issue by delaying the start of the buffering by a
    short amount of time.  This gives the service worker time to drain the
    pipe.
    
    The delay is currently disabled by default behind the
    "BufferingBytesConsumerDelay" feature.
    
    Based on yhirano's draft CL at crrev.com/c/1383755.
    
    Bug: 911036
    Change-Id: I65675ce62a7ce593c8994b3e1258634840ba6c2d
    Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1679669
    Commit-Queue: Ben Kelly <wanderview@chromium.org>
    Reviewed-by: default avatarYutaka Hirano <yhirano@chromium.org>
    Reviewed-by: default avatarKinuko Yasuda <kinuko@chromium.org>
    Reviewed-by: default avatarRobert Kaplow <rkaplow@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#676053}
    298d8e0c
features.cc 15.8 KB