• binji's avatar
    d8 workers: Fix transferring SharedArrayBuffer to multiple Workers. (try 2) · 5a9722b2
    binji authored
    Note: the previous try was reverted for occasional flaky tests. This continued
    after the revert, and should be fixed by
    https://codereview.chromium.org/1226143003.
    
    Previously, the serialization code would call Externalize for every transferred
    ArrayBuffer or SharedArrayBuffer, but that function can only be called once. If
    the buffer is already externalized, we should call GetContents instead.
    
    Also fix use-after-free bug when transferring ArrayBuffers. The transferred
    ArrayBuffer must be internalized in the new isolate, or be managed by the
    Shell. The current code gives it to the isolate externalized and frees it
    immediately afterward when the SerializationData object is destroyed.
    
    BUG=chromium:497295
    R=jarin@chromium.org
    LOG=n
    
    Review URL: https://codereview.chromium.org/1223813008
    
    Cr-Commit-Position: refs/heads/master@{#29658}
    5a9722b2
d8-worker-sharedarraybuffer.js 3.49 KB