Skip to content

Commit

Permalink
[fuchsia] Delete obsolete GFX-specific source files (flutter#44594)
Browse files Browse the repository at this point in the history
This change removes 
- GFX source files removed from the BUILD in flutter#44401 
- Extraneous unused Scenic includes in the same directory
(`//shell/platform/fuchsia/flutter/`)
- All remaining uses of the Scenic library from the Fuchsia SDK
- All remaining uses of fuchsia.ui.scenic.*
  • Loading branch information
caroqliu authored Aug 14, 2023
1 parent f1f912c commit 21aed05
Show file tree
Hide file tree
Showing 33 changed files with 391 additions and 8,509 deletions.
1 change: 0 additions & 1 deletion ci/licenses_golden/excluded_files
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,6 @@
../../../flutter/shell/platform/fuchsia/flutter/kernel/libraries.yaml
../../../flutter/shell/platform/fuchsia/flutter/kernel/pubspec.yaml
../../../flutter/shell/platform/fuchsia/flutter/keyboard_unittest.cc
../../../flutter/shell/platform/fuchsia/flutter/platform_view_unittest.cc
../../../flutter/shell/platform/fuchsia/flutter/pointer_delegate_unittests.cc
../../../flutter/shell/platform/fuchsia/flutter/pointer_injector_delegate_unittest.cc
../../../flutter/shell/platform/fuchsia/flutter/rtree_unittests.cc
Expand Down
12 changes: 0 additions & 12 deletions ci/licenses_golden/licenses_flutter
Original file line number Diff line number Diff line change
Expand Up @@ -2959,12 +2959,6 @@ ORIGIN: ../../../flutter/shell/platform/fuchsia/flutter/focus_delegate.cc + ../.
ORIGIN: ../../../flutter/shell/platform/fuchsia/flutter/focus_delegate.h + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/shell/platform/fuchsia/flutter/fuchsia_intl.cc + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/shell/platform/fuchsia/flutter/fuchsia_intl.h + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/shell/platform/fuchsia/flutter/gfx_external_view_embedder.cc + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/shell/platform/fuchsia/flutter/gfx_external_view_embedder.h + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/shell/platform/fuchsia/flutter/gfx_platform_view.cc + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/shell/platform/fuchsia/flutter/gfx_platform_view.h + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/shell/platform/fuchsia/flutter/gfx_session_connection.cc + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/shell/platform/fuchsia/flutter/gfx_session_connection.h + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/shell/platform/fuchsia/flutter/isolate_configurator.cc + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/shell/platform/fuchsia/flutter/isolate_configurator.h + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/shell/platform/fuchsia/flutter/kernel/framework_shim.dart + ../../../flutter/LICENSE
Expand Down Expand Up @@ -5711,12 +5705,6 @@ FILE: ../../../flutter/shell/platform/fuchsia/flutter/focus_delegate.cc
FILE: ../../../flutter/shell/platform/fuchsia/flutter/focus_delegate.h
FILE: ../../../flutter/shell/platform/fuchsia/flutter/fuchsia_intl.cc
FILE: ../../../flutter/shell/platform/fuchsia/flutter/fuchsia_intl.h
FILE: ../../../flutter/shell/platform/fuchsia/flutter/gfx_external_view_embedder.cc
FILE: ../../../flutter/shell/platform/fuchsia/flutter/gfx_external_view_embedder.h
FILE: ../../../flutter/shell/platform/fuchsia/flutter/gfx_platform_view.cc
FILE: ../../../flutter/shell/platform/fuchsia/flutter/gfx_platform_view.h
FILE: ../../../flutter/shell/platform/fuchsia/flutter/gfx_session_connection.cc
FILE: ../../../flutter/shell/platform/fuchsia/flutter/gfx_session_connection.h
FILE: ../../../flutter/shell/platform/fuchsia/flutter/isolate_configurator.cc
FILE: ../../../flutter/shell/platform/fuchsia/flutter/isolate_configurator.h
FILE: ../../../flutter/shell/platform/fuchsia/flutter/kernel/framework_shim.dart
Expand Down
72 changes: 0 additions & 72 deletions ci/licenses_golden/licenses_fuchsia

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion shell/platform/fuchsia/flutter/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,6 @@ template("runner_sources") {

public_deps = [
"$fuchsia_sdk_root/pkg:inspect",
"$fuchsia_sdk_root/pkg:scenic_cpp",
"$fuchsia_sdk_root/pkg:sys_cpp",
"$fuchsia_sdk_root/pkg:sys_inspect_cpp",
"//flutter/shell/platform/fuchsia/runtime/dart/utils",
Expand All @@ -157,6 +156,8 @@ template("runner_sources") {
"$fuchsia_sdk_root/fidl:fuchsia.memorypressure",
"$fuchsia_sdk_root/fidl:fuchsia.ui.app",
"$fuchsia_sdk_root/fidl:fuchsia.ui.composition",
"$fuchsia_sdk_root/fidl:fuchsia.ui.input",
"$fuchsia_sdk_root/fidl:fuchsia.ui.input3",
"$fuchsia_sdk_root/fidl:fuchsia.ui.pointer",
"$fuchsia_sdk_root/fidl:fuchsia.ui.pointerinjector",
"$fuchsia_sdk_root/fidl:fuchsia.ui.test.input",
Expand Down
14 changes: 12 additions & 2 deletions shell/platform/fuchsia/flutter/accessibility_bridge_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

#include "accessibility_bridge.h"

#include <fuchsia/ui/views/cpp/fidl.h>
#include <lib/async-loop/cpp/loop.h>
#include <lib/async-loop/default.h>
#include <lib/async/cpp/executor.h>
Expand All @@ -13,7 +14,7 @@
#include <lib/inspect/cpp/inspector.h>
#include <lib/inspect/cpp/reader.h>
#include <lib/sys/cpp/testing/service_directory_provider.h>
#include <lib/ui/scenic/cpp/view_ref_pair.h>
#include <lib/zx/eventpair.h>
#include <zircon/status.h>
#include <zircon/types.h>

Expand Down Expand Up @@ -112,7 +113,16 @@ class AccessibilityBridgeTest : public testing::Test {
[this](int32_t node_id, flutter::SemanticsAction action) {
accessibility_delegate_.DispatchSemanticsAction(node_id, action);
};
auto [view_ref_control, view_ref] = scenic::ViewRefPair::New();

fuchsia::ui::views::ViewRefControl view_ref_control;
fuchsia::ui::views::ViewRef view_ref;
auto status = zx::eventpair::create(
/*options*/ 0u, &view_ref_control.reference, &view_ref.reference);
ASSERT_EQ(status, ZX_OK);
view_ref_control.reference.replace(
ZX_DEFAULT_EVENTPAIR_RIGHTS & (~ZX_RIGHT_DUPLICATE),
&view_ref_control.reference);
view_ref.reference.replace(ZX_RIGHTS_BASIC, &view_ref.reference);
accessibility_bridge_ =
std::make_unique<flutter_runner::AccessibilityBridge>(
std::move(set_semantics_enabled_callback),
Expand Down
16 changes: 13 additions & 3 deletions shell/platform/fuchsia/flutter/component_v2.cc
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@
#include <lib/fdio/directory.h>
#include <lib/fdio/io.h>
#include <lib/fdio/namespace.h>
#include <lib/ui/scenic/cpp/view_ref_pair.h>
#include <lib/ui/scenic/cpp/view_token_pair.h>
#include <lib/vfs/cpp/composed_service_dir.h>
#include <lib/vfs/cpp/remote_dir.h>
#include <lib/vfs/cpp/service.h>
Expand Down Expand Up @@ -635,6 +633,18 @@ void ComponentV2::CreateView2(fuchsia::ui::app::CreateView2Args view_args) {
return;
}

fuchsia::ui::views::ViewRefControl view_ref_control;
fuchsia::ui::views::ViewRef view_ref;
auto status = zx::eventpair::create(
/*options*/ 0u, &view_ref_control.reference, &view_ref.reference);
ZX_ASSERT(status == ZX_OK);
view_ref_control.reference.replace(
ZX_DEFAULT_EVENTPAIR_RIGHTS & (~ZX_RIGHT_DUPLICATE),
&view_ref_control.reference);
view_ref.reference.replace(ZX_RIGHTS_BASIC, &view_ref.reference);
auto view_ref_pair =
std::make_pair(std::move(view_ref_control), std::move(view_ref));

shell_holders_.emplace(std::make_unique<Engine>(
*this, // delegate
debug_label_, // thread label
Expand All @@ -643,7 +653,7 @@ void ComponentV2::CreateView2(fuchsia::ui::app::CreateView2Args view_args) {
settings_, // settings
std::move(
*view_args.mutable_view_creation_token()), // view creation token
scenic::ViewRefPair::New(), // view ref pair
std::move(view_ref_pair), // view ref pair
std::move(fdio_ns_), // FDIO namespace
std::move(directory_request_), // outgoing request
product_config_, // product configuration
Expand Down
17 changes: 10 additions & 7 deletions shell/platform/fuchsia/flutter/engine.cc
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#include <fuchsia/accessibility/semantics/cpp/fidl.h>
#include <fuchsia/media/cpp/fidl.h>
#include <lib/async/cpp/task.h>
#include <lib/zx/eventpair.h>
#include <lib/zx/thread.h>
#include <zircon/rights.h>
#include <zircon/status.h>
Expand Down Expand Up @@ -203,7 +204,8 @@ Engine::Engine(Delegate& delegate,
std::shared_ptr<sys::ServiceDirectory> runner_services,
flutter::Settings settings,
fuchsia::ui::views::ViewCreationToken view_creation_token,
scenic::ViewRefPair view_ref_pair,
std::pair<fuchsia::ui::views::ViewRefControl,
fuchsia::ui::views::ViewRef> view_ref_pair,
UniqueFDIONS fdio_ns,
fidl::InterfaceRequest<fuchsia::io::Directory> directory_request,
FlutterRunnerProductConfiguration product_config,
Expand All @@ -223,7 +225,8 @@ Engine::Engine(Delegate& delegate,
}

void Engine::Initialize(
scenic::ViewRefPair view_ref_pair,
std::pair<fuchsia::ui::views::ViewRefControl, fuchsia::ui::views::ViewRef>
view_ref_pair,
std::shared_ptr<sys::ServiceDirectory> svc,
std::shared_ptr<sys::ServiceDirectory> runner_services,
flutter::Settings settings,
Expand Down Expand Up @@ -313,11 +316,11 @@ void Engine::Initialize(

// Make clones of the `ViewRef` before sending it to various places.
fuchsia::ui::views::ViewRef platform_view_ref;
view_ref_pair.view_ref.Clone(&platform_view_ref);
view_ref_pair.second.Clone(&platform_view_ref);
fuchsia::ui::views::ViewRef accessibility_view_ref;
view_ref_pair.view_ref.Clone(&accessibility_view_ref);
view_ref_pair.second.Clone(&accessibility_view_ref);
fuchsia::ui::views::ViewRef isolate_view_ref;
view_ref_pair.view_ref.Clone(&isolate_view_ref);
view_ref_pair.second.Clone(&isolate_view_ref);

// Session is terminated on the raster thread, but we must terminate ourselves
// on the platform thread.
Expand Down Expand Up @@ -366,8 +369,8 @@ void Engine::Initialize(
max_frames_in_flight, vsync_offset);

fuchsia::ui::views::ViewIdentityOnCreation view_identity = {
.view_ref = std::move(view_ref_pair.view_ref),
.view_ref_control = std::move(view_ref_pair.control_ref)};
.view_ref = std::move(view_ref_pair.second),
.view_ref_control = std::move(view_ref_pair.first)};
view_embedder_ = std::make_shared<ExternalViewEmbedder>(
std::move(view_creation_token), std::move(view_identity),
std::move(view_protocols), std::move(request), flatland_connection_,
Expand Down
8 changes: 4 additions & 4 deletions shell/platform/fuchsia/flutter/engine.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@
#include <fuchsia/ui/views/cpp/fidl.h>
#include <lib/async-loop/cpp/loop.h>
#include <lib/sys/cpp/service_directory.h>
#include <lib/ui/scenic/cpp/id.h>
#include <lib/ui/scenic/cpp/view_ref_pair.h>

#include "flutter/flow/embedded_views.h"
#include "flutter/flow/surface.h"
Expand Down Expand Up @@ -55,7 +53,8 @@ class Engine final : public fuchsia::memorypressure::Watcher {
std::shared_ptr<sys::ServiceDirectory> runner_services,
flutter::Settings settings,
fuchsia::ui::views::ViewCreationToken view_creation_token,
scenic::ViewRefPair view_ref_pair,
std::pair<fuchsia::ui::views::ViewRefControl,
fuchsia::ui::views::ViewRef> view_ref_pair,
UniqueFDIONS fdio_ns,
fidl::InterfaceRequest<fuchsia::io::Directory> directory_request,
FlutterRunnerProductConfiguration product_config,
Expand All @@ -73,7 +72,8 @@ class Engine final : public fuchsia::memorypressure::Watcher {

private:
void Initialize(
scenic::ViewRefPair view_ref_pair,
std::pair<fuchsia::ui::views::ViewRefControl, fuchsia::ui::views::ViewRef>
view_ref_pair,
std::shared_ptr<sys::ServiceDirectory> svc,
std::shared_ptr<sys::ServiceDirectory> runner_services,
flutter::Settings settings,
Expand Down
1 change: 0 additions & 1 deletion shell/platform/fuchsia/flutter/external_view_embedder.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
#include <fuchsia/ui/composition/cpp/fidl.h>
#include <fuchsia/ui/views/cpp/fidl.h>
#include <lib/fit/function.h>
#include <lib/ui/scenic/cpp/view_ref_pair.h>

#include <cstdint> // For uint32_t & uint64_t
#include <memory>
Expand Down
29 changes: 22 additions & 7 deletions shell/platform/fuchsia/flutter/focus_delegate_unittests.cc
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#include <lib/async-loop/cpp/loop.h>
#include <lib/async-loop/default.h>
#include <lib/fidl/cpp/binding_set.h>
#include <lib/ui/scenic/cpp/view_ref_pair.h>
#include <lib/zx/eventpair.h>

#include "focus_delegate.h"
#include "tests/fakes/focuser.h"
Expand Down Expand Up @@ -131,14 +131,22 @@ TEST_F(FocusDelegateTest, WatchCallbackSeries) {
// with a non-error status code.
TEST_F(FocusDelegateTest, RequestFocusTest) {
// This "Mock" ViewRef serves as the target for the RequestFocus operation.
auto mock_view_ref_pair = scenic::ViewRefPair::New();
fuchsia::ui::views::ViewRefControl view_ref_control;
fuchsia::ui::views::ViewRef view_ref;
auto status = zx::eventpair::create(
/*options*/ 0u, &view_ref_control.reference, &view_ref.reference);
ZX_ASSERT(status == ZX_OK);
view_ref_control.reference.replace(
ZX_DEFAULT_EVENTPAIR_RIGHTS & (~ZX_RIGHT_DUPLICATE),
&view_ref_control.reference);
view_ref.reference.replace(ZX_RIGHTS_BASIC, &view_ref.reference);

// Create the platform message request.
std::ostringstream message;
message << "{"
<< " \"method\":\"View.focus.request\","
<< " \"args\": {"
<< " \"viewRef\":"
<< mock_view_ref_pair.view_ref.reference.get() << " }"
<< " \"viewRef\":" << view_ref.reference.get() << " }"
<< "}";

// Dispatch the plaform message request with an expected completion response.
Expand All @@ -155,16 +163,23 @@ TEST_F(FocusDelegateTest, RequestFocusTest) {
// with a Error::DENIED status code.
TEST_F(FocusDelegateTest, RequestFocusFailTest) {
// This "Mock" ViewRef serves as the target for the RequestFocus operation.
auto mock_view_ref_pair = scenic::ViewRefPair::New();
fuchsia::ui::views::ViewRefControl view_ref_control;
fuchsia::ui::views::ViewRef view_ref;
auto status = zx::eventpair::create(
/*options*/ 0u, &view_ref_control.reference, &view_ref.reference);
ZX_ASSERT(status == ZX_OK);
view_ref_control.reference.replace(
ZX_DEFAULT_EVENTPAIR_RIGHTS & (~ZX_RIGHT_DUPLICATE),
&view_ref_control.reference);
view_ref.reference.replace(ZX_RIGHTS_BASIC, &view_ref.reference);
// We're testing the focus failure case.
focuser_->fail_request_focus();
// Create the platform message request.
std::ostringstream message;
message << "{"
<< " \"method\":\"View.focus.request\","
<< " \"args\": {"
<< " \"viewRef\":"
<< mock_view_ref_pair.view_ref.reference.get() << " }"
<< " \"viewRef\":" << view_ref.reference.get() << " }"
<< "}";

// Dispatch the plaform message request with an expected completion response.
Expand Down
Loading

0 comments on commit 21aed05

Please sign in to comment.