Keep a pending buffer for update checking until it's read
Previously ServiceWorkerSingleScriptUpdateChecker reads the body from the network and use a MojoToNetPendingBuffer to pass the buffer to a cache writer, which compares the body. When a diff is found, the body that has a diff is kept in the cache writer, and ServiceWorkerUpdatedScriptLoader gets the portion from the cache writer when the script is loaded. However, ServiceWorkerSingleScriptUpdateChecker calls CompleteRead() after finding a diff, so that the contents of the buffer might be updated to the succeeding contents when the buffer is re-used. (Precisely, the internal buffer in Mojo data pipe is a ring buffer, so this happens when the writer overtake the reader.) This CL fixes the issue by keeping the pending buffer until resuming finishes. Now we can make sure that the portion of the body which has a diff is kept until the body is served to the renderer process. Bug: 1032517 Change-Id: I39376dd37a00ce15d6e016ba787dafe50746b765 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1981247 Commit-Queue: Makoto Shimazu <shimazu@chromium.org> Reviewed-by:Matt Falkenhagen <falken@chromium.org> Cr-Commit-Position: refs/heads/master@{#727407}
Showing
Please register or sign in to comment