Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

External view embedder can tell if embedded views have mutated #9653

Merged
merged 9 commits into from
Jul 3, 2019
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 @@ -183,6 +183,10 @@ class ExternalViewEmbedder {
public:
ExternalViewEmbedder() = default;

// This will return true after pre-roll if any of the embedded views
Copy link
Contributor

Choose a reason for hiding this comment

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

Doesn't have to be in this PR, but we will need a way to clear active_composition_order_ if we're redoing the frame, maybe by adding something like CancelFrame here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yup, will do it as a follow-up PR.

// have mutated for last layer tree.
virtual bool HasPendingViewOperations() = 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,13 @@
frame_size_ = frame_size;
}

bool FlutterPlatformViewsController::HasPendingViewOperations() {
if (!views_to_recomposite_.empty()) {
return true;
}
return active_composition_order_ != composition_order_;
}

void FlutterPlatformViewsController::PrerollCompositeEmbeddedView(
int view_id,
std::unique_ptr<EmbeddedViewParams> params) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,8 @@ class FlutterPlatformViewsController {

void SetFrameSize(SkISize frame_size);

bool HasPendingViewOperations();

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|
bool HasPendingViewOperations() override;

// |flutter::ExternalViewEmbedder|
void BeginFrame(SkISize frame_size) override;

Expand Down
6 changes: 6 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,12 @@
}
}

bool IOSSurfaceGL::HasPendingViewOperations() {
FlutterPlatformViewsController* platform_views_controller = GetPlatformViewsController();
FML_CHECK(platform_views_controller != nullptr);
return platform_views_controller->HasPendingViewOperations();
}

void IOSSurfaceGL::BeginFrame(SkISize frame_size) {
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|
bool HasPendingViewOperations() override;

// |flutter::ExternalViewEmbedder|
void BeginFrame(SkISize frame_size) 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 @@
}
}

bool IOSSurfaceSoftware::HasPendingViewOperations() {
FlutterPlatformViewsController* platform_views_controller = GetPlatformViewsController();
FML_CHECK(platform_views_controller != nullptr);
return platform_views_controller->HasPendingViewOperations();
}

void IOSSurfaceSoftware::BeginFrame(SkISize frame_size) {
FlutterPlatformViewsController* platform_views_controller = GetPlatformViewsController();
FML_CHECK(platform_views_controller != nullptr);
Expand Down