Update to new Dart FIDL bindings API. (flutter/engine#3988)
* Update to new Dart FIDL bindings API.
This commit is contained in:
@@ -71,6 +71,7 @@ source_set("flow") {
|
||||
deps += [
|
||||
"//apps/mozart/lib/scene:client",
|
||||
"//apps/mozart/services/scene",
|
||||
"//lib/fidl/dart/sdk_ext",
|
||||
]
|
||||
|
||||
public_deps = [
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
|
||||
namespace flow {
|
||||
|
||||
ExportNode::ExportNode(uint32_t export_token_handle)
|
||||
: export_token_(export_token_handle) {}
|
||||
ExportNode::ExportNode(ftl::RefPtr<fidl::dart::Handle> export_token_handle)
|
||||
: export_token_(export_token_handle->ReleaseHandle()) {}
|
||||
|
||||
ExportNode::~ExportNode() {
|
||||
// TODO(MZ-190): Ensure the node is properly unregistered on the rasterizer
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
|
||||
#include "apps/mozart/lib/scene/client/resources.h"
|
||||
#include "flutter/flow/scene_update_context.h"
|
||||
#include "lib/fidl/dart/sdk_ext/src/handle.h"
|
||||
#include "lib/ftl/build_config.h"
|
||||
#include "lib/ftl/macros.h"
|
||||
#include "lib/ftl/memory/ref_counted.h"
|
||||
@@ -27,7 +28,7 @@ namespace flow {
|
||||
// Therefore this object is thread-safe.
|
||||
class ExportNode : public ftl::RefCountedThreadSafe<ExportNode> {
|
||||
public:
|
||||
ExportNode(uint32_t export_token_handle);
|
||||
ExportNode(ftl::RefPtr<fidl::dart::Handle> export_token_handle);
|
||||
|
||||
// Binds the export token to the entity node and adds it as a child of
|
||||
// the specified container.
|
||||
|
||||
@@ -1193,7 +1193,6 @@ dart:fidl.internal,HandleWaiter,asyncWait
|
||||
dart:fidl.internal,HandleWaiter,cancelWait
|
||||
dart:fidl.internal,HandleWaiter,_asyncWait
|
||||
dart:fidl.internal,HandleWaiter,_cancelWait
|
||||
dart:fidl.internal,HandleWaiter,onWaitComplete
|
||||
dart:fidl.internal,HandleWaiter,get:_callback
|
||||
dart:fidl.internal,HandleWaiter,set:_callback
|
||||
dart:fidl.internal,MxStartupInfo,takeEnvironment
|
||||
|
||||
@@ -87,4 +87,7 @@ source_set("ui") {
|
||||
"//third_party/skia",
|
||||
"//third_party/skia:gpu",
|
||||
]
|
||||
if (is_fuchsia) {
|
||||
deps += [ "//lib/fidl/dart/sdk_ext" ]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -271,11 +271,15 @@ class SceneHost extends NativeFieldWrapperClass2 {
|
||||
/// sending the corresponding import token (the other endpoint of the event pair)
|
||||
/// to the child.
|
||||
///
|
||||
/// The export token is a dart:fidl.internal Handle, but that type isn't
|
||||
/// available here. This is called by ChildViewConnection in
|
||||
/// //apps/mozart/lib/flutter/.
|
||||
///
|
||||
/// The scene host takes ownership of the provided export token handle.
|
||||
SceneHost(int export_token_handle) {
|
||||
SceneHost(dynamic export_token_handle) {
|
||||
_constructor(export_token_handle);
|
||||
}
|
||||
void _constructor(int export_token_handle) native "SceneHost_constructor";
|
||||
void _constructor(dynamic export_token_handle) native "SceneHost_constructor";
|
||||
|
||||
/// Releases the resources associated with the child scene host.
|
||||
///
|
||||
|
||||
@@ -7,9 +7,10 @@
|
||||
#include "lib/tonic/dart_args.h"
|
||||
#include "lib/tonic/dart_binding_macros.h"
|
||||
#include "lib/tonic/dart_library_natives.h"
|
||||
#include "lib/tonic/dart_wrappable.h"
|
||||
|
||||
#if defined(OS_FUCHSIA)
|
||||
#include "lib/tonic/handle_table.h"
|
||||
#ifdef OS_FUCHSIA
|
||||
#include "lib/fidl/dart/sdk_ext/src/handle.h"
|
||||
#endif
|
||||
|
||||
namespace blink {
|
||||
@@ -29,16 +30,22 @@ void SceneHost::RegisterNatives(tonic::DartLibraryNatives* natives) {
|
||||
FOR_EACH_BINDING(DART_REGISTER_NATIVE)});
|
||||
}
|
||||
|
||||
ftl::RefPtr<SceneHost> SceneHost::create(int export_token_handle) {
|
||||
#if defined(OS_FUCHSIA)
|
||||
ftl::RefPtr<SceneHost> SceneHost::create(
|
||||
ftl::RefPtr<fidl::dart::Handle> export_token_handle) {
|
||||
return ftl::MakeRefCounted<SceneHost>(export_token_handle);
|
||||
}
|
||||
|
||||
SceneHost::SceneHost(int export_token_handle) {
|
||||
#if defined(OS_FUCHSIA)
|
||||
export_node_ = ftl::MakeRefCounted<flow::ExportNode>(
|
||||
tonic::HandleTable::Current().Unwrap(export_token_handle));
|
||||
#endif
|
||||
SceneHost::SceneHost(ftl::RefPtr<fidl::dart::Handle> export_token_handle) {
|
||||
export_node_ = ftl::MakeRefCounted<flow::ExportNode>(export_token_handle);
|
||||
}
|
||||
#else
|
||||
ftl::RefPtr<SceneHost> SceneHost::create(Dart_Handle export_token_handle) {
|
||||
return ftl::MakeRefCounted<SceneHost>(export_token_handle);
|
||||
}
|
||||
|
||||
SceneHost::SceneHost(Dart_Handle export_token_handle) {}
|
||||
#endif
|
||||
|
||||
SceneHost::~SceneHost() {}
|
||||
|
||||
|
||||
@@ -25,7 +25,12 @@ class SceneHost : public ftl::RefCountedThreadSafe<SceneHost>,
|
||||
FRIEND_MAKE_REF_COUNTED(SceneHost);
|
||||
|
||||
public:
|
||||
static ftl::RefPtr<SceneHost> create(int export_token_handle);
|
||||
#if defined(OS_FUCHSIA)
|
||||
static ftl::RefPtr<SceneHost> create(
|
||||
ftl::RefPtr<fidl::dart::Handle> export_token_handle);
|
||||
#else
|
||||
static ftl::RefPtr<SceneHost> create(Dart_Handle export_token_handle);
|
||||
#endif
|
||||
|
||||
~SceneHost() override;
|
||||
|
||||
@@ -44,7 +49,11 @@ class SceneHost : public ftl::RefCountedThreadSafe<SceneHost>,
|
||||
ftl::RefPtr<flow::ExportNode> export_node_;
|
||||
#endif
|
||||
|
||||
explicit SceneHost(int export_token_handle);
|
||||
#if defined(OS_FUCHSIA)
|
||||
explicit SceneHost(ftl::RefPtr<fidl::dart::Handle> export_token_handle);
|
||||
#else
|
||||
explicit SceneHost(Dart_Handle export_token_handle);
|
||||
#endif
|
||||
};
|
||||
|
||||
} // namespace blink
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
dart:fidl.internal,::,_environment
|
||||
dart:fidl.internal,::,_outgoingServices
|
||||
dart:fidl.internal,HandleWaiter,onWaitComplete
|
||||
dart:mozart.internal,::,_viewContainer
|
||||
dart:mozart.internal,::,_context
|
||||
|
||||
Reference in New Issue
Block a user