Skip to content

Commit

Permalink
Updates for the dart:fidl.internal rename and split. (flutter#4070)
Browse files Browse the repository at this point in the history
Now it references dart:zircon and dart:fuchsia.
  • Loading branch information
ianloic authored Sep 6, 2017
1 parent 5aabbe1 commit 0047b71
Show file tree
Hide file tree
Showing 15 changed files with 81 additions and 85 deletions.
32 changes: 19 additions & 13 deletions build/flutter_app.gni
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ assert(is_fuchsia)
import("//build/dart/dart_package.gni")
import("//flutter/lib/ui/dart_ui.gni")
import("//apps/mozart/lib/flutter/sdk_ext/sdk_ext.gni")
import("//garnet/public/lib/fidl/dart/sdk_ext/sdk_ext.gni")
import("//garnet/public/dart-pkg/fuchsia/sdk_ext.gni")
import("//garnet/public/dart-pkg/zircon/sdk_ext.gni")

declare_args() {
flutter_app_default_is_jit = true
Expand All @@ -18,7 +19,8 @@ gen_snapshot_dir = get_label_info(gen_snapshot_label, "root_out_dir")
gen_snapshot = "$gen_snapshot_dir/gen_snapshot"

flutter_root = "//lib/flutter"
flutter_tools_label = "$flutter_root/packages/flutter_tools:fuchsia_builder($host_toolchain)"
flutter_tools_label =
"$flutter_root/packages/flutter_tools:fuchsia_builder($host_toolchain)"
flutter_tools_out_dir = get_label_info(flutter_tools_label, "root_out_dir")
flutter_tools_bin = "$flutter_tools_out_dir/dart-tools/fuchsia_builder"

Expand Down Expand Up @@ -219,12 +221,14 @@ template("flutter_aot_app") {
action(assembly_label) {
depfile = assembly_depfile

inputs = fidl_dart_sdk_ext_files + mozart_dart_sdk_ext_files + [
main_dart,
"//flutter/runtime/dart_vm_entry_points.txt",
"//flutter/runtime/dart_vm_entry_points_fuchsia.txt",
"//dart/runtime/bin/dart_io_entries.txt",
]
inputs = fuchsia_sdk_ext_files + zircon_sdk_ext_files +
mozart_dart_sdk_ext_files +
[
main_dart,
"//flutter/runtime/dart_vm_entry_points.txt",
"//flutter/runtime/dart_vm_entry_points_fuchsia.txt",
"//dart/runtime/bin/dart_io_entries.txt",
]

outputs = [
assembly_path,
Expand All @@ -248,7 +252,9 @@ template("flutter_aot_app") {
"--url-mapping",
"dart:ui," + rebase_path(dart_ui_path),
"--url-mapping",
"dart:fidl.internal," + rebase_path(fidl_dart_sdk_ext_lib),
"dart:zircon," + rebase_path(zircon_sdk_ext_lib),
"--url-mapping",
"dart:fuchsia," + rebase_path(fuchsia_sdk_ext_lib),
"--url-mapping",
"dart:mozart.internal," + rebase_path(mozart_dart_sdk_ext_lib),
"--url-mapping",
Expand Down Expand Up @@ -300,8 +306,8 @@ template("flutter_aot_app") {
}

dylib_path =
get_label_info(":$dylib_label($shlib_toolchain)",
"root_out_dir") + "/lib.unstripped/lib$target_name.so"
get_label_info(":$dylib_label($shlib_toolchain)", "root_out_dir") +
"/lib.unstripped/lib$target_name.so"

action(target_name) {
depfile = bundle_depfile
Expand Down Expand Up @@ -392,7 +398,7 @@ template("flutter_app") {
"deps",
"manifest",
"analysis_options",
"source_dir"
"source_dir",
])
}
} else {
Expand All @@ -405,7 +411,7 @@ template("flutter_app") {
"deps",
"manifest",
"analysis_options",
"source_dir"
"source_dir",
])
}
}
Expand Down
2 changes: 1 addition & 1 deletion content_handler/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ template("flutter_content_handler") {
"//flutter/runtime",
"//flutter/sky/engine/platform",
"//flutter/vulkan",
"//garnet/public/lib/fidl/dart/sdk_ext",
"//garnet/public/dart-pkg/fuchsia",
"//garnet/public/lib/ftl",
"//garnet/public/lib/icu_data/cpp",
"//garnet/public/lib/mtl",
Expand Down
25 changes: 5 additions & 20 deletions content_handler/runtime_holder.cc
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@
#include "flutter/runtime/dart_controller.h"
#include "flutter/runtime/dart_init.h"
#include "flutter/runtime/runtime_init.h"
#include "lib/fidl/dart/sdk_ext/src/handle.h"
#include "lib/fidl/dart/sdk_ext/src/natives.h"
#include "dart-pkg/zircon/sdk_ext/handle.h"
#include "lib/ftl/functional/make_copyable.h"
#include "lib/ftl/logging.h"
#include "lib/ftl/time/time_delta.h"
Expand Down Expand Up @@ -358,7 +357,7 @@ void RuntimeHolder::DidCreateMainIsolate(Dart_Isolate isolate) {
if (asset_store_)
blink::AssetFontSelector::Install(asset_store_);
InitDartIoInternal();
InitFidlInternal();
InitFuchsia();
InitMozartInternal();
}

Expand All @@ -375,25 +374,11 @@ void RuntimeHolder::InitDartIoInternal() {
namespace_type, ToDart("_setupNamespace"), 1, namespace_args));
}

void RuntimeHolder::InitFidlInternal() {
void RuntimeHolder::InitFuchsia() {
fidl::InterfaceHandle<app::ApplicationEnvironment> environment;
context_->ConnectToEnvironmentService(environment.NewRequest());
fuchsia::dart::Initialize(std::move(environment), std::move(outgoing_services_));

Dart_Handle fidl_internal = Dart_LookupLibrary(ToDart("dart:fidl.internal"));

DART_CHECK_VALID(Dart_SetNativeResolver(
fidl_internal, fidl::dart::NativeLookup, fidl::dart::NativeSymbol));

fidl::dart::Initialize();

DART_CHECK_VALID(Dart_SetField(fidl_internal, ToDart("_environment"),
ToDart(fidl::dart::Handle::Create(
environment.PassHandle().release()))));

DART_CHECK_VALID(
Dart_SetField(fidl_internal, ToDart("_outgoingServices"),
ToDart(fidl::dart::Handle::Create(
outgoing_services_.PassChannel().release()))));
}

void RuntimeHolder::InitMozartInternal() {
Expand All @@ -412,7 +397,7 @@ void RuntimeHolder::InitMozartInternal() {
static_cast<mozart::NativesDelegate*>(this)))));

DART_CHECK_VALID(Dart_SetField(mozart_internal, ToDart("_viewContainer"),
ToDart(fidl::dart::Handle::Create(
ToDart(zircon::dart::Handle::Create(
view_container.PassHandle().release()))));
}

Expand Down
3 changes: 2 additions & 1 deletion content_handler/runtime_holder.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#include "apps/mozart/services/input/input_connection.fidl.h"
#include "apps/mozart/services/input/text_input.fidl.h"
#include "apps/mozart/services/views/view_manager.fidl.h"
#include "dart-pkg/fuchsia/sdk_ext/fuchsia.h"
#include "flutter/assets/unzipper_provider.h"
#include "flutter/assets/zip_asset_store.h"
#include "flutter/flow/layers/layer_tree.h"
Expand Down Expand Up @@ -88,7 +89,7 @@ class RuntimeHolder : public blink::RuntimeDelegate,
bool HandleTextInputPlatformMessage(blink::PlatformMessage* message);

void InitDartIoInternal();
void InitFidlInternal();
void InitFuchsia();
void InitMozartInternal();

void PostBeginFrame();
Expand Down
2 changes: 1 addition & 1 deletion flow/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ source_set("flow") {
deps += [
"//apps/mozart/lib/scenic:client",
"//apps/mozart/services/scenic",
"//garnet/public/lib/fidl/dart/sdk_ext",
"//garnet/public/dart-pkg/zircon",
]

public_deps += [
Expand Down
4 changes: 2 additions & 2 deletions flow/export_node.cc
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
namespace flow {

ExportNodeHolder::ExportNodeHolder(
ftl::RefPtr<fidl::dart::Handle> export_token_handle)
ftl::RefPtr<zircon::dart::Handle> export_token_handle)
: export_node_(std::make_unique<ExportNode>(export_token_handle)) {
ASSERT_IS_UI_THREAD;
}
Expand All @@ -31,7 +31,7 @@ ExportNodeHolder::~ExportNodeHolder() {
}));
}

ExportNode::ExportNode(ftl::RefPtr<fidl::dart::Handle> export_token_handle)
ExportNode::ExportNode(ftl::RefPtr<zircon::dart::Handle> export_token_handle)
: export_token_(export_token_handle->ReleaseHandle()) {}

ExportNode::~ExportNode() {
Expand Down
6 changes: 3 additions & 3 deletions flow/export_node.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

#include "apps/mozart/lib/scenic/client/resources.h"
#include "flutter/flow/scene_update_context.h"
#include "lib/fidl/dart/sdk_ext/src/handle.h"
#include "dart-pkg/zircon/sdk_ext/handle.h"
#include "lib/ftl/build_config.h"
#include "lib/ftl/macros.h"
#include "lib/ftl/memory/ref_counted.h"
Expand All @@ -26,7 +26,7 @@ namespace flow {
// held by the ExportNode.
class ExportNodeHolder : public ftl::RefCountedThreadSafe<ExportNodeHolder> {
public:
ExportNodeHolder(ftl::RefPtr<fidl::dart::Handle> export_token_handle);
ExportNodeHolder(ftl::RefPtr<zircon::dart::Handle> export_token_handle);
~ExportNodeHolder();

// Calls Bind() on the wrapped ExportNode.
Expand All @@ -50,7 +50,7 @@ class ExportNodeHolder : public ftl::RefCountedThreadSafe<ExportNodeHolder> {
// must be created and destroyed by the rasterizer thread.
class ExportNode {
public:
ExportNode(ftl::RefPtr<fidl::dart::Handle> export_token_handle);
ExportNode(ftl::RefPtr<zircon::dart::Handle> export_token_handle);

~ExportNode();

Expand Down
11 changes: 7 additions & 4 deletions lib/snapshot/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ import("//dart/utils/generate_patch_sdk.gni")

if (is_fuchsia) {
import("//apps/mozart/lib/flutter/sdk_ext/sdk_ext.gni")
import("//garnet/public/lib/fidl/dart/sdk_ext/sdk_ext.gni")
import("//garnet/public/dart-pkg/fuchsia/sdk_ext.gni")
import("//garnet/public/dart-pkg/zircon/sdk_ext.gni")
}

bindings_output_dir = "$root_gen_dir/sky/bindings"
Expand Down Expand Up @@ -157,11 +158,13 @@ action("generate_snapshot_bin") {
}

if (is_fuchsia) {
inputs += fidl_dart_sdk_ext_files + mozart_dart_sdk_ext_files
fidl_internal_path = rebase_path(fidl_dart_sdk_ext_lib)
inputs += zircon_sdk_ext_files + mozart_dart_sdk_ext_files
zircon_path = rebase_path(zircon_sdk_ext_lib)
fuchsia_path = rebase_path(fuchsia_sdk_ext_lib)
mozart_internal_path = rebase_path(mozart_dart_sdk_ext_lib)
args += [
"--url_mapping=dart:fidl.internal,$fidl_internal_path",
"--url_mapping=dart:zircon,$zircon_path",
"--url_mapping=dart:fuchsia,$fuchsia_path",
"--url_mapping=dart:mozart.internal,$mozart_internal_path",
"--packages",
rebase_path("$target_gen_dir/snapshot.packages"),
Expand Down
46 changes: 23 additions & 23 deletions lib/snapshot/fuchsia_compilation_trace.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1187,29 +1187,29 @@ dart:math,::,_doublePow
dart:math,::,_pow
dart:math,::,sin
dart:math,::,cos
dart:fidl.internal,HandleWaiter,HandleWaiter.
dart:fidl.internal,HandleWaiter,_constructor
dart:fidl.internal,HandleWaiter,asyncWait
dart:fidl.internal,HandleWaiter,cancelWait
dart:fidl.internal,HandleWaiter,_asyncWait
dart:fidl.internal,HandleWaiter,_cancelWait
dart:fidl.internal,HandleWaiter,get:_callback
dart:fidl.internal,HandleWaiter,set:_callback
dart:fidl.internal,MxStartupInfo,takeEnvironment
dart:fidl.internal,MxStartupInfo,takeOutgoingServices
dart:fidl.internal,MxHandle,_registerFinalizer
dart:fidl.internal,MxHandle,_unregisterFinalizer
dart:fidl.internal,MxHandle,close
dart:fidl.internal,MxChannel,create
dart:fidl.internal,MxChannel,write
dart:fidl.internal,MxChannel,queryAndRead
dart:fidl.internal,Handle,Handle.
dart:fidl.internal,Handle,get:h
dart:fidl.internal,Handle,get:_h
dart:fidl.internal,Handle,set:_h
dart:fidl.internal,Handle,get:isValid
dart:fidl.internal,Handle,close
dart:fidl.internal,Handle,release
dart:zircon,HandleWaiter,HandleWaiter.
dart:zircon,HandleWaiter,_constructor
dart:zircon,HandleWaiter,asyncWait
dart:zircon,HandleWaiter,cancelWait
dart:zircon,HandleWaiter,_asyncWait
dart:zircon,HandleWaiter,_cancelWait
dart:zircon,HandleWaiter,get:_callback
dart:zircon,HandleWaiter,set:_callback
dart:fuchsia,MxStartupInfo,takeEnvironment
dart:fuchsia,MxStartupInfo,takeOutgoingServices
dart:zircon,MxHandle,_registerFinalizer
dart:zircon,MxHandle,_unregisterFinalizer
dart:zircon,MxHandle,close
dart:zircon,MxChannel,create
dart:zircon,MxChannel,write
dart:zircon,MxChannel,queryAndRead
dart:zircon,Handle,Handle.
dart:zircon,Handle,get:h
dart:zircon,Handle,get:_h
dart:zircon,Handle,set:_h
dart:zircon,Handle,get:isValid
dart:zircon,Handle,close
dart:zircon,Handle,release
dart:io,_Filter,_newZLibInflateFilter
dart:io,_HttpOutboundMessage,get:_outgoing
dart:io,_HttpOutboundMessage,get:headers
Expand Down
3 changes: 2 additions & 1 deletion lib/snapshot/snapshot_fuchsia.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,14 @@ import 'dart:collection';
import 'dart:convert';
import 'dart:core';
import 'dart:developer';
import 'dart:fidl.internal';
import 'dart:fuchsia';
import 'dart:io';
import 'dart:isolate';
import 'dart:math';
import 'dart:mozart.internal';
import 'dart:typed_data';
import 'dart:ui';
import 'dart:zircon';

// These libraries are optional. They are included in the core snapshot and
// partially compiled to avoid repeating them in each application and improve
Expand Down
2 changes: 1 addition & 1 deletion lib/ui/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,6 @@ source_set("ui") {
"//third_party/skia:gpu",
]
if (is_fuchsia) {
deps += [ "//garnet/public/lib/fidl/dart/sdk_ext" ]
deps += [ "//garnet/public/dart-pkg/zircon" ]
}
}
2 changes: 1 addition & 1 deletion lib/ui/compositing.dart
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ 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
/// The export token is a dart:zircon Handle, but that type isn't
/// available here. This is called by ChildViewConnection in
/// //apps/mozart/lib/flutter/.
///
Expand Down
6 changes: 3 additions & 3 deletions lib/ui/compositing/scene_host.cc
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#include "lib/tonic/dart_wrappable.h"

#ifdef OS_FUCHSIA
#include "lib/fidl/dart/sdk_ext/src/handle.h"
#include "dart-pkg/zircon/sdk_ext/handle.h"
#endif

namespace blink {
Expand All @@ -32,11 +32,11 @@ void SceneHost::RegisterNatives(tonic::DartLibraryNatives* natives) {

#if defined(OS_FUCHSIA)
ftl::RefPtr<SceneHost> SceneHost::create(
ftl::RefPtr<fidl::dart::Handle> export_token_handle) {
ftl::RefPtr<zircon::dart::Handle> export_token_handle) {
return ftl::MakeRefCounted<SceneHost>(export_token_handle);
}

SceneHost::SceneHost(ftl::RefPtr<fidl::dart::Handle> export_token_handle) {
SceneHost::SceneHost(ftl::RefPtr<zircon::dart::Handle> export_token_handle) {
export_node_holder_ =
ftl::MakeRefCounted<flow::ExportNodeHolder>(export_token_handle);
}
Expand Down
4 changes: 2 additions & 2 deletions lib/ui/compositing/scene_host.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class SceneHost : public ftl::RefCountedThreadSafe<SceneHost>,
public:
#if defined(OS_FUCHSIA)
static ftl::RefPtr<SceneHost> create(
ftl::RefPtr<fidl::dart::Handle> export_token_handle);
ftl::RefPtr<zircon::dart::Handle> export_token_handle);
#else
static ftl::RefPtr<SceneHost> create(Dart_Handle export_token_handle);
#endif
Expand All @@ -50,7 +50,7 @@ class SceneHost : public ftl::RefCountedThreadSafe<SceneHost>,
#endif

#if defined(OS_FUCHSIA)
explicit SceneHost(ftl::RefPtr<fidl::dart::Handle> export_token_handle);
explicit SceneHost(ftl::RefPtr<zircon::dart::Handle> export_token_handle);
#else
explicit SceneHost(Dart_Handle export_token_handle);
#endif
Expand Down
18 changes: 9 additions & 9 deletions runtime/dart_vm_entry_points_fuchsia.txt
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
dart:fuchsia,::,_environment
dart:fuchsia,::,_outgoingServices
dart:io,_Namespace,_setupNamespace
dart:fidl.internal,::,_environment
dart:fidl.internal,::,_outgoingServices
dart:fidl.internal,GetSizeResult,GetSizeResult.
dart:fidl.internal,Handle,Handle._
dart:fidl.internal,HandlePairResult,HandlePairResult.
dart:fidl.internal,HandleResult,HandleResult.
dart:fidl.internal,HandleWaiter,HandleWaiter._
dart:fidl.internal,ReadResult,ReadResult.
dart:fidl.internal,WriteResult,WriteResult.
dart:mozart.internal,::,_context
dart:mozart.internal,::,_viewContainer
dart:zircon,GetSizeResult,GetSizeResult.
dart:zircon,Handle,Handle._
dart:zircon,HandlePairResult,HandlePairResult.
dart:zircon,HandleResult,HandleResult.
dart:zircon,HandleWaiter,HandleWaiter._
dart:zircon,ReadResult,ReadResult.
dart:zircon,WriteResult,WriteResult.

0 comments on commit 0047b71

Please sign in to comment.