-
Notifications
You must be signed in to change notification settings - Fork 6k
Avoid deadlock while creating platform views with multiple engines. #28224
Avoid deadlock while creating platform views with multiple engines. #28224
Conversation
|
@iskakaushik @gaaclarke Please have a review, thx~ |
iskakaushik
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
|
|
||
| bool RasterThreadMerger::IsEnabledUnSafe() const { | ||
| return enabled_; | ||
| return shared_merger_->IsEnabledUnSafe(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's a bit odd that the writing of this is in a mutex lock, where reading is not.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@gaaclarke Thanks! 💪 I also have some changes about the thread merger, I will deal with it together with another PR.
| bool SharedThreadMerger::IsEnabledUnSafe() const { | ||
| return enabled_; | ||
| } | ||
|
|
||
| void SharedThreadMerger::SetEnabledUnSafe(bool enabled) { | ||
| enabled_ = enabled; | ||
| } | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm a bit uncertain about which threads are allowed to call this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, I will think about it
When using multiple lightweight engines and multiple platform views, it sometimes will result in a deadlock.
The code in shell.cc:
The variable
should_post_raster_taskinOnPlatformViewCreated()controls the raster_task should be post to platform/raster thread or runs directly.Before this change, the method
DisableThreadMergerIfNeeded()will set the enabled state into RasterThreadMerger instance and not shared when two same thread pair (lightweight engines use same raster and platform thread). So this change move theenabled_member fromRasterThreadMergerclass toSharedThreadMergerclass.It was my little negligence not move this value into the
SharedThreadMergerclass. 😂Pre-launch Checklist
writing and running engine tests.
///).