Commit 00909018 authored by Justin Novosad's avatar Justin Novosad Committed by Commit Bot

Fix crash when creating a webgl query with OffscreenCanvas

BUG=793667

Cq-Include-Trybots: master.tryserver.chromium.android:android_optional_gpu_tests_rel;master.tryserver.chromium.linux:linux_optional_gpu_tests_rel;master.tryserver.chromium.mac:mac_optional_gpu_tests_rel;master.tryserver.chromium.win:win_optional_gpu_tests_rel
Change-Id: Ifc75e2d1545346cf618a6a2303dc659369040674
Reviewed-on: https://chromium-review.googlesource.com/824983Reviewed-by: default avatarZhenyao Mo <zmo@chromium.org>
Commit-Queue: Justin Novosad <junov@chromium.org>
Cr-Commit-Position: refs/heads/master@{#524076}
parent c8faad16
<!DOCTYPE html>
Test passes by not crashing
<br>
<canvas id='c'></canvas>
<script>
// Regression test for crbug.com/793667
document.getElementById('c').transferControlToOffscreen().getContext('webgl2').createQuery();
</script>
......@@ -20,9 +20,14 @@ WebGLQuery::WebGLQuery(WebGL2RenderingContextBase* ctx)
target_(0),
can_update_availability_(false),
query_result_available_(false),
query_result_(0),
task_runner_(
ctx->canvas()->GetDocument().GetTaskRunner(TaskType::kUnthrottled)) {
query_result_(0) {
if (ctx->canvas()) {
task_runner_ =
ctx->canvas()->GetDocument().GetTaskRunner(TaskType::kUnthrottled);
} else {
// Fallback for OffscreenCanvas (no frame scheduler)
task_runner_ = Platform::Current()->CurrentThread()->GetWebTaskRunner();
}
GLuint query;
ctx->ContextGL()->GenQueriesEXT(1, &query);
SetObject(query);
......
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