diff --git a/content_handler/runtime_holder.cc b/content_handler/runtime_holder.cc index a805dac6aa0b518216068ab431cade95c93d124d..34365661420e3a3d7414757a9fe356aee79589b4 100644 --- a/content_handler/runtime_holder.cc +++ b/content_handler/runtime_holder.cc @@ -9,7 +9,6 @@ #include "flutter/assets/zip_asset_bundle.h" #include "flutter/common/threads.h" #include "flutter/content_handler/rasterizer.h" -#include "flutter/lib/ui/mojo_services.h" #include "flutter/lib/ui/window/pointer_data_packet.h" #include "flutter/runtime/asset_font_selector.h" #include "flutter/runtime/dart_controller.h" @@ -154,9 +153,6 @@ void RuntimeHolder::HandlePlatformMessage( } void RuntimeHolder::DidCreateMainIsolate(Dart_Isolate isolate) { - blink::MojoServices::Create(isolate, nullptr, nullptr, - std::move(root_bundle_)); - if (asset_store_) blink::AssetFontSelector::Install(asset_store_); } diff --git a/lib/ui/BUILD.gn b/lib/ui/BUILD.gn index 3f0f87c52d8191b2cb1fcb4b24ac6e4bcec91395..314b917d4f08cf055cbd33ad2cff01c592f2b953 100644 --- a/lib/ui/BUILD.gn +++ b/lib/ui/BUILD.gn @@ -12,8 +12,6 @@ source_set("ui") { "dart_runtime_hooks.h", "dart_ui.cc", "dart_ui.h", - "mojo_services.cc", - "mojo_services.h", "painting/canvas.cc", "painting/canvas.h", "painting/gradient.cc", @@ -81,11 +79,6 @@ source_set("ui") { "//flutter/skia", "//flutter/sky/engine", "//lib/tonic", - "//lib/tonic/mojo", - "//mojo/public/cpp/application", - "//mojo/public/cpp/bindings", - "//mojo/public/interfaces/application", - "//mojo/services/asset_bundle/interfaces", ] if (is_android) { diff --git a/lib/ui/compositing.dart b/lib/ui/compositing.dart index 535ed7f65d59f5ce4b2c91e97229d445843f89ee..8ed7e3c9d35d16bfc0a00aaf392081430cda8c15 100644 --- a/lib/ui/compositing.dart +++ b/lib/ui/compositing.dart @@ -185,12 +185,12 @@ class SceneBuilder extends NativeFieldWrapperClass2 { } void _addPicture(double dx, double dy, Picture picture, int hints) native "SceneBuilder_addPicture"; - /// (mojo-only) Adds a scene rendered by another application to the scene for - /// this application. + /// (Fuchsia-only) Adds a scene rendered by another application to the scene + /// for this application. /// /// Applications typically obtain scene tokens when embedding other views via - /// the Mojo view manager, but this function is agnostic as to the source of - /// scene token. + /// the Fuchsia view manager, but this function is agnostic as to the source + /// of scene token. void addChildScene(Offset offset, double devicePixelRatio, int physicalWidth, diff --git a/lib/ui/dart_runtime_hooks.cc b/lib/ui/dart_runtime_hooks.cc index 15d9f19289acd4a66b7952e779ab542a9200964f..765b310807433aa150dd5f51ea9c388ad3894a2d 100644 --- a/lib/ui/dart_runtime_hooks.cc +++ b/lib/ui/dart_runtime_hooks.cc @@ -42,8 +42,6 @@ namespace blink { #define DECLARE_FUNCTION(name, count) \ extern void name(Dart_NativeArguments args); -// Lists the native functions implementing basic functionality in -// the Mojo embedder dart, such as printing, and file I/O. #define BUILTIN_NATIVE_LIST(V) \ V(Logger_PrintString, 1) \ V(ScheduleMicrotask, 1) diff --git a/lib/ui/dart_ui.cc b/lib/ui/dart_ui.cc index 1f7735d68a819d2e0432a902558367ec2a17465f..02ec5ca49665d7cc5ca93f81587199a355eb2f3a 100644 --- a/lib/ui/dart_ui.cc +++ b/lib/ui/dart_ui.cc @@ -7,7 +7,6 @@ #include "flutter/lib/ui/compositing/scene.h" #include "flutter/lib/ui/compositing/scene_builder.h" #include "flutter/lib/ui/dart_runtime_hooks.h" -#include "flutter/lib/ui/mojo_services.h" #include "flutter/lib/ui/painting/canvas.h" #include "flutter/lib/ui/painting/gradient.h" #include "flutter/lib/ui/painting/image.h" @@ -58,7 +57,6 @@ void DartUI::InitForGlobal() { ImageFilter::RegisterNatives(g_natives); ImageShader::RegisterNatives(g_natives); MaskFilter::RegisterNatives(g_natives); - MojoServices::RegisterNatives(g_natives); Paragraph::RegisterNatives(g_natives); ParagraphBuilder::RegisterNatives(g_natives); Picture::RegisterNatives(g_natives); diff --git a/lib/ui/dart_ui.gni b/lib/ui/dart_ui.gni index fadf2594bb480457cd9576d17a512b7b862fbbd1..39d58e92e29d22c2376630338c9f478c1fa7d634 100644 --- a/lib/ui/dart_ui.gni +++ b/lib/ui/dart_ui.gni @@ -8,7 +8,6 @@ dart_ui_files = [ "//flutter/lib/ui/hash_codes.dart", "//flutter/lib/ui/hooks.dart", "//flutter/lib/ui/lerp.dart", - "//flutter/lib/ui/mojo_services.dart", "//flutter/lib/ui/natives.dart", "//flutter/lib/ui/painting.dart", "//flutter/lib/ui/pointer.dart", diff --git a/lib/ui/mojo_services.cc b/lib/ui/mojo_services.cc deleted file mode 100644 index c771deecc0aea842c7839b25f20bcb8a968bb3fe..0000000000000000000000000000000000000000 --- a/lib/ui/mojo_services.cc +++ /dev/null @@ -1,123 +0,0 @@ -// Copyright 2016 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "flutter/lib/ui/mojo_services.h" - -#include "flutter/lib/ui/ui_dart_state.h" -#include "lib/tonic/converter/dart_converter.h" -#include "lib/tonic/dart_library_natives.h" -#include "lib/tonic/dart_state.h" -#include "lib/tonic/logging/dart_error.h" -#include "mojo/public/cpp/application/connect.h" -#include "mojo/public/cpp/bindings/array.h" - -using tonic::DartState; - -namespace blink { -namespace { - -MojoServices* GetMojoServices() { - return static_cast(DartState::Current())->mojo_services(); -} - -void DartTakeRootBundle(Dart_NativeArguments args) { - int handle = MOJO_HANDLE_INVALID; - if (MojoServices* services = GetMojoServices()) - handle = services->TakeRootBundle(); - Dart_SetIntegerReturnValue(args, handle); -} - -void DartTakeIncomingServices(Dart_NativeArguments args) { - int handle = MOJO_HANDLE_INVALID; - if (MojoServices* services = GetMojoServices()) - handle = services->TakeIncomingServices(); - Dart_SetIntegerReturnValue(args, handle); -} - -void DartTakeOutgoingServices(Dart_NativeArguments args) { - int handle = MOJO_HANDLE_INVALID; - if (MojoServices* services = GetMojoServices()) - handle = services->TakeOutgoingServices(); - Dart_SetIntegerReturnValue(args, handle); -} - -void DartTakeShell(Dart_NativeArguments args) { - int handle = MOJO_HANDLE_INVALID; - if (MojoServices* services = GetMojoServices()) - handle = services->TakeShell(); - Dart_SetIntegerReturnValue(args, handle); -} - -void DartTakeViewServices(Dart_NativeArguments args) { - int handle = MOJO_HANDLE_INVALID; - if (MojoServices* services = GetMojoServices()) - handle = services->TakeViewServices(); - Dart_SetIntegerReturnValue(args, handle); -} - -} // namespace - -void MojoServices::RegisterNatives(tonic::DartLibraryNatives* natives) { - natives->Register({ - {"MojoServices_takeRootBundle", DartTakeRootBundle, 0, true}, - {"MojoServices_takeIncomingServices", DartTakeIncomingServices, 0, true}, - {"MojoServices_takeOutgoingServices", DartTakeOutgoingServices, 0, true}, - {"MojoServices_takeShell", DartTakeShell, 0, true}, - {"MojoServices_takeViewServices", DartTakeViewServices, 0, true}, - }); -} - -void MojoServices::Create(Dart_Isolate isolate, - sky::ServicesDataPtr services, - mojo::ServiceProviderPtr incoming_services, - mojo::asset_bundle::AssetBundlePtr root_bundle) { - UIDartState* state = static_cast(DartState::From(isolate)); - state->set_mojo_services(std::unique_ptr( - new MojoServices(std::move(services), std::move(incoming_services), - std::move(root_bundle)))); -} - -MojoServices::MojoServices(sky::ServicesDataPtr services, - mojo::ServiceProviderPtr incoming_services, - mojo::asset_bundle::AssetBundlePtr root_bundle) - : services_(std::move(services)), - root_bundle_(std::move(root_bundle)), - incoming_services_(std::move(incoming_services)) { - if (services_ && services_->outgoing_services.is_pending()) { - outgoing_services_ = std::move(services_->outgoing_services); - } else { - outgoing_services_ = GetProxy(&services_from_dart_); - } -} - -MojoServices::~MojoServices() {} - -int MojoServices::TakeRootBundle() { - return root_bundle_.PassInterfaceHandle().PassHandle().release().value(); -} - -int MojoServices::TakeIncomingServices() { - return incoming_services_.PassInterfaceHandle() - .PassHandle() - .release() - .value(); -} - -int MojoServices::TakeOutgoingServices() { - return outgoing_services_.PassMessagePipe().release().value(); -} - -int MojoServices::TakeShell() { - if (services_) - return services_->shell.PassHandle().release().value(); - return MOJO_HANDLE_INVALID; -} - -int MojoServices::TakeViewServices() { - if (services_) - return services_->view_services.PassHandle().release().value(); - return MOJO_HANDLE_INVALID; -} - -} // namespace blink diff --git a/lib/ui/mojo_services.dart b/lib/ui/mojo_services.dart deleted file mode 100644 index a7d4721196f9acc0209d2dcf5cacc3ec6575d46c..0000000000000000000000000000000000000000 --- a/lib/ui/mojo_services.dart +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2016 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -part of dart_ui; - -/// Mojo handles provided to the application at startup. -/// -/// The application can take ownership of these handles by calling the static -/// "take" functions on this object. Once taken, the application is responsible -/// for managing the handles. -class MojoServices { - MojoServices._(); - - static int takeRootBundle() native "MojoServices_takeRootBundle"; - static int takeIncomingServices() native "MojoServices_takeIncomingServices"; - static int takeOutgoingServices() native "MojoServices_takeOutgoingServices"; - static int takeShell() native "MojoServices_takeShell"; - static int takeViewServices() native "MojoServices_takeViewServices"; -} diff --git a/lib/ui/mojo_services.h b/lib/ui/mojo_services.h deleted file mode 100644 index 88654949202f1fa19450b2f9337837c536418beb..0000000000000000000000000000000000000000 --- a/lib/ui/mojo_services.h +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright 2016 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef SKY_ENGINE_BINDINGS_MOJO_SERVICES_H_ -#define SKY_ENGINE_BINDINGS_MOJO_SERVICES_H_ - -#include "dart/runtime/include/dart_api.h" -#include "lib/ftl/macros.h" -#include "mojo/public/cpp/application/service_provider_impl.h" -#include "mojo/public/interfaces/application/service_provider.mojom.h" -#include "mojo/services/asset_bundle/interfaces/asset_bundle.mojom.h" -#include "flutter/services/engine/sky_engine.mojom.h" - -namespace mojo { -class ApplicationConnection; -} - -namespace tonic { -class DartLibraryNatives; -} // namespace tonic - -namespace blink { - -class MojoServices { - public: - ~MojoServices(); - - static void Create(Dart_Isolate isolate, - sky::ServicesDataPtr services, - mojo::ServiceProviderPtr incoming_services, - mojo::asset_bundle::AssetBundlePtr root_bundle); - - static void RegisterNatives(tonic::DartLibraryNatives* natives); - - int TakeRootBundle(); - int TakeIncomingServices(); - int TakeOutgoingServices(); - int TakeShell(); - int TakeView(); - int TakeViewServices(); - - private: - explicit MojoServices(sky::ServicesDataPtr services, - mojo::ServiceProviderPtr incoming_services, - mojo::asset_bundle::AssetBundlePtr root_bundle); - - sky::ServicesDataPtr services_; - - mojo::asset_bundle::AssetBundlePtr root_bundle_; - mojo::ServiceProviderPtr incoming_services_; - mojo::InterfaceRequest outgoing_services_; - - // We need to hold this object to work around - // https://github.com/domokit/mojo/issues/536 - mojo::ServiceProviderPtr services_from_dart_; - - FTL_DISALLOW_COPY_AND_ASSIGN(MojoServices); -}; - -} // namespace blink - -#endif // SKY_ENGINE_BINDINGS_MOJO_SERVICES_H_ diff --git a/lib/ui/painting.dart b/lib/ui/painting.dart index b459a0ea733935a903a94fdb39ffa9f99ea15490..e584879859b7bbfc86cdc1b2d267e1c985aff2a1 100644 --- a/lib/ui/painting.dart +++ b/lib/ui/painting.dart @@ -545,8 +545,7 @@ class Paint { /// Opaque handle to raw decoded image data (pixels). /// -/// To obtain an Image object, use the [decodeImageFromDataPipe] or -/// [decodeImageFromList] functions. +/// To obtain an Image object, use [decodeImageFromList]. /// /// To draw an Image, use one of the methods on the [Canvas] class, such as /// [drawImage]. @@ -565,13 +564,9 @@ abstract class Image extends NativeFieldWrapperClass2 { String toString() => '[$width\u00D7$height]'; } -/// Callback signature for [decodeImageFromDataPipe] and [decodeImageFromList]. +/// Callback signature for [decodeImageFromList]. typedef void ImageDecoderCallback(Image result); -/// Convert an image file from a mojo pipe into an [Image] object. -void decodeImageFromDataPipe(int handle, ImageDecoderCallback callback) - native "decodeImageFromDataPipe"; - /// Convert an image file from a byte array into an [Image] object. void decodeImageFromList(Uint8List list, ImageDecoderCallback callback) native "decodeImageFromList"; diff --git a/lib/ui/painting/image_decoding.cc b/lib/ui/painting/image_decoding.cc index e1e946e781570ebd85ffc820e38bfa4fc9d9cd4d..169802909400714514f6d88e088223fda52640dc 100644 --- a/lib/ui/painting/image_decoding.cc +++ b/lib/ui/painting/image_decoding.cc @@ -7,7 +7,6 @@ #include "flutter/common/threads.h" #include "flutter/flow/bitmap_image.h" #include "flutter/flow/texture_image.h" -#include "flutter/glue/drain_data_pipe_job.h" #include "flutter/glue/movable_wrapper.h" #include "flutter/glue/trace_event.h" #include "flutter/lib/ui/painting/image.h" @@ -15,7 +14,6 @@ #include "lib/tonic/dart_persistent_value.h" #include "lib/tonic/dart_state.h" #include "lib/tonic/logging/dart_invoke.h" -#include "lib/tonic/mojo/mojo_converter.h" #include "lib/tonic/typed_data/uint8_list.h" #include "third_party/skia/include/core/SkImageGenerator.h" @@ -77,36 +75,6 @@ void DecodeImageAndInvokeImageCallback( }); } -void DecodeImageFromDataPipe(Dart_NativeArguments args) { - Dart_Handle exception = nullptr; - - auto consumer = glue::WrapMovable( - tonic::DartConverter::FromArguments( - args, 0, exception)); - if (exception) { - Dart_ThrowException(exception); - return; - } - - Dart_Handle callback_handle = Dart_GetNativeArgument(args, 1); - if (!Dart_IsClosure(callback_handle)) { - Dart_ThrowException(ToDart("Callback must be a function")); - return; - } - - auto callback = glue::WrapMovable(std::unique_ptr( - new DartPersistentValue(tonic::DartState::Current(), callback_handle))); - - Threads::IO()->PostTask([callback, consumer]() mutable { - glue::DrainDataPipeJob* job = nullptr; - job = new glue::DrainDataPipeJob( - consumer.Unwrap(), [callback, job](std::vector buffer) { - delete job; - DecodeImageAndInvokeImageCallback(callback, std::move(buffer)); - }); - }); -} - void DecodeImageFromList(Dart_NativeArguments args) { Dart_Handle exception = nullptr; @@ -138,7 +106,6 @@ void DecodeImageFromList(Dart_NativeArguments args) { void ImageDecoding::RegisterNatives(tonic::DartLibraryNatives* natives) { natives->Register({ - {"decodeImageFromDataPipe", DecodeImageFromDataPipe, 2, true}, {"decodeImageFromList", DecodeImageFromList, 2, true}, }); } diff --git a/lib/ui/ui.dart b/lib/ui/ui.dart index 5a6168d00152fcad103cda197a15a146e6d8e759..fcc5f58a42790f5624d03857b28b3aac636b9d45 100644 --- a/lib/ui/ui.dart +++ b/lib/ui/ui.dart @@ -7,10 +7,8 @@ /// To use, import `dart:ui`. /// /// This library exposes the lowest-level services that Flutter frameworks use -/// to bootstrap applications, such as methods to obtain handles for the mojo -/// IPC system, classes for driving the graphics and text layout and rendering -/// subsystems, callbacks for integrating with the engine scheduler and the -/// pointer input system, and functions for image decoding. +/// to bootstrap applications, such as classes for driving the input, graphics +/// text, layout, and rendering subsystems. library dart_ui; import 'dart:_internal'; @@ -27,7 +25,6 @@ part 'geometry.dart'; part 'hash_codes.dart'; part 'hooks.dart'; part 'lerp.dart'; -part 'mojo_services.dart'; part 'natives.dart'; part 'painting.dart'; part 'pointer.dart'; diff --git a/lib/ui/ui_dart_state.cc b/lib/ui/ui_dart_state.cc index 8029cff398d2ec00e101a2b15e00f65c3483cb6d..93d4ee6a2db6a81feea66294bce5715e6f7bfce0 100644 --- a/lib/ui/ui_dart_state.cc +++ b/lib/ui/ui_dart_state.cc @@ -4,7 +4,6 @@ #include "flutter/lib/ui/ui_dart_state.h" -#include "flutter/lib/ui/mojo_services.h" #include "flutter/lib/ui/window/window.h" #include "flutter/sky/engine/platform/fonts/FontSelector.h" #include "lib/tonic/converter/dart_converter.h" @@ -55,15 +54,6 @@ UIDartState* UIDartState::Current() { return static_cast(DartState::Current()); } -void UIDartState::set_mojo_services( - std::unique_ptr mojo_services) { - mojo_services_ = std::move(mojo_services); -} - -MojoServices* UIDartState::mojo_services() { - return mojo_services_.get(); -} - #if defined(OS_ANDROID) DartJniIsolateData* UIDartState::jni_data() { return jni_data_.get(); diff --git a/lib/ui/ui_dart_state.h b/lib/ui/ui_dart_state.h index 3fd60d8cc14e29ded24bf5abf5d1d5e0ee4e5924..021d216e00df6d5c4b75e1905a8ae97f0bae5611 100644 --- a/lib/ui/ui_dart_state.h +++ b/lib/ui/ui_dart_state.h @@ -16,7 +16,6 @@ namespace blink { struct DartJniIsolateData; class FontSelector; -class MojoServices; class Window; class IsolateClient { @@ -41,9 +40,6 @@ class UIDartState : public tonic::DartState { const std::string& debug_name() const { return debug_name_; } Window* window() const { return window_.get(); } - void set_mojo_services(std::unique_ptr mojo_services); - MojoServices* mojo_services(); - #if defined(OS_ANDROID) DartJniIsolateData* jni_data(); #endif @@ -57,7 +53,6 @@ class UIDartState : public tonic::DartState { IsolateClient* isolate_client_; Dart_Port main_port_; std::string debug_name_; - std::unique_ptr mojo_services_; std::unique_ptr window_; RefPtr font_selector_; diff --git a/shell/common/engine.cc b/shell/common/engine.cc index 4a5b4385f4a82aa1dcb58a43b2695b4f0039c0e3..1dc4bb5b21e1f99d8305b2f088c1c19c70e2c89d 100644 --- a/shell/common/engine.cc +++ b/shell/common/engine.cc @@ -14,7 +14,6 @@ #include "flutter/common/threads.h" #include "flutter/glue/movable_wrapper.h" #include "flutter/glue/trace_event.h" -#include "flutter/lib/ui/mojo_services.h" #include "flutter/runtime/asset_font_selector.h" #include "flutter/runtime/dart_controller.h" #include "flutter/runtime/dart_init.h" @@ -302,29 +301,11 @@ void Engine::OnAppLifecycleStateChanged(sky::AppLifecycleState state) { } void Engine::DidCreateMainIsolate(Dart_Isolate isolate) { - mojo::ServiceProviderPtr services_from_embedder; - service_provider_bindings_.AddBinding( - &service_provider_impl_, mojo::GetProxy(&services_from_embedder)); - - blink::MojoServices::Create(isolate, std::move(services_), - std::move(services_from_embedder), - std::move(root_bundle_)); - if (asset_store_) blink::AssetFontSelector::Install(asset_store_); } -void Engine::DidCreateSecondaryIsolate(Dart_Isolate isolate) { - mojo::ServiceProviderPtr services_from_embedder; - auto request = glue::WrapMovable(mojo::GetProxy(&services_from_embedder)); - ftl::WeakPtr engine = weak_factory_.GetWeakPtr(); - blink::Threads::UI()->PostTask([engine, request]() mutable { - if (engine) - engine->BindToServiceProvider(request.Unwrap()); - }); - blink::MojoServices::Create(isolate, nullptr, - std::move(services_from_embedder), nullptr); -} +void Engine::DidCreateSecondaryIsolate(Dart_Isolate isolate) {} void Engine::BindToServiceProvider( mojo::InterfaceRequest request) { diff --git a/sky/packages/flutter_services/lib/platform/app_messages.dart b/sky/packages/flutter_services/lib/empty.dart similarity index 53% rename from sky/packages/flutter_services/lib/platform/app_messages.dart rename to sky/packages/flutter_services/lib/empty.dart index 1645ab556bc50defdeb1d41ccdfdae2edb0a2dd2..a3f12bfd1109e0d16770fe1630da54a08587092c 100644 --- a/sky/packages/flutter_services/lib/platform/app_messages.dart +++ b/sky/packages/flutter_services/lib/empty.dart @@ -2,5 +2,4 @@ /// Use of this source code is governed by a BSD-style license that can be /// found in the LICENSE file. -import 'package:sky_services/flutter/platform/app_messages.mojom.dart'; -export 'package:sky_services/flutter/platform/app_messages.mojom.dart'; +// TODO(abarth): Remove this package. diff --git a/sky/packages/flutter_services/lib/mojo/asset_bundle/asset_bundle.dart b/sky/packages/flutter_services/lib/mojo/asset_bundle/asset_bundle.dart deleted file mode 100644 index 349cccc1f9dcb16e971b4b96c9d755aeb8190aa4..0000000000000000000000000000000000000000 --- a/sky/packages/flutter_services/lib/mojo/asset_bundle/asset_bundle.dart +++ /dev/null @@ -1,6 +0,0 @@ -/// Copyright 2016 The Chromium Authors. All rights reserved. -/// Use of this source code is governed by a BSD-style license that can be -/// found in the LICENSE file. - -import 'package:mojo_services/mojo/asset_bundle/asset_bundle.mojom.dart'; -export 'package:mojo_services/mojo/asset_bundle/asset_bundle.mojom.dart';