Commit ab1e5de9 authored by Kramer Ge's avatar Kramer Ge Committed by Commit Bot

[ozone/wayland]Don't post OnSubmit/OnPresent if the surface is unregistered

When WaylandSurfaceGpu is unregistered, its task_runner is also expected
to be forgotten. There are crashes caused by not finding the
task_runner. This CL adds a check if the task_runner is unregistered and
avoid posting to non-existent task_runners.

Change-Id: I1b7d64a5b469e365d5d87ecc5f2332e74d2faf15
Bug: 1139518
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2502954Reviewed-by: default avatarRobert Kroeger <rjkroege@chromium.org>
Commit-Queue: Kramer Ge <fangzhoug@chromium.org>
Cr-Commit-Position: refs/heads/master@{#821845}
parent 4f7b8a56
......@@ -63,9 +63,12 @@ void WaylandBufferManagerGpu::OnSubmission(gfx::AcceleratedWidget widget,
gfx::SwapResult swap_result) {
base::AutoLock scoped_lock(lock_);
DCHECK(io_thread_runner_->BelongsToCurrentThread());
DCHECK_EQ(commit_thread_runners_.count(widget), 1u);
DCHECK_LE(commit_thread_runners_.count(widget), 1u);
// Return back to the same thread where the commit request came from.
commit_thread_runners_.find(widget)->second->PostTask(
auto it = commit_thread_runners_.find(widget);
if (it == commit_thread_runners_.end())
return;
it->second->PostTask(
FROM_HERE,
base::BindOnce(&WaylandBufferManagerGpu::SubmitSwapResultOnOriginThread,
base::Unretained(this), widget, buffer_id, swap_result));
......@@ -77,9 +80,12 @@ void WaylandBufferManagerGpu::OnPresentation(
const gfx::PresentationFeedback& feedback) {
base::AutoLock scoped_lock(lock_);
DCHECK(io_thread_runner_->BelongsToCurrentThread());
DCHECK_EQ(commit_thread_runners_.count(widget), 1u);
DCHECK_LE(commit_thread_runners_.count(widget), 1u);
// Return back to the same thread where the commit request came from.
commit_thread_runners_.find(widget)->second->PostTask(
auto it = commit_thread_runners_.find(widget);
if (it == commit_thread_runners_.end())
return;
it->second->PostTask(
FROM_HERE,
base::BindOnce(&WaylandBufferManagerGpu::SubmitPresentationOnOriginThread,
base::Unretained(this), widget, buffer_id, feedback));
......
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