[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:
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user