[Impeller] Guard execution of ReactorGLES operations with a mutex (flutter/engine#47068)

Both the raster and IO threads can flush the ops queue. The reactor must
ensure that execution of queued ops is serialized.

Fixes https://github.com/flutter/flutter/issues/135524
This commit is contained in:
Jason Simmons
2023-10-18 15:15:16 -07:00
committed by GitHub
parent 34497469a9
commit 8307dd2bfb
2 changed files with 6 additions and 1 deletions

View File

@@ -159,6 +159,10 @@ bool ReactorGLES::React() {
}
TRACE_EVENT0("impeller", "ReactorGLES::React");
while (HasPendingOperations()) {
// Both the raster thread and the IO thread can flush queued operations.
// Ensure that execution of the ops is serialized.
Lock execution_lock(ops_execution_mutex_);
if (!ReactOnce()) {
return false;
}

View File

@@ -233,6 +233,7 @@ class ReactorGLES {
std::unique_ptr<ProcTableGLES> proc_table_;
Mutex ops_execution_mutex_;
mutable Mutex ops_mutex_;
std::vector<Operation> ops_ IPLR_GUARDED_BY(ops_mutex_);
@@ -252,7 +253,7 @@ class ReactorGLES {
bool can_set_debug_labels_ = false;
bool is_valid_ = false;
bool ReactOnce();
bool ReactOnce() IPLR_REQUIRES(ops_execution_mutex_);
bool HasPendingOperations() const;