-
vogelheim authored
Fix Initialize & Dispose for external snapshot. Make sure v8::V8::(Initialize|Dispose) can be called in any order. This is a follow-on to crrev.com/960883003, which fixed a memory leak in this code, but uncovered another, more subtle bug: Previously, the code expected you would v8::V8::Initialize once, and v8::V8::Dispose once. The first bug was that in this case the holder_ variable would point to deallocated memory. The second bug was that once the snapshot was disposed, there was no way to get it back on a future Initialize. These are uncovered by the InitializeAndDisposeMultiple test case. The fix is to keep memory to the raw snapshot and to then cleanly build & destroy the tables in Initialize & Dispose. Since sometimes setNativesBlob is called just after Initialize, that situation must be handled, too. BUG= Review URL: https://codereview.chromium.org/974943003 Cr-Commit-Position: refs/heads/master@{#26978}
2525e8f4