[fuchsia] Remove spurious ERROR log (flutter/engine#32870)

This commit is contained in:
Jaeheon Yi
2022-04-22 17:14:04 -07:00
committed by GitHub
parent 1afb88d9e4
commit 451c083982
5 changed files with 33 additions and 25 deletions

View File

@@ -32,7 +32,8 @@ FlatlandPlatformView::FlatlandPlatformView(
AwaitVsyncCallback await_vsync_callback,
AwaitVsyncForSecondaryCallbackCallback
await_vsync_for_secondary_callback_callback)
: PlatformView(delegate,
: PlatformView(true /* is_flatland */,
delegate,
std::move(task_runners),
std::move(view_ref),
std::move(external_view_embedder),

View File

@@ -33,7 +33,8 @@ GfxPlatformView::GfxPlatformView(
AwaitVsyncCallback await_vsync_callback,
AwaitVsyncForSecondaryCallbackCallback
await_vsync_for_secondary_callback_callback)
: PlatformView(delegate,
: PlatformView(false /* is_flatland */,
delegate,
std::move(task_runners),
std::move(view_ref),
std::move(external_view_embedder),

View File

@@ -51,6 +51,7 @@ void SetInterfaceErrorHandler(fidl::Binding<T>& binding, std::string name) {
}
PlatformView::PlatformView(
bool is_flatland,
flutter::PlatformView::Delegate& delegate,
flutter::TaskRunners task_runners,
fuchsia::ui::views::ViewRef view_ref,
@@ -121,30 +122,33 @@ PlatformView::PlatformView(
});
// Begin watching for pointer events.
pointer_delegate_->WatchLoop([weak = weak_factory_.GetWeakPtr()](
std::vector<flutter::PointerData> events) {
if (!weak) {
FML_LOG(WARNING) << "PlatformView use-after-free attempted. Ignoring.";
return;
}
if (is_flatland) { // TODO(fxbug.dev/85125): make unconditional
pointer_delegate_->WatchLoop([weak = weak_factory_.GetWeakPtr()](
std::vector<flutter::PointerData> events) {
if (!weak) {
FML_LOG(WARNING) << "PlatformView use-after-free attempted. Ignoring.";
return;
}
if (events.size() == 0) {
return; // No work, bounce out.
}
if (events.size() == 0) {
return; // No work, bounce out.
}
// If pixel ratio hasn't been set, use a default value of 1.
const float pixel_ratio = weak->view_pixel_ratio_.value_or(1.f);
auto packet = std::make_unique<flutter::PointerDataPacket>(events.size());
for (size_t i = 0; i < events.size(); ++i) {
auto& event = events[i];
// Translate logical to physical coordinates, as per flutter::PointerData
// contract. Done here because pixel ratio comes from the graphics API.
event.physical_x = event.physical_x * pixel_ratio;
event.physical_y = event.physical_y * pixel_ratio;
packet->SetPointerData(i, event);
}
weak->DispatchPointerDataPacket(std::move(packet));
});
// If pixel ratio hasn't been set, use a default value of 1.
const float pixel_ratio = weak->view_pixel_ratio_.value_or(1.f);
auto packet = std::make_unique<flutter::PointerDataPacket>(events.size());
for (size_t i = 0; i < events.size(); ++i) {
auto& event = events[i];
// Translate logical to physical coordinates, as per
// flutter::PointerData contract. Done here because pixel ratio comes
// from the graphics API.
event.physical_x = event.physical_x * pixel_ratio;
event.physical_y = event.physical_y * pixel_ratio;
packet->SetPointerData(i, event);
}
weak->DispatchPointerDataPacket(std::move(packet));
});
}
// Finally! Register the native platform message handlers.
RegisterPlatformMessageHandlers();

View File

@@ -64,6 +64,7 @@ class PlatformView : public flutter::PlatformView,
private fuchsia::ui::input::InputMethodEditorClient {
public:
PlatformView(
bool is_flatland,
flutter::PlatformView::Delegate& delegate,
flutter::TaskRunners task_runners,
fuchsia::ui::views::ViewRef view_ref,

View File

@@ -1385,7 +1385,8 @@ TEST_F(PlatformViewTests, OnShaderWarmup) {
EXPECT_EQ(expected_result_string, response->result_string);
}
TEST_F(PlatformViewTests, TouchSourceLogicalToPhysicalConversion) {
// TODO(fxbug.dev/85125): Enable when GFX converts to TouchSource.
TEST_F(PlatformViewTests, DISABLED_TouchSourceLogicalToPhysicalConversion) {
constexpr std::array<std::array<float, 2>, 2> kRect = {{{0, 0}, {20, 20}}};
constexpr std::array<float, 9> kIdentity = {1, 0, 0, 0, 1, 0, 0, 0, 1};
constexpr fuchsia::ui::pointer::TouchInteractionId kIxnOne = {