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
Show all changes
55 commits
Select commit Hold shift + click to select a range
02556ae
++
Jul 11, 2024
b3f6670
move all state updates to end of compositing.
Jul 11, 2024
b31aae6
working but unsynchronized.
Jul 11, 2024
75f931a
hey it almost works.
Jul 12, 2024
4525bd8
disable partial repaint.
Jul 12, 2024
6ce3aa0
cleanups.
Jul 12, 2024
be03cf8
set presentsWithTransaction.
Jul 12, 2024
6770376
sanity refactor.
Jul 12, 2024
912cd40
linting.
Jul 12, 2024
1f65cc3
skip post message if there are no platform views.
Jul 12, 2024
53adc81
linting.
Jul 12, 2024
870b950
dispose views in callback.
Jul 15, 2024
f8267bd
++
Jul 15, 2024
80565d5
Merge branch 'main' of github.com:flutter/engine into three_phase_render
Jul 16, 2024
2b9a825
tear down.
Jul 16, 2024
0a7dc5a
reserve.
Jul 17, 2024
2745e88
++
Jul 17, 2024
6002aa0
++
Jul 17, 2024
e7a832f
++
Jul 17, 2024
f099d74
come on big money no whammies.
Jul 17, 2024
e2e6a2a
okay one more.
Jul 17, 2024
44d5b5b
debug printf
Jul 17, 2024
b53063a
++
Jul 19, 2024
9a84539
make test work.
Jul 23, 2024
65a5210
++
Jul 23, 2024
735ce22
testing fixes.
Jul 24, 2024
a4f523b
Merge branch 'main' of github.com:flutter/engine into three_phase_render
Jul 24, 2024
b6c3345
merge in view slicer.
Jul 24, 2024
a4b771e
Merge branch 'main' of github.com:flutter/engine into three_phase_render
Jul 24, 2024
cd8e1de
++
Jul 25, 2024
6603d18
minor cleanups.
Jul 25, 2024
27c0daa
formatting.
Jul 25, 2024
d794211
add back clear
Jul 26, 2024
2f4314b
++
Jul 26, 2024
25a4e06
++
Jul 26, 2024
ea2e66d
merge threads on SIM.
Jul 26, 2024
d220885
++
Jul 26, 2024
9b534cd
Update shell/platform/darwin/ios/ios_external_view_embedder.mm
Jul 26, 2024
970e13a
++
Jul 26, 2024
63ebe66
Merge branch 'three_phase_render' of github.com:jonahwilliams/engine …
Jul 26, 2024
ff4802a
Merge branch 'main' of github.com:flutter/engine into three_phase_render
Jul 26, 2024
e3fc731
does it blend?
Jul 26, 2024
c0fab3b
++
Jul 26, 2024
d73671e
test fixes and clang tidy.
Jul 27, 2024
7285907
simplify and clean up thread access for UIViews.
Jul 27, 2024
bcd8519
reset before clearning composition order.
Jul 27, 2024
b25a742
Merge branch 'main' of github.com:flutter/engine into three_phase_render
Jul 30, 2024
5f6a8d4
switch to SurfaceFrame API.
Jul 30, 2024
be7853d
++
Jul 30, 2024
b19b4d8
Remove extra include.
Jul 30, 2024
ab08739
clang tidy
Jul 30, 2024
6e6e5a2
bracken feedback
Jul 30, 2024
355ab30
more bracken review.
Aug 1, 2024
8cd1c74
++
Aug 1, 2024
30e7b97
review comments and remove dead code.
Aug 1, 2024
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
Prev Previous commit
Next Next commit
disable partial repaint.
  • Loading branch information
jonahwilliams committed Jul 12, 2024
commit 4525bd89296788a455ff16897c3755096c9b1dba
2 changes: 1 addition & 1 deletion .clangd
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@
# - https://github.com/clangd/clangd/issues/662
CompileFlags:
Add: -Wno-unknown-warning-option
Remove: [-m*, -f*]
Remove: [-m*]
6 changes: 3 additions & 3 deletions flow/compositor_context.cc
Original file line number Diff line number Diff line change
Expand Up @@ -187,9 +187,9 @@ void CompositorContext::ScopedFrame::PaintLayerTreeImpeller(
flutter::LayerTree& layer_tree,
std::optional<SkRect> clip_rect,
bool ignore_raster_cache) {
if (canvas() && clip_rect) {
canvas()->Translate(-clip_rect->x(), -clip_rect->y());
}
// if (canvas() && clip_rect) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need to figure out why this was firing. Possibly we're turning off partial repaint based on thread merging when it should be based on platform view state.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need better way to disable partial repaint. I think instead of

 bool force_full_repaint =
          external_view_embedder_ &&
          (!raster_thread_merger_ || raster_thread_merger_->IsMerged());

we should reset damage and clipRect inside CompositorContext::ScopedFrame::Raster after Preroll when we know that there are platform view present.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That would be after we preroll with damage based cull rect though?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, fair point. Though I'm not 100% sure where the cullrect is used during preroll, the actual culling is done through quickReject during Paint. I think long time ago it was done in preroll setting a flag on layer.

Maybe better to mark entire frame dirty in PlatformViewLayer::Diff. Just need to make sure it behaves correctly when diff is skipped for retained layers. I'll look into this as a separate PR.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

// canvas()->Translate(-clip_rect->x(), -clip_rect->y());
// }

layer_tree.Paint(*this, ignore_raster_cache);
}
Expand Down
2 changes: 1 addition & 1 deletion shell/gpu/gpu_surface_metal_impeller.mm
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
NSNumber* disablePartialRepaint =
[[NSBundle mainBundle] objectForInfoDictionaryKey:@"FLTDisablePartialRepaint"];
if (disablePartialRepaint != nil) {
disable_partial_repaint_ = disablePartialRepaint.boolValue;
disable_partial_repaint_ = true;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,8 @@ void AndroidExternalViewEmbedder::SubmitFlutterView(
overlay_layers.insert({view_id, full_joined_rect});
// Clip the background canvas, so it doesn't contain any of the pixels
// drawn on the overlay layer.
background_canvas->ClipRect(full_joined_rect,
DlCanvas::ClipOp::kDifference);
// background_canvas->ClipRect(full_joined_rect,
// DlCanvas::ClipOp::kDifference);
}
slice->render_into(background_canvas);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,13 +85,6 @@ class AndroidExternalViewEmbedder final : public ExternalViewEmbedder {
SkRect GetViewRect(int64_t view_id) const;

private:
// The number of frames the rasterizer task runner will continue
// to run on the platform thread after no platform view is rendered.
//
// Note: this is an arbitrary number that attempts to account for cases
// where the platform view might be momentarily off the screen.
static const int kDefaultMergedLeaseDuration = 10;

// Provides metadata to the Android surfaces.
const AndroidContext& android_context_;

Expand Down
199 changes: 87 additions & 112 deletions shell/platform/darwin/ios/framework/Source/FlutterPlatformViews.mm
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include <unordered_map>
#include "flow/surface_frame.h"
#import "flutter/shell/platform/darwin/ios/framework/Source/FlutterPlatformViews_Internal.h"
#include "fml/logging.h"
Expand Down Expand Up @@ -83,26 +84,17 @@ static bool ClipRRectContainsPlatformViewBoundingRect(const SkRRect& clip_rrect,
BOOL canApplyBlurBackdrop = YES;

std::shared_ptr<FlutterPlatformViewLayer> FlutterPlatformViewLayerPool::GetNextLayer() {
if (available_layer_index_ < layers_.size()) {
// // TODO: Skia
std::shared_ptr<FlutterPlatformViewLayer> layer = layers_[available_layer_index_];

// // This condition can only happen with the Skia backend, which is due to be removed from
// // iOS in short order.
// if (gr_context != layer->gr_context) {
// layer->gr_context = gr_context;
// // The overlay already exists, but the GrContext was changed so we need to recreate
// // the rendering surface with the new GrContext.
// IOSSurface* ios_surface = layer->ios_surface.get();
// std::unique_ptr<Surface> surface = ios_surface->CreateGPUSurface(gr_context);
// layer->surface = std::move(surface);
// }
layers_mutex_.lock();

std::shared_ptr<FlutterPlatformViewLayer> result;
if (available_layer_index_ < layers_.size()) {
result = layers_[available_layer_index_];
available_layer_index_++;
return layer;
}

return nullptr;
layers_mutex_.unlock();

return result;
}

void FlutterPlatformViewLayerPool::CreateLayer(GrDirectContext* gr_context,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is probably the biggest PITA. Because I can only construct these on the platform thread, right now frame 0 with platform views will skip some number of overlay layers. Its possible that the FlutterMetalLayer solves this partially

Copy link
Member

@knopp knopp Jul 12, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we move away from CAMetalLayer (or even FlutterMetalLayer) and adopt custom composition, we can solve this easily because you can allocate IOSurfaces on any thread, when they are not tied to particular CALayer. We can also have much cheaper overlays. Right now we use up to 2 CAMetaLayers for each FlutterView overlay, which is 6 full screen surfaces. With custom composition it is possible to set a single iOSurface as content of as many CALayers as needed each showing different part, so you can many unobstructed platform view overlays with single layer.

On macOS surfaces are allocated on raster thread and the overlay sublayers are crated here.

Here are relevant files:

https://github.com/flutter/engine/blob/main/shell/platform/darwin/macos/framework/Source/FlutterSurfaceManager.mm

https://github.com/flutter/engine/blob/main/shell/platform/darwin/macos/framework/Source/FlutterCompositor.mm

Expand Down Expand Up @@ -156,7 +148,10 @@ static bool ClipRRectContainsPlatformViewBoundingRect(const SkRRect& clip_rrect,
// +------------------------+
layer->overlay_view_wrapper.get().clipsToBounds = YES;
[layer->overlay_view_wrapper.get() addSubview:layer->overlay_view];

layers_mutex_.lock();
layers_.push_back(layer);
layers_mutex_.unlock();
}

void FlutterPlatformViewLayerPool::RecycleLayers() {
Expand All @@ -165,13 +160,12 @@ static bool ClipRRectContainsPlatformViewBoundingRect(const SkRRect& clip_rrect,

std::vector<std::shared_ptr<FlutterPlatformViewLayer>>
FlutterPlatformViewLayerPool::GetUnusedLayers() {
layers_mutex_.lock();
std::vector<std::shared_ptr<FlutterPlatformViewLayer>> results;
// for (size_t i = available_layer_index_; i < layers_.size(); i++) {
// results.push_back(layers_[i]);
// }
// if (!results.empty()) {
// FML_LOG(ERROR) << "Removing Layers";
// }
for (size_t i = available_layer_index_; i < layers_.size(); i++) {
results.push_back(layers_[i]);
}
layers_mutex_.unlock();
return results;
}

Expand Down Expand Up @@ -335,15 +329,6 @@ static bool ClipRRectContainsPlatformViewBoundingRect(const SkRRect& clip_rrect,
ResetFrameState();
}

// TODO(cyanglaz): https://github.com/flutter/flutter/issues/56474
// Make this method check if there are pending view operations instead.
// Also rename it to `HasPendingViewOperations`.
bool FlutterPlatformViewsController::HasPlatformViewThisOrNextFrame() {
return true;
}

const int FlutterPlatformViewsController::kDefaultMergedLeaseDuration;

PostPrerollResult FlutterPlatformViewsController::PostPrerollAction(
const fml::RefPtr<fml::RasterThreadMerger>& raster_thread_merger) {
return PostPrerollResult::kSuccess;
Expand All @@ -366,9 +351,6 @@ static bool ClipRRectContainsPlatformViewBoundingRect(const SkRRect& clip_rrect,
void FlutterPlatformViewsController::PrerollCompositeEmbeddedView(
int64_t view_id,
std::unique_ptr<EmbeddedViewParams> params) {
// All the CATransactions should be committed by the end of the last frame,
// so catransaction_added_ must be false.
FML_DCHECK(!catransaction_added_);

SkRect view_bounds = SkRect::Make(frame_size_);
std::unique_ptr<EmbedderViewSlice> view;
Expand Down Expand Up @@ -444,6 +426,7 @@ static bool ClipRRectContainsPlatformViewBoundingRect(const SkRRect& clip_rrect,
if (flutter_view_ == nullptr) {
return;
}

FML_DCHECK(CATransform3DEqualToTransform(embedded_view.layer.transform, CATransform3DIdentity));
ResetAnchor(embedded_view.layer);
ChildClippingView* clipView = (ChildClippingView*)embedded_view.superview;
Expand Down Expand Up @@ -628,33 +611,21 @@ static bool ClipRRectContainsPlatformViewBoundingRect(const SkRRect& clip_rrect,
visited_platform_views_.clear();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are these variables ever mutated on main thread as well? Or only on raster thread?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only on the raster thread

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gotcha. Are all of the embedder callback APIs (e.g. SubmitFrame etc) now run on raster thread?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! I think it's indeed a simpler (and better) design

}

SkRect FlutterPlatformViewsController::GetPlatformViewRect(int64_t view_id) {
FML_DCHECK([[NSThread currentThread] isMainThread]);
UIView* platform_view = GetPlatformViewByID(view_id);
UIScreen* screen = [UIScreen mainScreen];
CGRect platform_view_cgrect = [platform_view convertRect:platform_view.bounds
toView:flutter_view_];
return SkRect::MakeXYWH(platform_view_cgrect.origin.x * screen.scale, //
platform_view_cgrect.origin.y * screen.scale, //
platform_view_cgrect.size.width * screen.scale, //
platform_view_cgrect.size.height * screen.scale //
);
}

bool FlutterPlatformViewsController::SubmitFrame(
GrDirectContext* gr_context,
const std::shared_ptr<IOSContext>& ios_context,
std::unique_ptr<SurfaceFrame> frame,
std::unique_ptr<SurfaceFrame> background_frame,
fml::RefPtr<fml::TaskRunner> platform_task_runner) {
TRACE_EVENT0("flutter", "FlutterPlatformViewsController::SubmitFrame");

if (flutter_view_ == nullptr) {
return frame->Submit();
return background_frame->Submit();
}

DlCanvas* background_canvas = frame->Canvas();
DlCanvas* background_canvas = background_frame->Canvas();

// Resolve all pending GPU operations before allocating a new surface.
// This does nothing on Impeller.
background_canvas->Flush();

// Clipping the background canvas before drawing the picture recorders requires
Expand Down Expand Up @@ -683,6 +654,7 @@ static bool ClipRRectContainsPlatformViewBoundingRect(const SkRRect& clip_rrect,
int64_t current_platform_view_id = composition_order_[j - 1];
SkRect platform_view_rect =
current_composition_params_[current_platform_view_id].finalBoundingRect();

std::vector<SkIRect> intersection_rects = slice->region(platform_view_rect).getRects();
const SkIRect rounded_in_platform_view_rect = platform_view_rect.roundIn();
// Ignore intersections of single width/height on the edge of the platform view.
Expand Down Expand Up @@ -737,10 +709,6 @@ static bool ClipRRectContainsPlatformViewBoundingRect(const SkRRect& clip_rrect,
continue;
}

layer->view_id = current_platform_view_id;
layer->overlay_id = overlay_id;
layer->rect = joined_rect;

{
std::unique_ptr<SurfaceFrame> frame = layer->surface->AcquireFrame(frame_size_);
// If frame is null, AcquireFrame already printed out an error message.
Expand All @@ -766,7 +734,11 @@ static bool ClipRRectContainsPlatformViewBoundingRect(const SkRRect& clip_rrect,
}

did_submit &= layer->did_submit_last_frame;
platform_view_layers[current_platform_view_id].push_back(layer);
platform_view_layers[current_platform_view_id].push_back(
{.rect = joined_rect,
.view_id = current_platform_view_id,
.overlay_id = static_cast<int64_t>(overlay_id),
.layer = layer});
overlay_id++;
}
}
Expand All @@ -776,65 +748,71 @@ static bool ClipRRectContainsPlatformViewBoundingRect(const SkRRect& clip_rrect,
// Manually trigger the SkAutoCanvasRestore before we submit the frame
save.Restore();

frame->set_submit_info({.submit_receiver = [&callbacks](SurfaceFrame::DeferredSubmit cb) {
background_frame->set_submit_info({.submit_receiver = [&callbacks](SurfaceFrame::DeferredSubmit cb) {
callbacks.push_back(cb);
}});
did_submit &= frame->Submit();
did_submit &= background_frame->Submit();

// Mark all layers as available, so they can be used in the next frame.
std::vector<std::shared_ptr<FlutterPlatformViewLayer>> unused_layers =
layer_pool_->GetUnusedLayers();
FML_DCHECK(unused_layers.empty() || missing_layer_count == 0);
layer_pool_->RecycleLayers();

auto task = fml::MakeCopyable(
[&, platform_view_layers = std::move(platform_view_layers), missing_layer_count,
frame = std::move(frame), current_composition_params = current_composition_params_,
views_to_recomposite = views_to_recomposite_, callbacks = callbacks,
composition_order = composition_order_]() mutable {
TRACE_EVENT0("flutter", "FlutterPlatformViewsController::SubmitFrame::CATransaction");

[CATransaction begin];
// Configure Flutter overlay views.
for (const auto& [key, layers] : platform_view_layers) {
for (const auto& layer : layers) {
layer->UpdateViewState(flutter_view_);
}
}
auto task = fml::MakeCopyable([&, platform_view_layers = std::move(platform_view_layers),
missing_layer_count, //
current_composition_params = current_composition_params_, //
views_to_recomposite = views_to_recomposite_, //
callbacks = callbacks, //
composition_order = composition_order_, //
unused_layers = unused_layers]() mutable {
TRACE_EVENT0("flutter", "FlutterPlatformViewsController::SubmitFrame::CATransaction");

[CATransaction begin];

// Configure Flutter overlay views.
for (const auto& [key, layers] : platform_view_layers) {
for (const auto& layer_data : layers) {
layer_data.layer->UpdateViewState(flutter_view_, layer_data.rect, layer_data.view_id,
layer_data.overlay_id);
}
}

// Dispose unused Flutter Views.
DisposeViews();
// Dispose unused Flutter Views.
DisposeViews();

// Composite Platform Views.
for (auto view_id : views_to_recomposite) {
CompositeWithParams(view_id, current_composition_params[view_id]);
}
// Composite Platform Views.
for (auto view_id : views_to_recomposite) {
CompositeWithParams(view_id, current_composition_params[view_id]);
}

for (const auto& cb : callbacks) {
cb();
}
for (const auto& cb : callbacks) {
cb();
}

// Create Missing Layers
for (auto i = 0u; i < missing_layer_count; i++) {
CreateLayer(gr_context, //
ios_context, //
MTLPixelFormatBGRA10_XR //
);
}
// Create Missing Layers
for (auto i = 0u; i < missing_layer_count; i++) {
CreateLayer(gr_context, //
ios_context, //
MTLPixelFormatBGRA10_XR //
);
}

// Organize the layers by their z indexes.
auto active_composition_order = BringLayersIntoView(platform_view_layers, composition_order);

// Organize the layers by their z indexes.
auto active_composition_order =
BringLayersIntoView(platform_view_layers, composition_order);
// If a layer was allocated in the previous frame, but it's not used in the current frame,
// then it can be removed from the scene.
RemoveUnusedLayers(unused_layers, composition_order, active_composition_order);

// If a layer was allocated in the previous frame, but it's not used in the current frame,
// then it can be removed from the scene.
RemoveUnusedLayers(composition_order, active_composition_order);
// If the frame is submitted with embedded platform views,
// there should be a |[CATransaction begin]| call in this frame prior to all the drawing.
// If that case, we need to commit the transaction.
[CATransaction commit];
});

// If the frame is submitted with embedded platform views,
// there should be a |[CATransaction begin]| call in this frame prior to all the drawing.
// If that case, we need to commit the transaction.
CommitCATransactionIfNeeded();
[CATransaction commit];
});
platform_task_runner->PostTask(task);
return true;
return did_submit;
}

std::vector<int64_t> FlutterPlatformViewsController::BringLayersIntoView(
Copy link
Member

@chinmaygarde chinmaygarde Jul 26, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oof, this was tough to read and I wonder if this couldn't be made a whole lot simpler and faster.

For one, mutating the view hierarchy can be pretty slow because of layout updated triggered potentially. So you want to minimize them.

And, in cases where the hierarchy changes, you are making addSubview perform a reorder. No matter if there is a reorder or not. And it seems to be response to a performance issue discovered later.

I am assuming that the view hierarchy is the same but you just need to reorder. In that case, you just need two arrays of integers (of z order). You already have one in the composition_order. Build the second one using [superview.subviews indexOfObject:sub]. Now cycle over the two arrays (asserting beforehand that they are the same size) and call -[UIView exchangeSubviewAtIndex:withSubviewAtIndex:] only of the order at the specific index is different. If the order is the same, nothing changes. And you minimize reorders.

for (size_t i = 0; i < composition_order.size(); i++) {
  if (desired_order[i] != composition_order[i]) {
    exchange...
  }
}

That should be it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One complication is that I believe this is also adding the new flutter views, but we can account for that by adding them onto the end first and then moving them maybe.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried a few things here, the issue is that the overlay views (not the platform views) need to be sequenced after the flutter views and don't have an ID. Also since the view hierarchy isn't the same I'd need a more complicated diff.

I think we can fix this, but since I'm not really changing this code i'd rather leave it as is.

Expand All @@ -848,11 +826,11 @@ static bool ClipRRectContainsPlatformViewBoundingRect(const SkRRect& clip_rrect,
NSMutableArray* desired_platform_subviews = [NSMutableArray array];
for (size_t i = 0; i < composition_order.size(); i++) {
int64_t platform_view_id = composition_order[i];
std::vector<std::shared_ptr<FlutterPlatformViewLayer>> layers = layer_map[platform_view_id];
std::vector<LayerData> layers = layer_map[platform_view_id];
UIView* platform_view_root = root_views_[platform_view_id].get();
[desired_platform_subviews addObject:platform_view_root];
for (const std::shared_ptr<FlutterPlatformViewLayer>& layer : layers) {
[desired_platform_subviews addObject:layer->overlay_view_wrapper];
for (const auto& layer_data : layers) {
[desired_platform_subviews addObject:layer_data.layer->overlay_view_wrapper];
}
active_composition_order.push_back(platform_view_id);
}
Expand Down Expand Up @@ -893,7 +871,10 @@ static bool ClipRRectContainsPlatformViewBoundingRect(const SkRRect& clip_rrect,
layer_pool_->CreateLayer(gr_context, ios_context, pixel_format);
}

void FlutterPlatformViewLayer::UpdateViewState(UIView* flutter_view) {
void FlutterPlatformViewLayer::UpdateViewState(UIView* flutter_view,
SkIRect rect,
int64_t view_id,
int64_t overlay_id) {
UIView* overlay_view_wrapper = this->overlay_view_wrapper.get();
auto screenScale = [UIScreen mainScreen].scale;
// Set the size of the overlay view wrapper.
Expand All @@ -914,11 +895,10 @@ static bool ClipRRectContainsPlatformViewBoundingRect(const SkRRect& clip_rrect,
}

void FlutterPlatformViewsController::RemoveUnusedLayers(
const std::vector<std::shared_ptr<FlutterPlatformViewLayer>>& unused_layers,
const std::vector<int64_t>& composition_order,
const std::vector<int64_t>& active_composition_order) {
// TODO
std::vector<std::shared_ptr<FlutterPlatformViewLayer>> layers = layer_pool_->GetUnusedLayers();
for (const std::shared_ptr<FlutterPlatformViewLayer>& layer : layers) {
for (const std::shared_ptr<FlutterPlatformViewLayer>& layer : unused_layers) {
[layer->overlay_view_wrapper removeFromSuperview];
}

Expand Down Expand Up @@ -963,12 +943,7 @@ static bool ClipRRectContainsPlatformViewBoundingRect(const SkRRect& clip_rrect,
views_to_dispose_ = std::move(views_to_delay_dispose);
}

void FlutterPlatformViewsController::BeginCATransaction() {}

void FlutterPlatformViewsController::CommitCATransactionIfNeeded() {}

void FlutterPlatformViewsController::ResetFrameState() {
// TODO: move this state when posting task to platform loop
slices_.clear();
composition_order_.clear();
visited_platform_views_.clear();
Expand Down
Loading