Reland of "Release streamed script resources after it was compiled"
Original issue's description: > Release streamed script resources after it was compiled > > Otherwise, we'd hold on to the resources until the embedder frees them > which might take a long time > > R=marja@chromium.org,verwaest@chromium.org > BUG= > > Committed: https://crrev.com/877dac34465c018bb534b7781fbe242ae4e33c32 > Cr-Commit-Position: refs/heads/master@{#38999} TBR=marja@chromium.org,verwaest@chromium.org BUG=chromium:642347 Review-Url: https://codereview.chromium.org/2296733002 Cr-Commit-Position: refs/heads/master@{#39018}
This commit is contained in:
parent
e2361954e5
commit
60c75fbe41
@ -2194,9 +2194,10 @@ MaybeLocal<Script> ScriptCompiler::Compile(Local<Context> context,
|
||||
}
|
||||
has_pending_exception = result.is_null();
|
||||
if (has_pending_exception) isolate->ReportPendingMessages();
|
||||
RETURN_ON_FAILED_EXECUTION(Script);
|
||||
|
||||
source->info->clear_script(); // because script goes out of scope.
|
||||
source->Release();
|
||||
|
||||
RETURN_ON_FAILED_EXECUTION(Script);
|
||||
|
||||
Local<UnboundScript> generic = ToApiHandle<UnboundScript>(result);
|
||||
if (generic.IsEmpty()) return Local<Script>();
|
||||
|
@ -26,6 +26,12 @@ struct StreamedSource {
|
||||
ScriptCompiler::StreamedSource::Encoding encoding)
|
||||
: source_stream(source_stream), encoding(encoding) {}
|
||||
|
||||
void Release() {
|
||||
parser.reset();
|
||||
info.reset();
|
||||
zone.reset();
|
||||
}
|
||||
|
||||
// Internal implementation of v8::ScriptCompiler::StreamedSource.
|
||||
std::unique_ptr<ScriptCompiler::ExternalSourceStream> source_stream;
|
||||
ScriptCompiler::StreamedSource::Encoding encoding;
|
||||
|
Loading…
Reference in New Issue
Block a user