Skip to content

Commit 3ae70af

Browse files
authored
Revert "[fuchsia] Expose view_ref as part of dart:fuchsia initialization (flutter#15958)"
This reverts commit 5d7c2a9.
1 parent 87b3b95 commit 3ae70af

File tree

10 files changed

+19
-50
lines changed

10 files changed

+19
-50
lines changed

shell/platform/fuchsia/dart-pkg/fuchsia/lib/fuchsia.dart

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,8 @@ Handle _environment;
1818
@pragma('vm:entry-point')
1919
Handle _outgoingServices;
2020

21-
@pragma('vm:entry-point')
22-
Handle _viewRef;
23-
2421
class MxStartupInfo {
2522
// TODO: refactor Handle to a Channel
26-
// https://github.com/flutter/flutter/issues/49439
2723
static Handle takeEnvironment() {
2824
if (_outgoingServices == null && Platform.isFuchsia) {
2925
throw Exception(
@@ -35,7 +31,6 @@ class MxStartupInfo {
3531
}
3632

3733
// TODO: refactor Handle to a Channel
38-
// https://github.com/flutter/flutter/issues/49439
3934
static Handle takeOutgoingServices() {
4035
if (_outgoingServices == null && Platform.isFuchsia) {
4136
throw Exception(
@@ -45,18 +40,6 @@ class MxStartupInfo {
4540
_outgoingServices = null;
4641
return handle;
4742
}
48-
49-
// TODO: refactor Handle to a ViewRef
50-
// https://github.com/flutter/flutter/issues/49439
51-
static Handle takeViewRef() {
52-
if (_viewRef == null && Platform.isFuchsia) {
53-
throw Exception(
54-
'Attempting to call takeViewRef more than once per process');
55-
}
56-
Handle handle = _viewRef;
57-
_viewRef = null;
58-
return handle;
59-
}
6043
}
6144

6245
void _setReturnCode(int returnCode) native 'SetReturnCode';

shell/platform/fuchsia/dart-pkg/fuchsia/sdk_ext/fuchsia.cc

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,7 @@ void SetReturnCode(Dart_NativeArguments arguments) {
102102
} // namespace
103103

104104
void Initialize(fidl::InterfaceHandle<fuchsia::sys::Environment> environment,
105-
zx::channel directory_request,
106-
std::optional<zx::eventpair> view_ref) {
105+
zx::channel directory_request) {
107106
zircon::dart::Initialize();
108107

109108
Dart_Handle library = Dart_LookupLibrary(ToDart("dart:fuchsia"));
@@ -129,13 +128,6 @@ void Initialize(fidl::InterfaceHandle<fuchsia::sys::Environment> environment,
129128
ToDart(zircon::dart::Handle::Create(std::move(directory_request))));
130129
FML_CHECK(!tonic::LogIfError(result));
131130
}
132-
133-
if (view_ref) {
134-
result = Dart_SetField(
135-
library, ToDart("_viewRef"),
136-
ToDart(zircon::dart::Handle::Create((*view_ref).release())));
137-
FML_CHECK(!tonic::LogIfError(result));
138-
}
139131
}
140132

141133
} // namespace dart

shell/platform/fuchsia/dart-pkg/fuchsia/sdk_ext/fuchsia.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,7 @@ namespace fuchsia {
1111
namespace dart {
1212

1313
void Initialize(fidl::InterfaceHandle<fuchsia::sys::Environment> environment,
14-
zx::channel directory_request,
15-
std::optional<zx::eventpair> view_ref);
14+
zx::channel directory_request);
1615

1716
} // namespace dart
1817
} // namespace fuchsia

shell/platform/fuchsia/dart_runner/builtin_libraries.cc

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66

77
#include <lib/fdio/namespace.h>
88
#include <lib/zx/channel.h>
9-
#include <optional>
109

1110
#include "dart-pkg/fuchsia/sdk_ext/fuchsia.h"
1211
#include "flutter/fml/logging.h"
@@ -104,10 +103,9 @@ void InitBuiltinLibrariesForIsolate(
104103
zx::channel directory_request,
105104
bool service_isolate) {
106105
// dart:fuchsia --------------------------------------------------------------
107-
// dart runner doesn't care about scenic view ref.
108106
if (!service_isolate) {
109107
fuchsia::dart::Initialize(std::move(environment),
110-
std::move(directory_request), std::nullopt);
108+
std::move(directory_request));
111109
}
112110

113111
// dart:fuchsia.builtin ------------------------------------------------------

shell/platform/fuchsia/flutter/component.cc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
#include <lib/async/default.h>
1414
#include <lib/fdio/directory.h>
1515
#include <lib/fdio/namespace.h>
16+
#include <lib/ui/scenic/cpp/view_ref_pair.h>
1617
#include <lib/ui/scenic/cpp/view_token_pair.h>
1718
#include <lib/vfs/cpp/composed_service_dir.h>
1819
#include <lib/vfs/cpp/remote_dir.h>
@@ -615,6 +616,7 @@ void Application::CreateView(
615616
settings_, // settings
616617
std::move(isolate_snapshot_), // isolate snapshot
617618
scenic::ToViewToken(std::move(view_token)), // view token
619+
scenic::ViewRefPair::New(), // view ref pair
618620
std::move(fdio_ns_), // FDIO namespace
619621
std::move(directory_request_) // outgoing request
620622
));

shell/platform/fuchsia/flutter/engine.cc

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
#include "engine.h"
88

99
#include <lib/async/cpp/task.h>
10-
#include <lib/ui/scenic/cpp/view_ref_pair.h>
1110
#include <zircon/status.h>
1211
#include <sstream>
1312

@@ -56,6 +55,7 @@ Engine::Engine(Delegate& delegate,
5655
flutter::Settings settings,
5756
fml::RefPtr<const flutter::DartSnapshot> isolate_snapshot,
5857
fuchsia::ui::views::ViewToken view_token,
58+
scenic::ViewRefPair view_ref_pair,
5959
UniqueFDIONS fdio_ns,
6060
fidl::InterfaceRequest<fuchsia::io::Directory> directory_request)
6161
: delegate_(delegate),
@@ -111,14 +111,9 @@ Engine::Engine(Delegate& delegate,
111111
});
112112
};
113113

114-
auto view_ref_pair = scenic::ViewRefPair::New();
115114
fuchsia::ui::views::ViewRef view_ref;
116115
view_ref_pair.view_ref.Clone(&view_ref);
117116

118-
fuchsia::ui::views::ViewRef dart_view_ref;
119-
view_ref_pair.view_ref.Clone(&dart_view_ref);
120-
zx::eventpair dart_view_ref_event_pair(std::move(dart_view_ref.reference));
121-
122117
// Setup the callback that will instantiate the platform view.
123118
flutter::Shell::CreateCallback<flutter::PlatformView>
124119
on_create_platform_view = fml::MakeCopyable(
@@ -261,10 +256,9 @@ Engine::Engine(Delegate& delegate,
261256
svc->Connect(environment.NewRequest());
262257

263258
isolate_configurator_ = std::make_unique<IsolateConfigurator>(
264-
std::move(fdio_ns), //
265-
std::move(environment), //
266-
directory_request.TakeChannel(), //
267-
std::move(dart_view_ref_event_pair) //
259+
std::move(fdio_ns), //
260+
std::move(environment), //
261+
directory_request.TakeChannel() //
268262
);
269263
}
270264

shell/platform/fuchsia/flutter/engine.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
#include <fuchsia/ui/views/cpp/fidl.h>
1212
#include <lib/async-loop/cpp/loop.h>
1313
#include <lib/sys/cpp/service_directory.h>
14+
#include <lib/ui/scenic/cpp/view_ref_pair.h>
1415
#include <lib/zx/event.h>
1516

1617
#include "flutter/fml/macros.h"
@@ -36,6 +37,7 @@ class Engine final {
3637
flutter::Settings settings,
3738
fml::RefPtr<const flutter::DartSnapshot> isolate_snapshot,
3839
fuchsia::ui::views::ViewToken view_token,
40+
scenic::ViewRefPair view_ref_pair,
3941
UniqueFDIONS fdio_ns,
4042
fidl::InterfaceRequest<fuchsia::io::Directory> directory_request);
4143
~Engine();

shell/platform/fuchsia/flutter/isolate_configurator.cc

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,10 @@ namespace flutter_runner {
1616
IsolateConfigurator::IsolateConfigurator(
1717
UniqueFDIONS fdio_ns,
1818
fidl::InterfaceHandle<fuchsia::sys::Environment> environment,
19-
zx::channel directory_request,
20-
zx::eventpair view_ref)
19+
zx::channel directory_request)
2120
: fdio_ns_(std::move(fdio_ns)),
2221
environment_(std::move(environment)),
23-
directory_request_(std::move(directory_request)),
24-
view_ref_(std::move(view_ref)) {}
22+
directory_request_(std::move(directory_request)) {}
2523

2624
IsolateConfigurator::~IsolateConfigurator() = default;
2725

@@ -44,8 +42,7 @@ bool IsolateConfigurator::ConfigureCurrentIsolate() {
4442

4543
void IsolateConfigurator::BindFuchsia() {
4644
fuchsia::dart::Initialize(std::move(environment_),
47-
std::move(directory_request_),
48-
std::move(view_ref_));
45+
std::move(directory_request_));
4946
}
5047

5148
void IsolateConfigurator::BindZircon() {

shell/platform/fuchsia/flutter/isolate_configurator.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,7 @@ class IsolateConfigurator final {
2121
IsolateConfigurator(
2222
UniqueFDIONS fdio_ns,
2323
fidl::InterfaceHandle<fuchsia::sys::Environment> environment,
24-
zx::channel directory_request,
25-
zx::eventpair view_ref);
24+
zx::channel directory_request);
2625

2726
~IsolateConfigurator();
2827

@@ -35,7 +34,6 @@ class IsolateConfigurator final {
3534
UniqueFDIONS fdio_ns_;
3635
fidl::InterfaceHandle<fuchsia::sys::Environment> environment_;
3736
zx::channel directory_request_;
38-
zx::eventpair view_ref_;
3937

4038
void BindFuchsia();
4139

shell/platform/fuchsia/flutter/session_connection.cc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,10 @@ SessionConnection::SessionConnection(
3636

3737
session_wrapper_.SetDebugName(debug_label_);
3838

39+
// TODO(SCN-975): Re-enable.
40+
// view_->GetToken(std::bind(&PlatformView::ConnectSemanticsProvider, this,
41+
// std::placeholders::_1));
42+
3943
root_view_.AddChild(root_node_);
4044
root_node_.SetEventMask(fuchsia::ui::gfx::kMetricsEventMask |
4145
fuchsia::ui::gfx::kSizeChangeHintEventMask);

0 commit comments

Comments
 (0)