Commit 42045657 authored by Francois Beaufort's avatar Francois Beaufort Committed by Commit Bot

Post callback asynchronously from the MediaStream constructor

This CL makes sure initialized callback from the MediaStream constructor
is called asynchronously as it was causing a JavaScript crash
potentially caused by the fact that the MediaStream was not completely
registered with oilpan.

Bug: 1114398
Change-Id: If6058b183bdd07fa747d810efe0f6abed4914e49
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2352800Reviewed-by: default avatarGuido Urdaneta <guidou@chromium.org>
Commit-Queue: François Beaufort <beaufort.francois@gmail.com>
Cr-Commit-Position: refs/heads/master@{#797649}
parent d8d0437b
......@@ -148,7 +148,10 @@ MediaStream::MediaStream(ExecutionContext* context,
}
if (number_of_video_tracks == 0) {
std::move(media_stream_initialized_callback_).Run(this);
context->GetTaskRunner(TaskType::kInternalMedia)
->PostTask(FROM_HERE,
WTF::Bind(std::move(media_stream_initialized_callback_),
WrapPersistent(this)));
}
}
......
......@@ -256,7 +256,8 @@ MediaStreamTrack::MediaStreamTrack(ExecutionContext* context,
image_capture_ = MakeGarbageCollected<ImageCapture>(
context, this, pan_tilt_zoom_allowed, std::move(callback));
} else {
std::move(callback).Run();
execution_context_->GetTaskRunner(TaskType::kInternalMedia)
->PostTask(FROM_HERE, std::move(callback));
}
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment