From ac552fba4a8082102c689cdc43de2638570ad547 Mon Sep 17 00:00:00 2001 From: Jeff Brown Date: Thu, 29 Mar 2018 21:49:35 -0700 Subject: [PATCH] Port flutter content handler to FIDL2. (#4903) --- content_handler/BUILD.gn | 5 +- content_handler/accessibility_bridge.cc | 3 +- content_handler/accessibility_bridge.h | 4 +- content_handler/app.cc | 10 +- content_handler/app.h | 10 +- .../application_controller_impl.cc | 42 ++--- content_handler/application_controller_impl.h | 34 ++-- content_handler/fuchsia_font_manager.cc | 22 +-- content_handler/fuchsia_font_manager.h | 2 +- content_handler/rasterizer.h | 2 +- content_handler/runtime_holder.cc | 152 +++++++++--------- content_handler/runtime_holder.h | 64 ++++---- content_handler/session_connection.cc | 21 +-- content_handler/session_connection.h | 8 +- content_handler/vulkan_rasterizer.cc | 2 +- content_handler/vulkan_rasterizer.h | 2 +- content_handler/vulkan_surface.cc | 18 +-- flow/BUILD.gn | 2 +- flow/export_node.cc | 4 +- flow/layers/layer.h | 2 +- flow/layers/layer_tree.cc | 4 +- flow/layers/layer_tree.h | 6 +- flow/raster_cache.cc | 4 +- flow/raster_cache.h | 4 +- flow/scene_update_context.h | 7 +- .../fonts/fuchsia/FontCacheFuchsia.cpp | 24 +-- .../platform/fonts/fuchsia/FontCacheFuchsia.h | 2 +- 27 files changed, 227 insertions(+), 233 deletions(-) diff --git a/content_handler/BUILD.gn b/content_handler/BUILD.gn index 2c0fb37963050..6bc00b4e2786c 100644 --- a/content_handler/BUILD.gn +++ b/content_handler/BUILD.gn @@ -64,11 +64,10 @@ template("flutter_content_handler") { "//garnet/public/lib/svc/cpp", "//garnet/public/lib/ui/input/fidl", "//garnet/public/lib/ui/scenic:client", - "//garnet/public/lib/ui/views/fidl", + "//garnet/public/lib/ui/views/fidl:v1", "//garnet/public/lib/vulkan", "//garnet/public/lib/zip", - "//peridot/public/lib/clipboard/fidl", - "//peridot/public/lib/context/fidl", + "//peridot/public/lib:fidl", "//third_party/rapidjson", "//third_party/skia", "//topaz/lib/tonic", diff --git a/content_handler/accessibility_bridge.cc b/content_handler/accessibility_bridge.cc index 7547d2678f369..cb6f9b8e21155 100644 --- a/content_handler/accessibility_bridge.cc +++ b/content_handler/accessibility_bridge.cc @@ -8,7 +8,6 @@ #include "flutter/lib/ui/semantics/semantics_node.h" #include "lib/app/cpp/application_context.h" -#include "lib/context/fidl/context_writer.fidl.h" #include "lib/fxl/macros.h" #include "third_party/rapidjson/rapidjson/document.h" #include "third_party/rapidjson/rapidjson/stringbuffer.h" @@ -17,7 +16,7 @@ namespace flutter_runner { AccessibilityBridge::AccessibilityBridge(component::ApplicationContext* context) - : writer_(context->ConnectToEnvironmentService()) {} + : writer_(context->ConnectToEnvironmentService()) {} void AccessibilityBridge::UpdateSemantics( const blink::SemanticsNodeUpdates& update) { diff --git a/content_handler/accessibility_bridge.h b/content_handler/accessibility_bridge.h index 07c8d248c2407..7ac54e754d9b6 100644 --- a/content_handler/accessibility_bridge.h +++ b/content_handler/accessibility_bridge.h @@ -9,7 +9,7 @@ #include "flutter/lib/ui/semantics/semantics_node.h" #include "lib/app/cpp/application_context.h" -#include "lib/context/fidl/context_writer.fidl.h" +#include namespace flutter_runner { @@ -34,7 +34,7 @@ class AccessibilityBridge { void EraseUnvisitedNodes(const std::vector& visited_nodes); std::map semantics_nodes_; - maxwell::ContextWriterPtr writer_; + modular::ContextWriterPtr writer_; }; } // namespace flutter_runner diff --git a/content_handler/app.cc b/content_handler/app.cc index dd72e32226ff3..1f1bde833d2f3 100644 --- a/content_handler/app.cc +++ b/content_handler/app.cc @@ -79,7 +79,7 @@ App::App() { } context_->outgoing_services()->AddService( - [this](f1dl::InterfaceRequest request) { + [this](fidl::InterfaceRequest request) { runner_bindings_.AddBinding(this, std::move(request)); }); } @@ -129,12 +129,12 @@ void App::WaitForPlatformViewsIdsUIThread( } void App::StartApplication( - component::ApplicationPackagePtr application, - component::ApplicationStartupInfoPtr startup_info, - f1dl::InterfaceRequest controller) { + component::ApplicationPackage application, + component::ApplicationStartupInfo startup_info, + fidl::InterfaceRequest controller) { if (controllers_.empty()) { // Name this process after the url of the first application being launched. - base_label_ = "flutter:" + GetLabelFromURL(startup_info->launch_info->url); + base_label_ = "flutter:" + GetLabelFromURL(startup_info.launch_info.url); } std::unique_ptr impl = diff --git a/content_handler/app.h b/content_handler/app.h index 9faeaa78dba66..dc8c49927d897 100644 --- a/content_handler/app.h +++ b/content_handler/app.h @@ -10,7 +10,7 @@ #include "flutter/content_handler/application_controller_impl.h" #include "lib/app/cpp/application_context.h" -#include "lib/app/fidl/application_runner.fidl.h" +#include #include "lib/fsl/threading/thread.h" #include "lib/fxl/macros.h" #include "lib/fxl/synchronization/waitable_event.h" @@ -27,9 +27,9 @@ class App : public component::ApplicationRunner { // |component::ApplicationRunner| implementation: void StartApplication( - component::ApplicationPackagePtr application, - component::ApplicationStartupInfoPtr startup_info, - f1dl::InterfaceRequest controller) override; + component::ApplicationPackage application, + component::ApplicationStartupInfo startup_info, + fidl::InterfaceRequest controller) override; void Destroy(ApplicationControllerImpl* controller); @@ -50,7 +50,7 @@ class App : public component::ApplicationRunner { std::unique_ptr context_; std::unique_ptr gpu_thread_; std::unique_ptr io_thread_; - f1dl::BindingSet runner_bindings_; + fidl::BindingSet runner_bindings_; std::unordered_map> controllers_; diff --git a/content_handler/application_controller_impl.cc b/content_handler/application_controller_impl.cc index c38e27d9e39ac..dfed01a48348f 100644 --- a/content_handler/application_controller_impl.cc +++ b/content_handler/application_controller_impl.cc @@ -19,9 +19,9 @@ namespace flutter_runner { ApplicationControllerImpl::ApplicationControllerImpl( App* app, - component::ApplicationPackagePtr application, - component::ApplicationStartupInfoPtr startup_info, - f1dl::InterfaceRequest controller) + component::ApplicationPackage application, + component::ApplicationStartupInfo startup_info, + fidl::InterfaceRequest controller) : app_(app), binding_(this) { if (controller.is_valid()) { binding_.Bind(std::move(controller)); @@ -32,8 +32,8 @@ ApplicationControllerImpl::ApplicationControllerImpl( } std::vector bundle; - if (application->data) { - if (!fsl::VectorFromVmo(std::move(application->data), &bundle)) { + if (application.data) { + if (!fsl::VectorFromVmo(std::move(*application.data), &bundle)) { FXL_LOG(ERROR) << "Failed to receive bundle."; return; } @@ -42,13 +42,13 @@ ApplicationControllerImpl::ApplicationControllerImpl( // TODO(jeffbrown): Decide what to do with command-line arguments and // startup handles. - if (startup_info->launch_info->directory_request.is_valid()) { + if (startup_info.launch_info.directory_request.is_valid()) { service_provider_bridge_.ServeDirectory( - std::move(startup_info->launch_info->directory_request)); + std::move(startup_info.launch_info.directory_request)); } - service_provider_bridge_.AddService( - [this](f1dl::InterfaceRequest request) { + service_provider_bridge_.AddService( + [this](fidl::InterfaceRequest request) { view_provider_bindings_.AddBinding(this, std::move(request)); }); @@ -56,13 +56,13 @@ ApplicationControllerImpl::ApplicationControllerImpl( auto request = service_provider.NewRequest(); service_provider_bridge_.set_backend(std::move(service_provider)); - fdio_ns_t* fdio_ns = SetupNamespace(startup_info->flat_namespace); + fdio_ns_t* fdio_ns = SetupNamespace(std::move(startup_info.flat_namespace)); if (fdio_ns == nullptr) { FXL_LOG(ERROR) << "Failed to initialize namespace"; return; } - url_ = startup_info->launch_info->url; + url_ = startup_info.launch_info.url; runtime_holder_.reset(new RuntimeHolder()); runtime_holder_->SetMainIsolateShutdownCallback([this]() { Kill(); }); runtime_holder_->Init( @@ -75,24 +75,24 @@ ApplicationControllerImpl::~ApplicationControllerImpl() = default; constexpr char kServiceRootPath[] = "/svc"; fdio_ns_t* ApplicationControllerImpl::SetupNamespace( - const component::FlatNamespacePtr& flat) { + component::FlatNamespace flat) { fdio_ns_t* fdio_namespc; zx_status_t status = fdio_ns_create(&fdio_namespc); if (status != ZX_OK) { FXL_LOG(ERROR) << "Failed to create namespace"; return nullptr; } - for (size_t i = 0; i < flat->paths->size(); ++i) { - if (flat->paths->at(i) == kServiceRootPath) { + for (size_t i = 0; i < flat.paths->size(); ++i) { + if (flat.paths->at(i) == kServiceRootPath) { // Ownership of /svc goes to the ApplicationContext created above. continue; } - zx::channel dir = std::move(flat->directories->at(i)); + zx::channel dir = std::move(flat.directories->at(i)); zx_handle_t dir_handle = dir.release(); - const char* path = flat->paths->at(i)->data(); + const char* path = flat.paths->at(i)->data(); status = fdio_ns_bind(fdio_namespc, path, dir_handle); if (status != ZX_OK) { - FXL_LOG(ERROR) << "Failed to bind " << flat->paths->at(i) + FXL_LOG(ERROR) << "Failed to bind " << flat.paths->at(i) << " to namespace"; zx_handle_close(dir_handle); fdio_ns_destroy(fdio_namespc); @@ -113,8 +113,8 @@ void ApplicationControllerImpl::Detach() { binding_.set_error_handler(fxl::Closure()); } -void ApplicationControllerImpl::Wait(const WaitCallback& callback) { - wait_callbacks_.push_back(callback); +void ApplicationControllerImpl::Wait(WaitCallback callback) { + wait_callbacks_.push_back(std::move(callback)); } void ApplicationControllerImpl::SendReturnCode(int32_t return_code) { @@ -125,8 +125,8 @@ void ApplicationControllerImpl::SendReturnCode(int32_t return_code) { } void ApplicationControllerImpl::CreateView( - f1dl::InterfaceRequest view_owner_request, - f1dl::InterfaceRequest services) { + fidl::InterfaceRequest view_owner_request, + fidl::InterfaceRequest services) { runtime_holder_->CreateView(url_, std::move(view_owner_request), std::move(services)); } diff --git a/content_handler/application_controller_impl.h b/content_handler/application_controller_impl.h index 812afb35024e9..2065ad51c8587 100644 --- a/content_handler/application_controller_impl.h +++ b/content_handler/application_controller_impl.h @@ -9,15 +9,15 @@ #include -#include "lib/app/fidl/application_controller.fidl.h" -#include "lib/app/fidl/application_runner.fidl.h" -#include "lib/app/fidl/service_provider.fidl.h" -#include "lib/fidl/cpp/bindings/binding.h" -#include "lib/fidl/cpp/bindings/binding_set.h" +#include +#include +#include + +#include "lib/fidl/cpp/binding.h" +#include "lib/fidl/cpp/binding_set.h" #include "lib/fxl/macros.h" #include "lib/fxl/synchronization/waitable_event.h" #include "lib/svc/cpp/service_provider_bridge.h" -#include "lib/ui/views/fidl/view_provider.fidl.h" #include "third_party/dart/runtime/include/dart_api.h" namespace flutter_runner { @@ -25,13 +25,13 @@ class App; class RuntimeHolder; class ApplicationControllerImpl : public component::ApplicationController, - public mozart::ViewProvider { + public views_v1::ViewProvider { public: ApplicationControllerImpl( App* app, - component::ApplicationPackagePtr application, - component::ApplicationStartupInfoPtr startup_info, - f1dl::InterfaceRequest controller); + component::ApplicationPackage application, + component::ApplicationStartupInfo startup_info, + fidl::InterfaceRequest controller); ~ApplicationControllerImpl() override; @@ -39,13 +39,13 @@ class ApplicationControllerImpl : public component::ApplicationController, void Kill() override; void Detach() override; - void Wait(const WaitCallback& callback) override; + void Wait(WaitCallback callback) override; - // |mozart::ViewProvider| implementation + // |views_v1::ViewProvider| implementation void CreateView( - f1dl::InterfaceRequest view_owner_request, - f1dl::InterfaceRequest services) override; + fidl::InterfaceRequest view_owner_request, + fidl::InterfaceRequest services) override; Dart_Port GetUIIsolateMainPort(); std::string GetUIIsolateName(); @@ -54,14 +54,14 @@ class ApplicationControllerImpl : public component::ApplicationController, void StartRuntimeIfReady(); void SendReturnCode(int32_t return_code); - fdio_ns_t* SetupNamespace(const component::FlatNamespacePtr& flat); + fdio_ns_t* SetupNamespace(component::FlatNamespace flat); App* app_; - f1dl::Binding binding_; + fidl::Binding binding_; component::ServiceProviderBridge service_provider_bridge_; - f1dl::BindingSet view_provider_bindings_; + fidl::BindingSet view_provider_bindings_; std::string url_; std::unique_ptr runtime_holder_; diff --git a/content_handler/fuchsia_font_manager.cc b/content_handler/fuchsia_font_manager.cc index 8138d1dfbf970..b68eb610edb24 100644 --- a/content_handler/fuchsia_font_manager.cc +++ b/content_handler/fuchsia_font_manager.cc @@ -32,14 +32,14 @@ void UnmapMemory(const void* buffer, void* context) { zx::vmar::root_self().unmap(reinterpret_cast(buffer), size); } -sk_sp MakeSkDataFromVMO(const fsl::SizedVmoTransportPtr& vmo) { - if (!fsl::SizedVmo::IsSizeValid(vmo->vmo, vmo->size) || - vmo->size > std::numeric_limits::max()) { +sk_sp MakeSkDataFromVMO(fsl::SizedVmoTransport vmo) { + if (!fsl::SizedVmo::IsSizeValid(vmo.vmo, vmo.size) || + vmo.size > std::numeric_limits::max()) { return nullptr; } - uint64_t size = vmo->size; + uint64_t size = vmo.size; uintptr_t buffer = 0; - zx_status_t status = zx::vmar::root_self().map(0, vmo->vmo, 0, size, + zx_status_t status = zx::vmar::root_self().map(0, vmo.vmo, 0, size, ZX_VM_FLAG_PERM_READ, &buffer); if (status != ZX_OK) return nullptr; @@ -88,11 +88,11 @@ SkFontStyleSet* FuchsiaFontManager::onMatchFamily( SkTypeface* FuchsiaFontManager::onMatchFamilyStyle( const char family_name[], const SkFontStyle& style) const { - auto request = fonts::FontRequest::New(); - request->family = family_name; - request->weight = style.weight(); - request->width = style.width(); - request->slant = ToFontSlant(style.slant()); + fonts::FontRequest request; + request.family = family_name; + request.weight = style.weight(); + request.width = style.width(); + request.slant = ToFontSlant(style.slant()); fonts::FontResponsePtr response; font_provider_->GetFont( @@ -107,7 +107,7 @@ SkTypeface* FuchsiaFontManager::onMatchFamilyStyle( if (!response) return nullptr; - sk_sp data = MakeSkDataFromVMO(response->data->vmo); + sk_sp data = MakeSkDataFromVMO(std::move(response->data.vmo)); if (!data) return nullptr; diff --git a/content_handler/fuchsia_font_manager.h b/content_handler/fuchsia_font_manager.h index 1d13a88747f4f..e57d6ef76e72f 100644 --- a/content_handler/fuchsia_font_manager.h +++ b/content_handler/fuchsia_font_manager.h @@ -18,7 +18,7 @@ #define TXT_FUCHSIA_FONT_MANAGER_H_ #include -#include "lib/fonts/fidl/font_provider.fidl.h" +#include #include "lib/fxl/macros.h" #include "third_party/skia/include/core/SkStream.h" #include "third_party/skia/include/core/SkTypeface.h" diff --git a/content_handler/rasterizer.h b/content_handler/rasterizer.h index 94602120249d0..398f262a568cd 100644 --- a/content_handler/rasterizer.h +++ b/content_handler/rasterizer.h @@ -22,7 +22,7 @@ class Rasterizer { static std::unique_ptr Create(); virtual void SetScene( - f1dl::InterfaceHandle mozart, + fidl::InterfaceHandle mozart, zx::eventpair import_token, fxl::Closure metrics_changed_callback) = 0; diff --git a/content_handler/runtime_holder.cc b/content_handler/runtime_holder.cc index a69420896ffc7..421731b9691d0 100644 --- a/content_handler/runtime_holder.cc +++ b/content_handler/runtime_holder.cc @@ -60,21 +60,21 @@ void SetThreadName(fxl::RefPtr runner, std::string name) { } blink::PointerData::Change GetChangeFromPointerEventPhase( - mozart::PointerEvent::Phase phase) { + input::PointerEventPhase phase) { switch (phase) { - case mozart::PointerEvent::Phase::ADD: + case input::PointerEventPhase::ADD: return blink::PointerData::Change::kAdd; - case mozart::PointerEvent::Phase::HOVER: + case input::PointerEventPhase::HOVER: return blink::PointerData::Change::kHover; - case mozart::PointerEvent::Phase::DOWN: + case input::PointerEventPhase::DOWN: return blink::PointerData::Change::kDown; - case mozart::PointerEvent::Phase::MOVE: + case input::PointerEventPhase::MOVE: return blink::PointerData::Change::kMove; - case mozart::PointerEvent::Phase::UP: + case input::PointerEventPhase::UP: return blink::PointerData::Change::kUp; - case mozart::PointerEvent::Phase::REMOVE: + case input::PointerEventPhase::REMOVE: return blink::PointerData::Change::kRemove; - case mozart::PointerEvent::Phase::CANCEL: + case input::PointerEventPhase::CANCEL: return blink::PointerData::Change::kCancel; default: return blink::PointerData::Change::kCancel; @@ -82,11 +82,11 @@ blink::PointerData::Change GetChangeFromPointerEventPhase( } blink::PointerData::DeviceKind GetKindFromPointerType( - mozart::PointerEvent::Type type) { + input::PointerEventType type) { switch (type) { - case mozart::PointerEvent::Type::TOUCH: + case input::PointerEventType::TOUCH: return blink::PointerData::DeviceKind::kTouch; - case mozart::PointerEvent::Type::MOUSE: + case input::PointerEventType::MOUSE: return blink::PointerData::DeviceKind::kMouse; default: return blink::PointerData::DeviceKind::kTouch; @@ -111,7 +111,7 @@ RuntimeHolder::~RuntimeHolder() { void RuntimeHolder::Init( fdio_ns_t* namespc, std::unique_ptr context, - f1dl::InterfaceRequest outgoing_services, + fidl::InterfaceRequest outgoing_services, std::vector bundle) { FXL_DCHECK(!rasterizer_); rasterizer_ = Rasterizer::Create(); @@ -193,8 +193,8 @@ void RuntimeHolder::Init( void RuntimeHolder::CreateView( const std::string& script_uri, - f1dl::InterfaceRequest view_owner_request, - f1dl::InterfaceRequest services) { + fidl::InterfaceRequest view_owner_request, + fidl::InterfaceRequest services) { if (view_listener_binding_.is_bound()) { // TODO(jeffbrown): Refactor this to support multiple view instances // sharing the same underlying root bundle (but with different runtimes). @@ -220,7 +220,7 @@ void RuntimeHolder::CreateView( FXL_LOG(ERROR) << "Could not create an event pair."; return; } - mozart::ViewListenerPtr view_listener; + views_v1::ViewListenerPtr view_listener; view_listener_binding_.Bind(view_listener.NewRequest()); view_manager_->CreateView(view_.NewRequest(), // view std::move(view_owner_request), // view owner @@ -233,12 +233,12 @@ void RuntimeHolder::CreateView( // Listen for input events. ConnectToService(view_services.get(), input_connection_.NewRequest()); - mozart::InputListenerPtr input_listener; + input::InputListenerPtr input_listener; input_listener_binding_.Bind(input_listener.NewRequest()); input_connection_->SetEventListener(std::move(input_listener)); // Setup the session. - f1dl::InterfaceHandle scenic; + fidl::InterfaceHandle scenic; view_manager_->GetScenic(scenic.NewRequest()); blink::Threads::Gpu()->PostTask(fxl::MakeCopyable([ @@ -444,7 +444,7 @@ void RuntimeHolder::InitDartIoInternal() { } void RuntimeHolder::InitFuchsia() { - f1dl::InterfaceHandle environment; + fidl::InterfaceHandle environment; context_->ConnectToEnvironmentService(environment.NewRequest()); fuchsia::dart::Initialize(std::move(environment), std::move(outgoing_services_)); @@ -467,7 +467,7 @@ void RuntimeHolder::InitZircon() { } void RuntimeHolder::InitScenicInternal() { - f1dl::InterfaceHandle view_container; + fidl::InterfaceHandle view_container; view_->GetContainer(view_container.NewRequest()); Dart_Handle mozart_internal = @@ -509,7 +509,7 @@ void RuntimeHolder::InitRootBundle(std::vector bundle) { } } -mozart::View* RuntimeHolder::GetMozartView() { +views_v1::View* RuntimeHolder::GetMozartView() { return view_.get(); } @@ -558,13 +558,13 @@ bool RuntimeHolder::HandleFlutterPlatformMessage( clipboard_->Push(text); response->CompleteEmpty(); } else if (method->value == "Clipboard.getData") { - clipboard_->Peek([response](const ::f1dl::String& text) { + clipboard_->Peek([response](fidl::StringPtr text) { rapidjson::StringBuffer json_buffer; rapidjson::Writer writer(json_buffer); writer.StartArray(); writer.StartObject(); writer.Key("text"); - writer.String(text); + writer.String(text.get()); writer.EndObject(); writer.EndArray(); @@ -613,12 +613,10 @@ bool RuntimeHolder::HandleTextInputPlatformMessage( return false; // TODO(abarth): Read the keyboard type form the configuration. current_text_input_client_ = args->value[0].GetInt(); - mozart::TextInputStatePtr state = mozart::TextInputState::New(); - state->text = std::string(); - state->selection = mozart::TextSelection::New(); - state->composing = mozart::TextRange::New(); + input::TextInputState state; + state.text = std::string(); input_connection_->GetInputMethodEditor( - mozart::KeyboardType::TEXT, mozart::InputMethodAction::DONE, + input::KeyboardType::TEXT, input::InputMethodAction::DONE, std::move(state), text_input_binding_.NewBinding(), input_method_editor_.NewRequest()); } else if (method->value == "TextInput.setEditingState") { @@ -627,36 +625,34 @@ bool RuntimeHolder::HandleTextInputPlatformMessage( if (args_it == root.MemberEnd() || !args_it->value.IsObject()) return false; const auto& args = args_it->value; - mozart::TextInputStatePtr state = mozart::TextInputState::New(); - state->selection = mozart::TextSelection::New(); - state->composing = mozart::TextRange::New(); + input::TextInputState state; // TODO(abarth): Deserialize state. auto text = args.FindMember("text"); if (text != args.MemberEnd() && text->value.IsString()) - state->text = text->value.GetString(); + state.text = text->value.GetString(); auto selection_base = args.FindMember("selectionBase"); if (selection_base != args.MemberEnd() && selection_base->value.IsInt()) - state->selection->base = selection_base->value.GetInt(); + state.selection.base = selection_base->value.GetInt(); auto selection_extent = args.FindMember("selectionExtent"); if (selection_extent != args.MemberEnd() && selection_extent->value.IsInt()) - state->selection->extent = selection_extent->value.GetInt(); + state.selection.extent = selection_extent->value.GetInt(); auto selection_affinity = args.FindMember("selectionAffinity"); if (selection_affinity != args.MemberEnd() && selection_affinity->value.IsString() && selection_affinity->value == "TextAffinity.upstream") - state->selection->affinity = mozart::TextAffinity::UPSTREAM; + state.selection.affinity = input::TextAffinity::UPSTREAM; else - state->selection->affinity = mozart::TextAffinity::DOWNSTREAM; + state.selection.affinity = input::TextAffinity::DOWNSTREAM; // We ignore selectionIsDirectional because that concept doesn't exist on // Fuchsia. auto composing_base = args.FindMember("composingBase"); if (composing_base != args.MemberEnd() && composing_base->value.IsInt()) - state->composing->start = composing_base->value.GetInt(); + state.composing.start = composing_base->value.GetInt(); auto composing_extent = args.FindMember("composingExtent"); if (composing_extent != args.MemberEnd() && composing_extent->value.IsInt()) - state->composing->end = composing_extent->value.GetInt(); + state.composing.end = composing_extent->value.GetInt(); input_method_editor_->SetState(std::move(state)); } } else if (method->value == "TextInput.clearClient") { @@ -680,20 +676,20 @@ blink::UnzipperProvider RuntimeHolder::GetUnzipperProviderForRootBundle() { }; } -void RuntimeHolder::OnEvent(mozart::InputEventPtr event, - const OnEventCallback& callback) { +void RuntimeHolder::OnEvent(input::InputEvent event, + OnEventCallback callback) { bool handled = false; - if (event->is_pointer()) { - const mozart::PointerEventPtr& pointer = event->get_pointer(); + if (event.is_pointer()) { + const input::PointerEvent& pointer = event.pointer(); blink::PointerData pointer_data; - pointer_data.time_stamp = pointer->event_time / 1000; - pointer_data.change = GetChangeFromPointerEventPhase(pointer->phase); - pointer_data.kind = GetKindFromPointerType(pointer->type); - pointer_data.device = pointer->pointer_id; - pointer_data.physical_x = pointer->x * viewport_metrics_.device_pixel_ratio; - pointer_data.physical_y = pointer->y * viewport_metrics_.device_pixel_ratio; + pointer_data.time_stamp = pointer.event_time / 1000; + pointer_data.change = GetChangeFromPointerEventPhase(pointer.phase); + pointer_data.kind = GetKindFromPointerType(pointer.type); + pointer_data.device = pointer.pointer_id; + pointer_data.physical_x = pointer.x * viewport_metrics_.device_pixel_ratio; + pointer_data.physical_y = pointer.y * viewport_metrics_.device_pixel_ratio; // Buttons are single bit values starting with kMousePrimaryButton = 1. - pointer_data.buttons = static_cast(pointer->buttons); + pointer_data.buttons = static_cast(pointer.buttons); switch (pointer_data.change) { case blink::PointerData::Change::kDown: @@ -729,14 +725,14 @@ void RuntimeHolder::OnEvent(mozart::InputEventPtr event, runtime_->DispatchPointerDataPacket(packet); handled = true; - } else if (event->is_keyboard()) { - const mozart::KeyboardEventPtr& keyboard = event->get_keyboard(); + } else if (event.is_keyboard()) { + const input::KeyboardEvent& keyboard = event.keyboard(); const char* type = nullptr; - if (keyboard->phase == mozart::KeyboardEvent::Phase::PRESSED) + if (keyboard.phase == input::KeyboardEventPhase::PRESSED) type = "keydown"; - else if (keyboard->phase == mozart::KeyboardEvent::Phase::REPEAT) + else if (keyboard.phase == input::KeyboardEventPhase::REPEAT) type = "keydown"; // TODO change this to keyrepeat - else if (keyboard->phase == mozart::KeyboardEvent::Phase::RELEASED) + else if (keyboard.phase == input::KeyboardEventPhase::RELEASED) type = "keyup"; if (type) { @@ -746,9 +742,9 @@ void RuntimeHolder::OnEvent(mozart::InputEventPtr event, document.AddMember("type", rapidjson::Value(type, strlen(type)), allocator); document.AddMember("keymap", rapidjson::Value("fuchsia"), allocator); - document.AddMember("hidUsage", keyboard->hid_usage, allocator); - document.AddMember("codePoint", keyboard->code_point, allocator); - document.AddMember("modifiers", keyboard->modifiers, allocator); + document.AddMember("hidUsage", keyboard.hid_usage, allocator); + document.AddMember("codePoint", keyboard.code_point, allocator); + document.AddMember("modifiers", keyboard.modifiers, allocator); rapidjson::StringBuffer buffer; rapidjson::Writer writer(buffer); document.Accept(writer); @@ -766,26 +762,24 @@ void RuntimeHolder::OnEvent(mozart::InputEventPtr event, } void RuntimeHolder::OnPropertiesChanged( - mozart::ViewPropertiesPtr properties, - const OnPropertiesChangedCallback& callback) { - FXL_DCHECK(properties); - + views_v1::ViewProperties properties, + OnPropertiesChangedCallback callback) { // Attempt to read the device pixel ratio. float pixel_ratio = 1.f; - if (auto& metrics = properties->display_metrics) { + if (auto& metrics = properties.display_metrics) { pixel_ratio = metrics->device_pixel_ratio; } // Apply view property changes. - if (auto& layout = properties->view_layout) { - viewport_metrics_.physical_width = layout->size->width * pixel_ratio; - viewport_metrics_.physical_height = layout->size->height * pixel_ratio; - viewport_metrics_.physical_padding_top = layout->inset->top * pixel_ratio; + if (auto& layout = properties.view_layout) { + viewport_metrics_.physical_width = layout->size.width * pixel_ratio; + viewport_metrics_.physical_height = layout->size.height * pixel_ratio; + viewport_metrics_.physical_padding_top = layout->inset.top * pixel_ratio; viewport_metrics_.physical_padding_right = - layout->inset->right * pixel_ratio; + layout->inset.right * pixel_ratio; viewport_metrics_.physical_padding_bottom = - layout->inset->bottom * pixel_ratio; - viewport_metrics_.physical_padding_left = layout->inset->left * pixel_ratio; + layout->inset.bottom * pixel_ratio; + viewport_metrics_.physical_padding_left = layout->inset.left * pixel_ratio; viewport_metrics_.device_pixel_ratio = pixel_ratio; runtime_->SetViewportMetrics(viewport_metrics_); } @@ -795,31 +789,31 @@ void RuntimeHolder::OnPropertiesChanged( callback(); } -void RuntimeHolder::DidUpdateState(mozart::TextInputStatePtr state, - mozart::InputEventPtr event) { +void RuntimeHolder::DidUpdateState(input::TextInputState state, + input::InputEventPtr event) { rapidjson::Document document; auto& allocator = document.GetAllocator(); rapidjson::Value encoded_state(rapidjson::kObjectType); - encoded_state.AddMember("text", state->text.get(), allocator); - encoded_state.AddMember("selectionBase", state->selection->base, allocator); - encoded_state.AddMember("selectionExtent", state->selection->extent, + encoded_state.AddMember("text", state.text.get(), allocator); + encoded_state.AddMember("selectionBase", state.selection.base, allocator); + encoded_state.AddMember("selectionExtent", state.selection.extent, allocator); - switch (state->selection->affinity) { - case mozart::TextAffinity::UPSTREAM: + switch (state.selection.affinity) { + case input::TextAffinity::UPSTREAM: encoded_state.AddMember("selectionAffinity", rapidjson::Value("TextAffinity.upstream"), allocator); break; - case mozart::TextAffinity::DOWNSTREAM: + case input::TextAffinity::DOWNSTREAM: encoded_state.AddMember("selectionAffinity", rapidjson::Value("TextAffinity.downstream"), allocator); break; } encoded_state.AddMember("selectionIsDirectional", true, allocator); - encoded_state.AddMember("composingBase", state->composing->start, allocator); - encoded_state.AddMember("composingExtent", state->composing->end, allocator); + encoded_state.AddMember("composingBase", state.composing.start, allocator); + encoded_state.AddMember("composingExtent", state.composing.end, allocator); rapidjson::Value args(rapidjson::kArrayType); args.PushBack(current_text_input_client_, allocator); @@ -841,7 +835,7 @@ void RuntimeHolder::DidUpdateState(mozart::TextInputStatePtr state, nullptr)); } -void RuntimeHolder::OnAction(mozart::InputMethodAction action) { +void RuntimeHolder::OnAction(input::InputMethodAction action) { rapidjson::Document document; auto& allocator = document.GetAllocator(); diff --git a/content_handler/runtime_holder.h b/content_handler/runtime_holder.h index b22839a6ec17c..b9d55d9f9bacc 100644 --- a/content_handler/runtime_holder.h +++ b/content_handler/runtime_holder.h @@ -21,17 +21,17 @@ #include "flutter/runtime/runtime_controller.h" #include "flutter/runtime/runtime_delegate.h" #include "lib/app/cpp/application_context.h" -#include "lib/app/fidl/application_environment.fidl.h" -#include "lib/app/fidl/service_provider.fidl.h" -#include "lib/clipboard/fidl/clipboard.fidl.h" -#include "lib/fidl/cpp/bindings/binding.h" +#include +#include +#include +#include "lib/fidl/cpp/binding.h" #include "lib/fxl/functional/closure.h" #include "lib/fxl/macros.h" #include "lib/fxl/memory/weak_ptr.h" #include "lib/ui/flutter/sdk_ext/src/natives.h" -#include "lib/ui/input/fidl/input_connection.fidl.h" -#include "lib/ui/input/fidl/text_input.fidl.h" -#include "lib/ui/views/fidl/view_manager.fidl.h" +#include +#include +#include namespace flutter_runner { @@ -39,20 +39,20 @@ class Rasterizer; class RuntimeHolder : public blink::RuntimeDelegate, public mozart::NativesDelegate, - public mozart::ViewListener, - public mozart::InputListener, - public mozart::InputMethodEditorClient { + public views_v1::ViewListener, + public input::InputListener, + public input::InputMethodEditorClient { public: RuntimeHolder(); ~RuntimeHolder(); void Init(fdio_ns_t* namespc, std::unique_ptr context, - f1dl::InterfaceRequest outgoing_services, + fidl::InterfaceRequest outgoing_services, std::vector bundle); void CreateView(const std::string& script_uri, - f1dl::InterfaceRequest view_owner_request, - f1dl::InterfaceRequest services); + fidl::InterfaceRequest view_owner_request, + fidl::InterfaceRequest services); Dart_Port GetUIIsolateMainPort(); std::string GetUIIsolateName(); @@ -73,21 +73,21 @@ class RuntimeHolder : public blink::RuntimeDelegate, void DidShutdownMainIsolate() override; // |mozart::NativesDelegate| implementation: - mozart::View* GetMozartView() override; + views_v1::View* GetMozartView() override; - // |mozart::InputListener| implementation: - void OnEvent(mozart::InputEventPtr event, - const OnEventCallback& callback) override; + // |input::InputListener| implementation: + void OnEvent(input::InputEvent event, + OnEventCallback callback) override; - // |mozart::ViewListener| implementation: + // |views_v1::ViewListener| implementation: void OnPropertiesChanged( - mozart::ViewPropertiesPtr properties, - const OnPropertiesChangedCallback& callback) override; + views_v1::ViewProperties properties, + OnPropertiesChangedCallback callback) override; - // |mozart::InputMethodEditorClient| implementation: - void DidUpdateState(mozart::TextInputStatePtr state, - mozart::InputEventPtr event) override; - void OnAction(mozart::InputMethodAction action) override; + // |input::InputMethodEditorClient| implementation: + void DidUpdateState(input::TextInputState state, + input::InputEventPtr event) override; + void OnAction(input::InputMethodAction action) override; fxl::WeakPtr GetWeakPtr(); @@ -112,7 +112,7 @@ class RuntimeHolder : public blink::RuntimeDelegate, fdio_ns_t* namespc_; int dirfd_; std::unique_ptr context_; - f1dl::InterfaceRequest outgoing_services_; + fidl::InterfaceRequest outgoing_services_; std::vector root_bundle_data_; // TODO(zarah): Remove asset_store_ when flx is completely removed fxl::RefPtr asset_store_; @@ -121,14 +121,14 @@ class RuntimeHolder : public blink::RuntimeDelegate, std::unique_ptr rasterizer_; std::unique_ptr runtime_; blink::ViewportMetrics viewport_metrics_; - mozart::ViewManagerPtr view_manager_; - f1dl::Binding view_listener_binding_; - f1dl::Binding input_listener_binding_; - mozart::InputConnectionPtr input_connection_; - mozart::ViewPtr view_; + views_v1::ViewManagerPtr view_manager_; + fidl::Binding view_listener_binding_; + fidl::Binding input_listener_binding_; + input::InputConnectionPtr input_connection_; + views_v1::ViewPtr view_; std::unordered_set down_pointers_; - mozart::InputMethodEditorPtr input_method_editor_; - f1dl::Binding text_input_binding_; + input::InputMethodEditorPtr input_method_editor_; + fidl::Binding text_input_binding_; int current_text_input_client_ = 0; fxl::TimePoint last_begin_frame_time_; bool frame_outstanding_ = false; diff --git a/content_handler/session_connection.cc b/content_handler/session_connection.cc index e003e92bd0842..b496ae37f40f2 100644 --- a/content_handler/session_connection.cc +++ b/content_handler/session_connection.cc @@ -3,6 +3,7 @@ // found in the LICENSE file. #include "flutter/content_handler/session_connection.h" +#include "lib/fidl/cpp/optional.h" #include "lib/ui/scenic/fidl_helpers.h" namespace flutter_runner { @@ -21,8 +22,8 @@ SessionConnection::SessionConnection(ui::ScenicPtr scenic, this, std::placeholders::_1)); root_node_.Bind(std::move(import_token)); - root_node_.SetEventMask(ui::gfx::kMetricsEventMask); - session_.Present(0, [](ui::PresentationInfoPtr info) {}); + root_node_.SetEventMask(gfx::kMetricsEventMask); + session_.Present(0, [](images::PresentationInfo info) {}); present_callback_ = std::bind(&SessionConnection::OnPresent, this, std::placeholders::_1); @@ -38,18 +39,18 @@ void SessionConnection::OnSessionError() { FXL_CHECK(false) << "Session connection was terminated."; } -void SessionConnection::OnSessionEvents(f1dl::Array events) { - ui::gfx::MetricsPtr new_metrics; - for (const auto& event : *events) { - if (event->is_gfx() && event->get_gfx()->is_metrics() && - event->get_gfx()->get_metrics()->node_id == root_node_.id()) { - new_metrics = std::move(event->get_gfx()->get_metrics()->metrics); +void SessionConnection::OnSessionEvents(fidl::VectorPtr events) { + gfx::Metrics* new_metrics; + for (auto& event : *events) { + if (event.is_gfx() && event.gfx().is_metrics() && + event.gfx().metrics().node_id == root_node_.id()) { + new_metrics = &event.gfx().metrics().metrics; } } if (!new_metrics) return; - scene_update_context_.set_metrics(std::move(new_metrics)); + scene_update_context_.set_metrics(fidl::MakeOptional(std::move(*new_metrics))); if (metrics_changed_callback_) metrics_changed_callback_(); @@ -80,7 +81,7 @@ void SessionConnection::Present(flow::CompositorContext::ScopedFrame& frame, EnqueueClearCommands(); } -void SessionConnection::OnPresent(ui::PresentationInfoPtr info) { +void SessionConnection::OnPresent(images::PresentationInfo info) { ASSERT_IS_GPU_THREAD; auto callback = pending_on_present_callback_; pending_on_present_callback_ = nullptr; diff --git a/content_handler/session_connection.h b/content_handler/session_connection.h index 7af1f8cb6a034..a80ba3a2235d2 100644 --- a/content_handler/session_connection.h +++ b/content_handler/session_connection.h @@ -11,7 +11,7 @@ #include "flutter/content_handler/vulkan_surface_producer.h" #include "flutter/flow/compositor_context.h" #include "flutter/flow/scene_update_context.h" -#include "lib/fidl/cpp/bindings/interface_handle.h" +#include "lib/fidl/cpp/interface_handle.h" #include "lib/fxl/functional/closure.h" #include "lib/fxl/macros.h" #include "lib/ui/scenic/client/resources.h" @@ -27,7 +27,7 @@ class SessionConnection { bool has_metrics() const { return scene_update_context_.has_metrics(); } - const ui::gfx::MetricsPtr& metrics() const { + const gfx::MetricsPtr& metrics() const { return scene_update_context_.metrics(); } @@ -57,11 +57,11 @@ class SessionConnection { fxl::Closure metrics_changed_callback_; void OnSessionError(); - void OnSessionEvents(f1dl::Array events); + void OnSessionEvents(fidl::VectorPtr events); void EnqueueClearCommands(); - void OnPresent(ui::PresentationInfoPtr info); + void OnPresent(images::PresentationInfo info); FXL_DISALLOW_COPY_AND_ASSIGN(SessionConnection); }; diff --git a/content_handler/vulkan_rasterizer.cc b/content_handler/vulkan_rasterizer.cc index 4394b8712d09d..25f90c460ce3f 100644 --- a/content_handler/vulkan_rasterizer.cc +++ b/content_handler/vulkan_rasterizer.cc @@ -53,7 +53,7 @@ bool VulkanRasterizer::IsValid() const { return valid_; } -void VulkanRasterizer::SetScene(f1dl::InterfaceHandle scenic, +void VulkanRasterizer::SetScene(fidl::InterfaceHandle scenic, zx::eventpair import_token, fxl::Closure metrics_changed_callback) { ASSERT_IS_GPU_THREAD; diff --git a/content_handler/vulkan_rasterizer.h b/content_handler/vulkan_rasterizer.h index 806bb66b7b3eb..c3ae211553f5a 100644 --- a/content_handler/vulkan_rasterizer.h +++ b/content_handler/vulkan_rasterizer.h @@ -22,7 +22,7 @@ class VulkanRasterizer : public Rasterizer { bool IsValid() const; - void SetScene(f1dl::InterfaceHandle scenic, + void SetScene(fidl::InterfaceHandle scenic, zx::eventpair import_token, fxl::Closure metrics_changed_callback) override; diff --git a/content_handler/vulkan_surface.cc b/content_handler/vulkan_surface.cc index 9f7d7913a7200..0e5fa00d8422a 100644 --- a/content_handler/vulkan_surface.cc +++ b/content_handler/vulkan_surface.cc @@ -308,15 +308,15 @@ bool VulkanSurface::PushSessionImageSetupOps(scenic_lib::Session* session, } scenic_lib::Memory memory(session, std::move(exported_vmo), - ui::gfx::MemoryType::VK_DEVICE_MEMORY); - - auto image_info = ui::gfx::ImageInfo::New(); - image_info->width = sk_surface_->width(); - image_info->height = sk_surface_->height(); - image_info->stride = 4 * sk_surface_->width(); - image_info->pixel_format = ui::gfx::ImageInfo::PixelFormat::BGRA_8; - image_info->color_space = ui::gfx::ImageInfo::ColorSpace::SRGB; - image_info->tiling = ui::gfx::ImageInfo::Tiling::LINEAR; + images::MemoryType::VK_DEVICE_MEMORY); + + images::ImageInfo image_info; + image_info.width = sk_surface_->width(); + image_info.height = sk_surface_->height(); + image_info.stride = 4 * sk_surface_->width(); + image_info.pixel_format = images::PixelFormat::BGRA_8; + image_info.color_space = images::ColorSpace::SRGB; + image_info.tiling = images::Tiling::LINEAR; session_image_ = std::make_unique( memory, 0 /* memory offset */, std::move(image_info)); diff --git a/flow/BUILD.gn b/flow/BUILD.gn index 47c7316edfcd6..e6a6411a6c1da 100644 --- a/flow/BUILD.gn +++ b/flow/BUILD.gn @@ -83,7 +83,7 @@ source_set("flow") { "scene_update_context.h", ] - deps += [ + public_deps += [ "//garnet/public/lib/ui/scenic:client", "//garnet/public/lib/ui/scenic/fidl", "//topaz/public/dart-pkg/zircon", diff --git a/flow/export_node.cc b/flow/export_node.cc index b6ce18ba7c68d..a130c426a75bf 100644 --- a/flow/export_node.cc +++ b/flow/export_node.cc @@ -61,8 +61,8 @@ void ExportNode::Bind(SceneUpdateContext& context, container.AddChild(*node_); node_->SetTranslation(offset.x(), offset.y(), 0.f); node_->SetHitTestBehavior(hit_testable - ? ui::gfx::HitTestBehavior::kDefault - : ui::gfx::HitTestBehavior::kSuppress); + ? gfx::HitTestBehavior::kDefault + : gfx::HitTestBehavior::kSuppress); } } diff --git a/flow/layers/layer.h b/flow/layers/layer.h index 09b82dddb0265..d0ef1990ab4f2 100644 --- a/flow/layers/layer.h +++ b/flow/layers/layer.h @@ -45,7 +45,7 @@ class Layer { struct PrerollContext { #if defined(OS_FUCHSIA) - ui::gfx::Metrics* metrics = nullptr; + gfx::Metrics* metrics = nullptr; #endif RasterCache* raster_cache; GrContext* gr_context; diff --git a/flow/layers/layer_tree.cc b/flow/layers/layer_tree.cc index 9a52cb57d7f48..fde2fc4bf0866 100644 --- a/flow/layers/layer_tree.cc +++ b/flow/layers/layer_tree.cc @@ -19,7 +19,7 @@ LayerTree::~LayerTree() = default; void LayerTree::Raster(CompositorContext::ScopedFrame& frame, #if defined(OS_FUCHSIA) - ui::gfx::Metrics* metrics, + gfx::Metrics* metrics, #endif bool ignore_raster_cache) { #if defined(OS_FUCHSIA) @@ -35,7 +35,7 @@ void LayerTree::Raster(CompositorContext::ScopedFrame& frame, void LayerTree::Preroll(CompositorContext::ScopedFrame& frame, #if defined(OS_FUCHSIA) - ui::gfx::Metrics* metrics, + gfx::Metrics* metrics, #endif bool ignore_raster_cache) { #if defined(OS_FUCHSIA) diff --git a/flow/layers/layer_tree.h b/flow/layers/layer_tree.h index a040180ad30a7..5ddebd088de9e 100644 --- a/flow/layers/layer_tree.h +++ b/flow/layers/layer_tree.h @@ -14,7 +14,7 @@ #include "lib/fxl/macros.h" #include "lib/fxl/time/time_delta.h" #if defined(OS_FUCHSIA) -#include "lib/ui/scenic/fidl/events.fidl.h" +#include #endif #include "third_party/skia/include/core/SkSize.h" @@ -29,13 +29,13 @@ class LayerTree { // Raster includes both Preroll and Paint. void Raster(CompositorContext::ScopedFrame& frame, #if defined(OS_FUCHSIA) - ui::gfx::Metrics* metrics, + gfx::Metrics* metrics, #endif bool ignore_raster_cache = false); void Preroll(CompositorContext::ScopedFrame& frame, #if defined(OS_FUCHSIA) - ui::gfx::Metrics* metrics, + gfx::Metrics* metrics, #endif bool ignore_raster_cache = false); diff --git a/flow/raster_cache.cc b/flow/raster_cache.cc index 472dbd6bd9d94..aa9fad0e281de 100644 --- a/flow/raster_cache.cc +++ b/flow/raster_cache.cc @@ -74,7 +74,7 @@ RasterCacheResult RasterizePicture(SkPicture* picture, const MatrixDecomposition& matrix, SkColorSpace* dst_color_space, #if defined(OS_FUCHSIA) - ui::gfx::Metrics* metrics, + gfx::Metrics* metrics, #endif bool checkerboard) { TRACE_EVENT0("flutter", "RasterCachePopulate"); @@ -154,7 +154,7 @@ RasterCacheResult RasterCache::GetPrerolledImage( const SkMatrix& transformation_matrix, SkColorSpace* dst_color_space, #if defined(OS_FUCHSIA) - ui::gfx::Metrics* metrics, + gfx::Metrics* metrics, #endif bool is_complex, bool will_change) { diff --git a/flow/raster_cache.h b/flow/raster_cache.h index 3600866190204..31201049b6119 100644 --- a/flow/raster_cache.h +++ b/flow/raster_cache.h @@ -13,7 +13,7 @@ #include "lib/fxl/macros.h" #include "lib/fxl/memory/weak_ptr.h" #if defined(OS_FUCHSIA) -#include "lib/ui/scenic/fidl/events.fidl.h" +#include #endif #include "third_party/skia/include/core/SkImage.h" #include "third_party/skia/include/core/SkSize.h" @@ -58,7 +58,7 @@ class RasterCache { const SkMatrix& transformation_matrix, SkColorSpace* dst_color_space, #if defined(OS_FUCHSIA) - ui::gfx::Metrics* metrics, + gfx::Metrics* metrics, #endif bool is_complex, bool will_change); diff --git a/flow/scene_update_context.h b/flow/scene_update_context.h index 32affd4ca0f77..ea1de247542ba 100644 --- a/flow/scene_update_context.h +++ b/flow/scene_update_context.h @@ -6,6 +6,7 @@ #define FLUTTER_FLOW_SCENE_UPDATE_CONTEXT_H_ #include +#include #include #include "flutter/flow/compositor_context.h" @@ -118,10 +119,10 @@ class SceneUpdateContext { scenic_lib::Session* session() { return session_; } bool has_metrics() const { return !!metrics_; } - void set_metrics(ui::gfx::MetricsPtr metrics) { + void set_metrics(gfx::MetricsPtr metrics) { metrics_ = std::move(metrics); } - const ui::gfx::MetricsPtr& metrics() const { return metrics_; } + const gfx::MetricsPtr& metrics() const { return metrics_; } void AddChildScene(ExportNode* export_node, SkPoint offset, @@ -181,7 +182,7 @@ class SceneUpdateContext { scenic_lib::Session* const session_; SurfaceProducer* const surface_producer_; - ui::gfx::MetricsPtr metrics_; + gfx::MetricsPtr metrics_; std::vector paint_tasks_; diff --git a/sky/engine/platform/fonts/fuchsia/FontCacheFuchsia.cpp b/sky/engine/platform/fonts/fuchsia/FontCacheFuchsia.cpp index 9a8a08d336a31..446a2939dc64b 100644 --- a/sky/engine/platform/fonts/fuchsia/FontCacheFuchsia.cpp +++ b/sky/engine/platform/fonts/fuchsia/FontCacheFuchsia.cpp @@ -13,7 +13,7 @@ #include "flutter/sky/engine/platform/fonts/AlternateFontFamily.h" #include "flutter/sky/engine/platform/fonts/FontCache.h" #include "flutter/sky/engine/platform/fonts/FontDescription.h" -#include "lib/fonts/fidl/font_provider.fidl.h" +#include #include "lib/fsl/vmo/sized_vmo.h" #include "lib/fxl/logging.h" #include "third_party/skia/include/core/SkData.h" @@ -65,14 +65,14 @@ void UnmapMemory(const void* buffer, void* context) { zx::vmar::root_self().unmap(reinterpret_cast(buffer), size); } -sk_sp MakeSkDataFromVMO(const fsl::SizedVmoTransportPtr& vmo) { - if (!fsl::SizedVmo::IsSizeValid(vmo->vmo, vmo->size) || - vmo->size > std::numeric_limits::max()) { +sk_sp MakeSkDataFromVMO(const fsl::SizedVmoTransport& vmo) { + if (!fsl::SizedVmo::IsSizeValid(vmo.vmo, vmo.size) || + vmo.size > std::numeric_limits::max()) { return nullptr; } - uint64_t size = vmo->size; + uint64_t size = vmo.size; uintptr_t buffer = 0; - zx_status_t status = zx::vmar::root_self().map(0, vmo->vmo, 0, size, + zx_status_t status = zx::vmar::root_self().map(0, vmo.vmo, 0, size, ZX_VM_FLAG_PERM_READ, &buffer); if (status != ZX_OK) return nullptr; @@ -111,11 +111,11 @@ sk_sp FontCache::createTypeface( name = family.utf8(); } - auto request = fonts::FontRequest::New(); - request->family = name.data(); - request->weight = ToIntegerWeight(fontDescription.weight()); - request->width = static_cast(fontDescription.stretch()); - request->slant = ToFontSlant(fontDescription.style()); + fonts::FontRequest request; + request.family = name.data(); + request.weight = ToIntegerWeight(fontDescription.weight()); + request.width = static_cast(fontDescription.stretch()); + request.slant = ToFontSlant(fontDescription.style()); fonts::FontResponsePtr response; auto& font_provider = GetFontProvider(); @@ -132,7 +132,7 @@ sk_sp FontCache::createTypeface( if (!response) return nullptr; - sk_sp data = MakeSkDataFromVMO(response->data->vmo); + sk_sp data = MakeSkDataFromVMO(response->data.vmo); if (!data) return nullptr; diff --git a/sky/engine/platform/fonts/fuchsia/FontCacheFuchsia.h b/sky/engine/platform/fonts/fuchsia/FontCacheFuchsia.h index 66f6448b06b43..fd11337f7d2b8 100644 --- a/sky/engine/platform/fonts/fuchsia/FontCacheFuchsia.h +++ b/sky/engine/platform/fonts/fuchsia/FontCacheFuchsia.h @@ -5,7 +5,7 @@ #ifndef SKY_ENGINE_PLATFORM_FONTS_FUCHSIA_FONT_CACHE_FUCHSIA_H_ #define SKY_ENGINE_PLATFORM_FONTS_FUCHSIA_FONT_CACHE_FUCHSIA_H_ -#include "lib/fonts/fidl/font_provider.fidl.h" +#include namespace blink {