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
4 changes: 4 additions & 0 deletions flow/embedded_views.h
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,10 @@ class ExternalViewEmbedder {
// have mutated for last layer tree.
virtual bool HasPendingViewOperations() = 0;

// Call this in-lieu of |SubmitFrame| to clear pre-roll state and
// sets the stage for the next pre-roll.
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: s/sets/set/

virtual void CancelFrame() = 0;

virtual void BeginFrame(SkISize frame_size) = 0;

virtual void PrerollCompositeEmbeddedView(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,10 @@
frame_size_ = frame_size;
}

void FlutterPlatformViewsController::CancelFrame() {
composition_order_.clear();
}

bool FlutterPlatformViewsController::HasPendingViewOperations() {
if (!views_to_recomposite_.empty()) {
return true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,8 @@ class FlutterPlatformViewsController {

bool HasPendingViewOperations();

void CancelFrame();

void PrerollCompositeEmbeddedView(int view_id,
std::unique_ptr<flutter::EmbeddedViewParams> params);

Expand Down
3 changes: 3 additions & 0 deletions shell/platform/darwin/ios/ios_surface_gl.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@ class IOSSurfaceGL final : public IOSSurface,
// |GPUSurfaceGLDelegate|
flutter::ExternalViewEmbedder* GetExternalViewEmbedder() override;

// |flutter::ExternalViewEmbedder|
void CancelFrame() override;

// |flutter::ExternalViewEmbedder|
bool HasPendingViewOperations() override;

Expand Down
9 changes: 9 additions & 0 deletions shell/platform/darwin/ios/ios_surface_gl.mm
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,15 @@
}
}

void IOSSurfaceGL::CancelFrame() {
FlutterPlatformViewsController* platform_views_controller = GetPlatformViewsController();
FML_CHECK(platform_views_controller != nullptr);
platform_views_controller->CancelFrame();
// Committing the current transaction as |BeginFrame| will create a nested
// CATransaction otherwise.
[CATransaction commit];
}

bool IOSSurfaceGL::HasPendingViewOperations() {
FlutterPlatformViewsController* platform_views_controller = GetPlatformViewsController();
FML_CHECK(platform_views_controller != nullptr);
Expand Down
3 changes: 3 additions & 0 deletions shell/platform/darwin/ios/ios_surface_software.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@ class IOSSurfaceSoftware final : public IOSSurface,
// |GPUSurfaceSoftwareDelegate|
flutter::ExternalViewEmbedder* GetExternalViewEmbedder() override;

// |flutter::ExternalViewEmbedder|
void CancelFrame() override;

// |flutter::ExternalViewEmbedder|
bool HasPendingViewOperations() override;

Expand Down
6 changes: 6 additions & 0 deletions shell/platform/darwin/ios/ios_surface_software.mm
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,12 @@
}
}

void IOSSurfaceSoftware::CancelFrame() {
FlutterPlatformViewsController* platform_views_controller = GetPlatformViewsController();
FML_CHECK(platform_views_controller != nullptr);
platform_views_controller->CancelFrame();
}

bool IOSSurfaceSoftware::HasPendingViewOperations() {
FlutterPlatformViewsController* platform_views_controller = GetPlatformViewsController();
FML_CHECK(platform_views_controller != nullptr);
Expand Down