fix: stream protocols sometimes flake out (#21113)

This commit is contained in:
Jeremy Apthorp 2019-11-18 10:47:29 -08:00 committed by GitHub
parent f4371b3f03
commit 4045852e6f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -26,10 +26,7 @@ NodeStreamLoader::NodeStreamLoader(network::ResourceResponseHead head,
base::BindOnce(&NodeStreamLoader::NotifyComplete,
weak_factory_.GetWeakPtr(), net::ERR_FAILED));
// PostTask since it might destruct.
base::SequencedTaskRunnerHandle::Get()->PostTask(
FROM_HERE, base::BindOnce(&NodeStreamLoader::Start,
weak_factory_.GetWeakPtr(), std::move(head)));
Start(std::move(head));
}
NodeStreamLoader::~NodeStreamLoader() {
@ -44,10 +41,6 @@ NodeStreamLoader::~NodeStreamLoader() {
node::MakeCallback(isolate_, emitter_.Get(isolate_), "removeListener",
node::arraysize(args), args, {0, 0});
}
// Release references.
emitter_.Reset();
buffer_.Reset();
}
void NodeStreamLoader::Start(network::ResourceResponseHead head) {