RTM must to acquire lock before called IsMergedUnsafe (flutter/engine#28514)

I was able to reproduce this on a windows machine with 10000 runs
of this test semi-consistently prior to this fix. After this fix
it seems to have stopped happening.

Fixes: https://github.com/flutter/flutter/issues/88464
This commit is contained in:
Kaushik Iska 2021-09-09 06:30:11 -07:00 committed by GitHub
parent d87e6ac094
commit 929de2e3bf
2 changed files with 4 additions and 2 deletions

View File

@ -91,7 +91,9 @@ bool RasterThreadMerger::IsOnPlatformThread() const {
return MessageLoop::GetCurrentTaskQueueId() == platform_queue_id_;
}
bool RasterThreadMerger::IsOnRasterizingThread() const {
bool RasterThreadMerger::IsOnRasterizingThread() {
std::scoped_lock lock(mutex_);
if (IsMergedUnSafe()) {
return IsOnPlatformThread();
} else {

View File

@ -89,7 +89,7 @@ class RasterThreadMerger
// Returns true if the current thread owns rasterizing.
// When the threads are merged, platform thread owns rasterizing.
// When un-merged, raster thread owns rasterizing.
bool IsOnRasterizingThread() const;
bool IsOnRasterizingThread();
// Returns true if the current thread is the platform thread.
bool IsOnPlatformThread() const;