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
12 changes: 6 additions & 6 deletions shell/common/animator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ void Animator::BeginFrame(fml::TimePoint frame_start_time,
{
TRACE_EVENT2("flutter", "Framework Workload", "mode", "basic", "frame",
FrameParity());
delegate_.OnAnimatorBeginFrame(*this, last_begin_frame_time_);
delegate_.OnAnimatorBeginFrame(last_begin_frame_time_);
}

if (!frame_scheduled_) {
Expand All @@ -124,8 +124,8 @@ void Animator::BeginFrame(fml::TimePoint frame_start_time,
// no further frames were produced, and it is safe (w.r.t. jank) to
// notify the engine we are idle.
if (notify_idle_task_id == self->notify_idle_task_id_) {
self->delegate_.OnAnimatorNotifyIdle(
*self.get(), Dart_TimelineGetMicros() + 100000);
self->delegate_.OnAnimatorNotifyIdle(Dart_TimelineGetMicros() +
100000);
}
},
kNotifyIdleTaskWaitTime);
Expand All @@ -148,7 +148,7 @@ void Animator::Render(std::unique_ptr<flow::LayerTree> layer_tree) {
// Commit the pending continuation.
producer_continuation_.Complete(std::move(layer_tree));

delegate_.OnAnimatorDraw(*this, layer_tree_pipeline_);
delegate_.OnAnimatorDraw(layer_tree_pipeline_);
}

bool Animator::CanReuseLastLayerTree() {
Expand All @@ -157,7 +157,7 @@ bool Animator::CanReuseLastLayerTree() {

void Animator::DrawLastLayerTree() {
pending_frame_semaphore_.Signal();
delegate_.OnAnimatorDrawLastLayerTree(*this);
delegate_.OnAnimatorDrawLastLayerTree();
}

void Animator::RequestFrame(bool regenerate_layer_tree) {
Expand Down Expand Up @@ -205,7 +205,7 @@ void Animator::AwaitVSync() {
}
});

delegate_.OnAnimatorNotifyIdle(*this, dart_frame_deadline_);
delegate_.OnAnimatorNotifyIdle(dart_frame_deadline_);
}

} // namespace shell
9 changes: 3 additions & 6 deletions shell/common/animator.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,14 @@ class Animator final {
public:
class Delegate {
public:
virtual void OnAnimatorBeginFrame(const Animator& animator,
fml::TimePoint frame_time) = 0;
virtual void OnAnimatorBeginFrame(fml::TimePoint frame_time) = 0;

virtual void OnAnimatorNotifyIdle(const Animator& animator,
int64_t deadline) = 0;
virtual void OnAnimatorNotifyIdle(int64_t deadline) = 0;

virtual void OnAnimatorDraw(
const Animator& animator,
fml::RefPtr<flutter::Pipeline<flow::LayerTree>> pipeline) = 0;

virtual void OnAnimatorDrawLastLayerTree(const Animator& animator) = 0;
virtual void OnAnimatorDrawLastLayerTree() = 0;
};

Animator(Delegate& delegate,
Expand Down
5 changes: 2 additions & 3 deletions shell/common/engine.cc
Original file line number Diff line number Diff line change
Expand Up @@ -385,16 +385,15 @@ void Engine::Render(std::unique_ptr<flow::LayerTree> layer_tree) {

void Engine::UpdateSemantics(blink::SemanticsNodeUpdates update,
blink::CustomAccessibilityActionUpdates actions) {
delegate_.OnEngineUpdateSemantics(*this, std::move(update),
std::move(actions));
delegate_.OnEngineUpdateSemantics(std::move(update), std::move(actions));
}

void Engine::HandlePlatformMessage(
fml::RefPtr<blink::PlatformMessage> message) {
if (message->channel() == kAssetChannel) {
HandleAssetPlatformMessage(std::move(message));
} else {
delegate_.OnEngineHandlePlatformMessage(*this, std::move(message));
delegate_.OnEngineHandlePlatformMessage(std::move(message));
}
}

Expand Down
2 changes: 0 additions & 2 deletions shell/common/engine.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,10 @@ class Engine final : public blink::RuntimeDelegate {
class Delegate {
public:
virtual void OnEngineUpdateSemantics(
const Engine& engine,
blink::SemanticsNodeUpdates update,
blink::CustomAccessibilityActionUpdates actions) = 0;

virtual void OnEngineHandlePlatformMessage(
const Engine& engine,
fml::RefPtr<blink::PlatformMessage> message) = 0;

virtual void OnPreEngineRestart() = 0;
Expand Down
25 changes: 12 additions & 13 deletions shell/common/platform_view.cc
Original file line number Diff line number Diff line change
Expand Up @@ -33,39 +33,38 @@ std::unique_ptr<VsyncWaiter> PlatformView::CreateVSyncWaiter() {

void PlatformView::DispatchPlatformMessage(
fml::RefPtr<blink::PlatformMessage> message) {
delegate_.OnPlatformViewDispatchPlatformMessage(*this, std::move(message));
delegate_.OnPlatformViewDispatchPlatformMessage(std::move(message));
}

void PlatformView::DispatchPointerDataPacket(
std::unique_ptr<blink::PointerDataPacket> packet) {
delegate_.OnPlatformViewDispatchPointerDataPacket(*this, std::move(packet));
delegate_.OnPlatformViewDispatchPointerDataPacket(std::move(packet));
}

void PlatformView::DispatchSemanticsAction(int32_t id,
blink::SemanticsAction action,
std::vector<uint8_t> args) {
delegate_.OnPlatformViewDispatchSemanticsAction(*this, id, action,
std::move(args));
delegate_.OnPlatformViewDispatchSemanticsAction(id, action, std::move(args));
}

void PlatformView::SetSemanticsEnabled(bool enabled) {
delegate_.OnPlatformViewSetSemanticsEnabled(*this, enabled);
delegate_.OnPlatformViewSetSemanticsEnabled(enabled);
}

void PlatformView::SetAccessibilityFeatures(int32_t flags) {
delegate_.OnPlatformViewSetAccessibilityFeatures(*this, flags);
delegate_.OnPlatformViewSetAccessibilityFeatures(flags);
}

void PlatformView::SetViewportMetrics(const blink::ViewportMetrics& metrics) {
delegate_.OnPlatformViewSetViewportMetrics(*this, metrics);
delegate_.OnPlatformViewSetViewportMetrics(metrics);
}

void PlatformView::NotifyCreated() {
delegate_.OnPlatformViewCreated(*this, CreateRenderingSurface());
delegate_.OnPlatformViewCreated(CreateRenderingSurface());
}

void PlatformView::NotifyDestroyed() {
delegate_.OnPlatformViewDestroyed(*this);
delegate_.OnPlatformViewDestroyed();
}

sk_sp<GrContext> PlatformView::CreateResourceContext() const {
Expand All @@ -91,15 +90,15 @@ void PlatformView::HandlePlatformMessage(
void PlatformView::OnPreEngineRestart() const {}

void PlatformView::RegisterTexture(std::shared_ptr<flow::Texture> texture) {
delegate_.OnPlatformViewRegisterTexture(*this, std::move(texture));
delegate_.OnPlatformViewRegisterTexture(std::move(texture));
}

void PlatformView::UnregisterTexture(int64_t texture_id) {
delegate_.OnPlatformViewUnregisterTexture(*this, texture_id);
delegate_.OnPlatformViewUnregisterTexture(texture_id);
}

void PlatformView::MarkTextureFrameAvailable(int64_t texture_id) {
delegate_.OnPlatformViewMarkTextureFrameAvailable(*this, texture_id);
delegate_.OnPlatformViewMarkTextureFrameAvailable(texture_id);
}

std::unique_ptr<Surface> PlatformView::CreateRenderingSurface() {
Expand All @@ -115,7 +114,7 @@ void PlatformView::SetNextFrameCallback(fml::closure closure) {
return;
}

delegate_.OnPlatformViewSetNextFrameCallback(*this, std::move(closure));
delegate_.OnPlatformViewSetNextFrameCallback(std::move(closure));
}

} // namespace shell
24 changes: 6 additions & 18 deletions shell/common/platform_view.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,48 +29,36 @@ class PlatformView {
public:
class Delegate {
public:
virtual void OnPlatformViewCreated(const PlatformView& view,
std::unique_ptr<Surface> surface) = 0;
virtual void OnPlatformViewCreated(std::unique_ptr<Surface> surface) = 0;

virtual void OnPlatformViewDestroyed(const PlatformView& view) = 0;
virtual void OnPlatformViewDestroyed() = 0;

virtual void OnPlatformViewSetNextFrameCallback(const PlatformView& view,
fml::closure closure) = 0;
virtual void OnPlatformViewSetNextFrameCallback(fml::closure closure) = 0;

virtual void OnPlatformViewSetViewportMetrics(
const PlatformView& view,
const blink::ViewportMetrics& metrics) = 0;

virtual void OnPlatformViewDispatchPlatformMessage(
const PlatformView& view,
fml::RefPtr<blink::PlatformMessage> message) = 0;

virtual void OnPlatformViewDispatchPointerDataPacket(
const PlatformView& view,
std::unique_ptr<blink::PointerDataPacket> packet) = 0;

virtual void OnPlatformViewDispatchSemanticsAction(
const PlatformView& view,
int32_t id,
blink::SemanticsAction action,
std::vector<uint8_t> args) = 0;

virtual void OnPlatformViewSetSemanticsEnabled(const PlatformView& view,
bool enabled) = 0;
virtual void OnPlatformViewSetSemanticsEnabled(bool enabled) = 0;

virtual void OnPlatformViewSetAccessibilityFeatures(
const PlatformView& view,
int32_t flags) = 0;
virtual void OnPlatformViewSetAccessibilityFeatures(int32_t flags) = 0;

virtual void OnPlatformViewRegisterTexture(
const PlatformView& view,
std::shared_ptr<flow::Texture> texture) = 0;

virtual void OnPlatformViewUnregisterTexture(const PlatformView& view,
int64_t texture_id) = 0;
virtual void OnPlatformViewUnregisterTexture(int64_t texture_id) = 0;

virtual void OnPlatformViewMarkTextureFrameAvailable(
const PlatformView& view,
int64_t texture_id) = 0;
};

Expand Down
Loading