Skip to content

Make WeakPtr work safely across threads #52253

@cyanglaz

Description

@cyanglaz

WeakPtr currently uses a thread_checker to make sure it is always accessed in the same thread that it was created on.
This works for most of the cases, but fails after we dynamically change the thread configuration.

For example, the rasterizer is created on the GPUTaskRunner (gpu thread), after update GPUTaskRunner to run on platform thread, we are accessing the rasterizer on the platform thread, which is not the same thread the rasterizer was created on. This situation causes thread_checker in WeakPtr to fail.

We need to figure out a way to make the WeakPtr work with dynamic thread merging.

One solution could be to instead check pthread using thread_checker, we check the task_runner using some sort of task_runner_checker.

cc @chinmaygarde

Metadata

Metadata

Assignees

Labels

P1High-priority issues at the top of the work listengineflutter/engine related. See also e: labels.

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions