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 1 commit
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
Original file line number Diff line number Diff line change
Expand Up @@ -152,11 +152,12 @@ static bool ClipRRectContainsPlatformViewBoundingRect(const SkRRect& clip_rrect,
}

std::vector<std::shared_ptr<FlutterPlatformViewLayer>>
FlutterPlatformViewLayerPool::GetUnusedLayers() {
FlutterPlatformViewLayerPool::RemoveUnusedLayers() {
std::vector<std::shared_ptr<FlutterPlatformViewLayer>> results;
for (size_t i = available_layer_index_; i < layers_.size(); i++) {
results.push_back(layers_[i]);
}
layers_.erase(layers_.begin() + available_layer_index_, layers_.end());
Comment thread
cbracken marked this conversation as resolved.
return results;
}

Expand Down Expand Up @@ -873,8 +874,7 @@ static bool ClipRRectContainsPlatformViewBoundingRect(const SkRRect& clip_rrect,
}

void FlutterPlatformViewsController::RemoveUnusedLayers() {
std::vector<std::shared_ptr<FlutterPlatformViewLayer>> layers = layer_pool_->GetUnusedLayers();
for (const std::shared_ptr<FlutterPlatformViewLayer>& layer : layers) {
for (const auto& layer : layer_pool_->RemoveUnusedLayers()) {
[layer->overlay_view_wrapper removeFromSuperview];
}

Expand Down Expand Up @@ -915,7 +915,6 @@ static bool ClipRRectContainsPlatformViewBoundingRect(const SkRRect& clip_rrect,
clip_count_.erase(viewId);
views_to_recomposite_.erase(viewId);
}

views_to_dispose_ = std::move(views_to_delay_dispose);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,9 +176,8 @@ class FlutterPlatformViewLayerPool {
const std::shared_ptr<IOSContext>& ios_context,
MTLPixelFormat pixel_format);

// Gets the layers in the pool that aren't currently used.
// This method doesn't mark the layers as unused.
std::vector<std::shared_ptr<FlutterPlatformViewLayer>> GetUnusedLayers();
// Removes unused layers from the pool. Returns the unused layers.
std::vector<std::shared_ptr<FlutterPlatformViewLayer>> RemoveUnusedLayers();

// Marks the layers in the pool as available for reuse.
void RecycleLayers();
Expand Down