Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions impeller/renderer/backend/gles/reactor_gles.cc
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,9 @@ HandleGLES ReactorGLES::CreateHandle(HandleType type, GLuint external_handle) {
void ReactorGLES::CollectHandle(HandleGLES handle) {
WriterLock handles_lock(handles_mutex_);
if (auto found = handles_.find(handle); found != handles_.end()) {
if (!found->second.pending_collection) {
handles_to_collect_count_ += 1;
}
found->second.pending_collection = true;
}
}
Expand Down Expand Up @@ -273,10 +276,12 @@ bool ReactorGLES::ConsolidateHandles() {
handles_to_name;
{
WriterLock handles_lock(handles_mutex_);
handles_to_delete.reserve(handles_to_collect_count_);
handles_to_collect_count_ = 0;
for (auto& handle : handles_) {
// Collect dead handles.
if (handle.second.pending_collection) {
handles_to_delete.push_back(
handles_to_delete.emplace_back(
std::make_tuple(handle.first, handle.second.name));
continue;
}
Expand All @@ -292,7 +297,7 @@ bool ReactorGLES::ConsolidateHandles() {
// Set pending debug labels.
if (handle.second.pending_debug_label.has_value() &&
handle.first.type != HandleType::kFence) {
handles_to_name.push_back(std::make_tuple(
handles_to_name.emplace_back(std::make_tuple(
ToDebugResourceType(handle.first.type),
handle.second.name.value().handle,
std::move(handle.second.pending_debug_label.value())));
Expand Down
1 change: 1 addition & 0 deletions impeller/renderer/backend/gles/reactor_gles.h
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,7 @@ class ReactorGLES {
HandleGLES::Equal>;
mutable RWMutex handles_mutex_;
LiveHandles handles_ IPLR_GUARDED_BY(handles_mutex_);
int32_t handles_to_collect_count_ IPLR_GUARDED_BY(handles_mutex_) = 0;

mutable Mutex workers_mutex_;
mutable std::map<WorkerID, std::weak_ptr<Worker>> workers_ IPLR_GUARDED_BY(
Expand Down