From 63e71803deb316182043f2b73da24d8ccf5eaa95 Mon Sep 17 00:00:00 2001 From: Adam Barth Date: Fri, 28 Oct 2016 15:01:07 -0700 Subject: [PATCH] Unlink from mojo (#3187) After this patch, we no longer link with Mojo. We still use some gn definitions from //mojo to create Dart packages. --- glue/BUILD.gn | 5 +- glue/movable_wrapper.h | 37 -------------- lib/mojo/BUILD.gn | 24 --------- lib/mojo/dart_mojo_internal.cc | 47 ----------------- lib/mojo/dart_mojo_internal.h | 25 --------- lib/snapshot/BUILD.gn | 7 --- lib/snapshot/snapshot.dart | 1 - lib/snapshot/toolchain.gni | 1 - lib/ui/dart_runtime_hooks.cc | 24 ++++----- lib/ui/natives.dart | 3 -- lib/ui/painting/image_decoding.cc | 24 +++++---- lib/ui/ui.dart | 1 - runtime/BUILD.gn | 6 +-- runtime/dart_controller.cc | 6 +-- runtime/dart_init.cc | 7 --- runtime/dart_service_isolate.cc | 6 +-- runtime/dart_vm_entry_points.txt | 1 - runtime/embedder_resources.cc | 2 +- runtime/embedder_resources.h | 14 ++--- services/platform/BUILD.gn | 17 ------ services/platform/app_messages.mojom | 13 ----- shell/common/BUILD.gn | 54 +++++++++++++++++++- shell/common/diagnostic/diagnostic_server.cc | 6 +-- shell/common/engine.cc | 1 - shell/common/shell.cc | 6 --- shell/platform/android/BUILD.gn | 2 - shell/platform/android/flutter_main.cc | 4 -- shell/platform/darwin/common/BUILD.gn | 2 - shell/platform/darwin/common/platform_mac.mm | 4 -- shell/platform/darwin/ios/BUILD.gn | 2 - shell/platform/linux/BUILD.gn | 2 - shell/platform/linux/main_linux.cc | 4 -- sky/engine/web/BUILD.gn | 4 -- sky/engine/web/Sky.cpp | 17 ------ sky/engine/wtf/BUILD.gn | 10 +--- sky/packages/sky_engine/BUILD.gn | 2 +- sky/packages/sky_services/BUILD.gn | 1 - sky/packages/sky_services/README.md | 4 +- sky/packages/sky_services/pubspec.yaml | 4 +- travis/analyze.sh | 3 -- 40 files changed, 99 insertions(+), 304 deletions(-) delete mode 100644 glue/movable_wrapper.h delete mode 100644 lib/mojo/BUILD.gn delete mode 100644 lib/mojo/dart_mojo_internal.cc delete mode 100644 lib/mojo/dart_mojo_internal.h delete mode 100644 services/platform/BUILD.gn delete mode 100644 services/platform/app_messages.mojom diff --git a/glue/BUILD.gn b/glue/BUILD.gn index 8a88cf1ab5e..15b087d0ba5 100644 --- a/glue/BUILD.gn +++ b/glue/BUILD.gn @@ -4,7 +4,6 @@ source_set("glue") { sources = [ - "movable_wrapper.h", "stack_trace.h", "thread.h", "trace_event.h", @@ -12,8 +11,6 @@ source_set("glue") { deps = [ "//lib/ftl", - "//mojo/public/cpp/environment", - "//mojo/public/cpp/system", ] if (is_fuchsia) { @@ -26,6 +23,8 @@ source_set("glue") { deps += [ "//lib/mtl", + "//mojo/public/cpp/environment", + "//mojo/public/cpp/system", ] public_deps = [ diff --git a/glue/movable_wrapper.h b/glue/movable_wrapper.h deleted file mode 100644 index 03b3645aafe..00000000000 --- a/glue/movable_wrapper.h +++ /dev/null @@ -1,37 +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 FLUTTER_GLU_MOVABLE_WRAPPER_H_ -#define FLUTTER_GLU_MOVABLE_WRAPPER_H_ - -#include - -namespace glue { - -template -class MovableWrapper { - public: - explicit MovableWrapper(T object) : object_(std::move(object)) {} - MovableWrapper(const MovableWrapper& other) - : object_(std::move(other.object_)) {} - - MovableWrapper(MovableWrapper&& other) : object_(std::move(other.object_)) {} - MovableWrapper& operator=(MovableWrapper&& other) { - object_ = std::move(other.object_); - } - - T Unwrap() { return std::move(object_); } - - private: - mutable T object_; -}; - -template -MovableWrapper WrapMovable(T object) { - return MovableWrapper(std::move(object)); -} - -} // namespace glue - -#endif // FLUTTER_GLU_MOVABLE_WRAPPER_H_ diff --git a/lib/mojo/BUILD.gn b/lib/mojo/BUILD.gn deleted file mode 100644 index e519c37c887..00000000000 --- a/lib/mojo/BUILD.gn +++ /dev/null @@ -1,24 +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. - -source_set("mojo") { - sources = [ - "dart_mojo_internal.cc", - "dart_mojo_internal.h", - ] - - deps = [ - "//dart/runtime:libdart", - "//lib/ftl", - "//lib/tonic", - "//mojo/public/cpp/system", - "//mojo/public/platform/dart:mojo_internal_impl", - ] - - if (!is_fuchsia) { - deps += [ - "//mojo/public/cpp/environment:logging_only", - ] - } -} diff --git a/lib/mojo/dart_mojo_internal.cc b/lib/mojo/dart_mojo_internal.cc deleted file mode 100644 index 1206a586caf..00000000000 --- a/lib/mojo/dart_mojo_internal.cc +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright 2014 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/mojo/dart_mojo_internal.h" - -#include "dart/runtime/include/dart_api.h" -#include "lib/ftl/logging.h" -#include "lib/tonic/converter/dart_converter.h" -#include "lib/tonic/logging/dart_error.h" -#include "mojo/public/platform/dart/mojo_natives.h" - -using tonic::LogIfError; -using tonic::ToDart; - -namespace blink { -namespace { - -MojoHandle g_handle_watcher_producer_handle = MOJO_HANDLE_INVALID; - -void SetHandleWatcherControlHandle(Dart_Handle mojo_internal) { - FTL_CHECK(g_handle_watcher_producer_handle != MOJO_HANDLE_INVALID); - Dart_Handle handle_watcher_type = - Dart_GetType(mojo_internal, ToDart("MojoHandleWatcher"), 0, nullptr); - Dart_Handle field_name = ToDart("mojoControlHandle"); - Dart_Handle control_port_value = ToDart(g_handle_watcher_producer_handle); - Dart_Handle result = - Dart_SetField(handle_watcher_type, field_name, control_port_value); - FTL_CHECK(!LogIfError(result)); -} - -} // namespace - -void DartMojoInternal::SetHandleWatcherProducerHandle(MojoHandle handle) { - FTL_CHECK(g_handle_watcher_producer_handle == MOJO_HANDLE_INVALID); - g_handle_watcher_producer_handle = handle; -} - -void DartMojoInternal::InitForIsolate() { - Dart_Handle mojo_internal = Dart_LookupLibrary(ToDart("dart:mojo.internal")); - DART_CHECK_VALID(Dart_SetNativeResolver(mojo_internal, - mojo::dart::MojoNativeLookup, - mojo::dart::MojoNativeSymbol)); - SetHandleWatcherControlHandle(mojo_internal); -} - -} // namespace blink diff --git a/lib/mojo/dart_mojo_internal.h b/lib/mojo/dart_mojo_internal.h deleted file mode 100644 index 8cc2e82b635..00000000000 --- a/lib/mojo/dart_mojo_internal.h +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2014 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 FLUTTER_LIB_MOJO_DART_MOJO_INTERNAL_H_ -#define FLUTTER_LIB_MOJO_DART_MOJO_INTERNAL_H_ - -#include "lib/ftl/macros.h" -#include "mojo/public/cpp/system/handle.h" - -namespace blink { - -class DartMojoInternal { - public: - static void InitForIsolate(); - - static void SetHandleWatcherProducerHandle(MojoHandle handle); - - private: - FTL_DISALLOW_IMPLICIT_CONSTRUCTORS(DartMojoInternal); -}; - -} // namespace blink - -#endif // FLUTTER_LIB_MOJO_DART_MOJO_INTERNAL_H_ diff --git a/lib/snapshot/BUILD.gn b/lib/snapshot/BUILD.gn index 9d4e8770ce0..74c40d1e9a7 100644 --- a/lib/snapshot/BUILD.gn +++ b/lib/snapshot/BUILD.gn @@ -6,7 +6,6 @@ import("//flutter/lib/jni/dart_jni.gni") import("//flutter/lib/snapshot/toolchain.gni") import("//flutter/lib/ui/dart_ui.gni") import("//flutter/lib/ui/dart_ui.gni") -import("//mojo/dart/packages/mojo/sdk_ext_sources.gni") bindings_output_dir = "$root_gen_dir/sky/bindings" @@ -37,9 +36,6 @@ action("generate_snapshot_bin") { "snapshot.dart", ] + dart_ui_files + dart_jni_files - + rebase_path(dart_mojo_internal_sdk_sources, - "", - "//mojo/dart/packages/mojo") vm_isolate_snapshot = "$target_gen_dir/vm_isolate_snapshot.bin" isolate_snapshot = "$target_gen_dir/isolate_snapshot.bin" outputs = [ @@ -47,8 +43,6 @@ action("generate_snapshot_bin") { isolate_snapshot, ] - dart_mojo_internal_path = - rebase_path("//mojo/dart/packages/mojo/sdk_ext/internal.dart") rebased_dart_ui_path = rebase_path(dart_ui_path) rebased_dart_jni_path = rebase_path(dart_jni_path) @@ -70,7 +64,6 @@ action("generate_snapshot_bin") { rebase_path(isolate_snapshot, root_build_dir), "--target_os", target_os, - "--url_mapping=dart:mojo.internal,$dart_mojo_internal_path", "--url_mapping=dart:ui,$rebased_dart_ui_path", "--url_mapping=dart:jni,$rebased_dart_jni_path", ] diff --git a/lib/snapshot/snapshot.dart b/lib/snapshot/snapshot.dart index e55c48ad7b3..5e1f35159ed 100644 --- a/lib/snapshot/snapshot.dart +++ b/lib/snapshot/snapshot.dart @@ -11,6 +11,5 @@ import 'dart:io'; import 'dart:isolate'; import 'dart:jni'; import 'dart:math'; -import 'dart:mojo.internal'; import 'dart:ui'; import 'dart:typed_data'; diff --git a/lib/snapshot/toolchain.gni b/lib/snapshot/toolchain.gni index 49ef9c1dea2..2ca434f750a 100644 --- a/lib/snapshot/toolchain.gni +++ b/lib/snapshot/toolchain.gni @@ -2,7 +2,6 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. -import("//mojo/dart/packages/mojo/sdk_ext_sources.gni") import("//flutter/common/config.gni") # for flutter_aot if (target_os == "ios") { diff --git a/lib/ui/dart_runtime_hooks.cc b/lib/ui/dart_runtime_hooks.cc index 765b3108074..f96d035317a 100644 --- a/lib/ui/dart_runtime_hooks.cc +++ b/lib/ui/dart_runtime_hooks.cc @@ -72,21 +72,17 @@ static void InitDartInternal(Dart_Handle builtin_library, // Call |_setupHooks| to configure |VMLibraryHooks|. Dart_Handle method_name = Dart_NewStringFromCString("_setupHooks"); DART_CHECK_VALID(Dart_Invoke(builtin_library, method_name, 0, NULL)) - - // Call |_setupHooks| to configure |VMLibraryHooks|. - Dart_Handle isolate_lib = Dart_LookupLibrary(ToDart("dart:isolate")); - DART_CHECK_VALID(isolate_lib); - DART_CHECK_VALID(Dart_Invoke(isolate_lib, method_name, 0, NULL)); - } else { - FTL_CHECK(isolate_type == DartRuntimeHooks::SecondaryIsolate); - Dart_Handle io_lib = Dart_LookupLibrary(ToDart("dart:io")); - DART_CHECK_VALID(io_lib); - Dart_Handle setup_hooks = Dart_NewStringFromCString("_setupHooks"); - DART_CHECK_VALID(Dart_Invoke(io_lib, setup_hooks, 0, NULL)); - Dart_Handle isolate_lib = Dart_LookupLibrary(ToDart("dart:isolate")); - DART_CHECK_VALID(isolate_lib); - DART_CHECK_VALID(Dart_Invoke(isolate_lib, setup_hooks, 0, NULL)); } + + Dart_Handle setup_hooks = Dart_NewStringFromCString("_setupHooks"); + + Dart_Handle io_lib = Dart_LookupLibrary(ToDart("dart:io")); + DART_CHECK_VALID(io_lib); + DART_CHECK_VALID(Dart_Invoke(io_lib, setup_hooks, 0, NULL)); + + Dart_Handle isolate_lib = Dart_LookupLibrary(ToDart("dart:isolate")); + DART_CHECK_VALID(isolate_lib); + DART_CHECK_VALID(Dart_Invoke(isolate_lib, setup_hooks, 0, NULL)); } static void InitDartCore(Dart_Handle builtin, const std::string& script_uri) { diff --git a/lib/ui/natives.dart b/lib/ui/natives.dart index d16d0e3425b..ee794c25c10 100644 --- a/lib/ui/natives.dart +++ b/lib/ui/natives.dart @@ -28,9 +28,6 @@ Future _scheduleFrame( } void _setupHooks() { - // Wire up timer implementation that is driven by MojoHandleWatcher. - VMLibraryHooks.eventHandlerSendData = MojoHandleWatcher.timer; - VMLibraryHooks.timerMillisecondClock = MojoCoreNatives.timerMillisecondClock; assert(() { // In debug mode, register the schedule frame extension. developer.registerExtension('ext.ui.window.scheduleFrame', _scheduleFrame); diff --git a/lib/ui/painting/image_decoding.cc b/lib/ui/painting/image_decoding.cc index 16980290940..4ec6e7b4216 100644 --- a/lib/ui/painting/image_decoding.cc +++ b/lib/ui/painting/image_decoding.cc @@ -7,10 +7,10 @@ #include "flutter/common/threads.h" #include "flutter/flow/bitmap_image.h" #include "flutter/flow/texture_image.h" -#include "flutter/glue/movable_wrapper.h" #include "flutter/glue/trace_event.h" #include "flutter/lib/ui/painting/image.h" #include "flutter/lib/ui/painting/resource_context.h" +#include "lib/ftl/functional/make_copyable.h" #include "lib/tonic/dart_persistent_value.h" #include "lib/tonic/dart_state.h" #include "lib/tonic/logging/dart_invoke.h" @@ -67,12 +67,13 @@ void InvokeImageCallback(sk_sp image, } void DecodeImageAndInvokeImageCallback( - glue::MovableWrapper> callback, + std::unique_ptr callback, std::vector buffer) { sk_sp image = DecodeImage(std::move(buffer)); - Threads::UI()->PostTask([callback, image]() mutable { - InvokeImageCallback(image, callback.Unwrap()); - }); + Threads::UI()->PostTask( + ftl::MakeCopyable([ callback = std::move(callback), image ]() mutable { + InvokeImageCallback(image, std::move(callback)); + })); } void DecodeImageFromList(Dart_NativeArguments args) { @@ -91,15 +92,16 @@ void DecodeImageFromList(Dart_NativeArguments args) { return; } - auto callback = glue::WrapMovable(std::unique_ptr( - new DartPersistentValue(tonic::DartState::Current(), callback_handle))); - const uint8_t* bytes = reinterpret_cast(list.data()); std::vector buffer(bytes, bytes + list.num_elements()); - Threads::IO()->PostTask([ callback, buffer = std::move(buffer) ]() mutable { - DecodeImageAndInvokeImageCallback(callback, std::move(buffer)); - }); + Threads::IO()->PostTask(ftl::MakeCopyable([ + callback = std::make_unique( + tonic::DartState::Current(), callback_handle), + buffer = std::move(buffer) + ]() mutable { + DecodeImageAndInvokeImageCallback(std::move(callback), std::move(buffer)); + })); } } // namespace diff --git a/lib/ui/ui.dart b/lib/ui/ui.dart index fcc5f58a427..2dd261d27b4 100644 --- a/lib/ui/ui.dart +++ b/lib/ui/ui.dart @@ -16,7 +16,6 @@ import 'dart:async'; import 'dart:convert'; import 'dart:developer' as developer; import 'dart:math' as math; -import 'dart:mojo.internal'; import 'dart:nativewrappers'; import 'dart:typed_data'; diff --git a/runtime/BUILD.gn b/runtime/BUILD.gn index b788795ef00..0a0e6b17fd8 100644 --- a/runtime/BUILD.gn +++ b/runtime/BUILD.gn @@ -23,9 +23,9 @@ action("gen_embedded_resources_cc") { "--output", rebase_path(output_file), "--outer_namespace", - "mojo", # TODO(abarth): Change namespace. + "flutter", "--inner_namespace", - "dart", # TODO(abarth): Change namespace. + "runtime", "--table_name", "flutter_embedded_service_isolate", "--root_prefix", @@ -71,13 +71,11 @@ source_set("runtime") { "//flutter/flow", "//flutter/glue", "//flutter/lib/io", - "//flutter/lib/mojo", "//flutter/lib/ui", "//flutter/skia", "//flutter/sky/engine/platform", "//lib/ftl", "//lib/tonic", - "//mojo/public/platform/dart:mojo_internal_impl", "//third_party/rapidjson", ] diff --git a/runtime/dart_controller.cc b/runtime/dart_controller.cc index a6ce086d43b..ee90dec6dfd 100644 --- a/runtime/dart_controller.cc +++ b/runtime/dart_controller.cc @@ -11,7 +11,6 @@ #include "flutter/common/threads.h" #include "flutter/glue/trace_event.h" #include "flutter/lib/io/dart_io.h" -#include "flutter/lib/mojo/dart_mojo_internal.h" #include "flutter/lib/ui/dart_runtime_hooks.h" #include "flutter/lib/ui/dart_ui.h" #include "flutter/lib/ui/ui_dart_state.h" @@ -137,8 +136,8 @@ void DartController::CreateIsolateFor(const std::string& script_uri, char* error = nullptr; Dart_Isolate isolate = Dart_CreateIsolate( script_uri.c_str(), "main", - reinterpret_cast(DART_SYMBOL(kIsolateSnapshot)), - nullptr, static_cast(state.get()), &error); + reinterpret_cast(DART_SYMBOL(kIsolateSnapshot)), nullptr, + static_cast(state.get()), &error); FTL_CHECK(isolate) << error; ui_dart_state_ = state.release(); dart_state()->message_handler().Initialize(blink::Threads::UI()); @@ -153,7 +152,6 @@ void DartController::CreateIsolateFor(const std::string& script_uri, tonic::DartApiScope dart_api_scope; DartIO::InitForIsolate(); DartUI::InitForIsolate(); - DartMojoInternal::InitForIsolate(); DartRuntimeHooks::Install(DartRuntimeHooks::MainIsolate, script_uri); std::unique_ptr ui_class_provider( diff --git a/runtime/dart_init.cc b/runtime/dart_init.cc index 5d018d8bc86..e4caf78de7e 100644 --- a/runtime/dart_init.cc +++ b/runtime/dart_init.cc @@ -24,7 +24,6 @@ #include "flutter/common/settings.h" #include "flutter/glue/trace_event.h" #include "flutter/lib/io/dart_io.h" -#include "flutter/lib/mojo/dart_mojo_internal.h" #include "flutter/lib/ui/dart_runtime_hooks.h" #include "flutter/lib/ui/dart_ui.h" #include "flutter/lib/ui/ui_dart_state.h" @@ -48,7 +47,6 @@ #include "lib/tonic/scopes/dart_api_scope.h" #include "lib/tonic/scopes/dart_isolate_scope.h" #include "lib/tonic/typed_data/uint8_list.h" -#include "mojo/public/platform/dart/dart_handle_watcher.h" #if defined(OS_ANDROID) #include "flutter/lib/jni/dart_jni.h" @@ -219,7 +217,6 @@ Dart_Isolate ServiceIsolateCreateCallback(const char* script_uri, tonic::DartApiScope dart_api_scope; DartIO::InitForIsolate(); DartUI::InitForIsolate(); - DartMojoInternal::InitForIsolate(); DartRuntimeHooks::Install(DartRuntimeHooks::SecondaryIsolate, script_uri); const Settings& settings = Settings::Get(); if (settings.enable_observatory) { @@ -295,7 +292,6 @@ Dart_Isolate IsolateCreateCallback(const char* script_uri, tonic::DartApiScope dart_api_scope; DartIO::InitForIsolate(); DartUI::InitForIsolate(); - DartMojoInternal::InitForIsolate(); DartRuntimeHooks::Install(DartRuntimeHooks::SecondaryIsolate, script_uri); std::unique_ptr ui_class_provider( @@ -582,9 +578,6 @@ void InitDartVM() { } } - DartMojoInternal::SetHandleWatcherProducerHandle( - mojo::dart::HandleWatcher::Start()); - std::vector args; // Instruct the VM to ignore unrecognized flags. diff --git a/runtime/dart_service_isolate.cc b/runtime/dart_service_isolate.cc index b37559901fc..1dd8498446a 100644 --- a/runtime/dart_service_isolate.cc +++ b/runtime/dart_service_isolate.cc @@ -29,8 +29,8 @@ #define kLibrarySourceNamePrefix "/vmservice" static const char* kServiceIsolateScript = "vmservice_io.dart"; -namespace mojo { -namespace dart { +namespace flutter { +namespace runtime { extern ResourcesEntry __flutter_embedded_service_isolate_resources_[]; } } @@ -104,7 +104,7 @@ bool DartServiceIsolate::Startup(std::string server_ip, if (!g_resources) { g_resources = new EmbedderResources( - &mojo::dart::__flutter_embedded_service_isolate_resources_[0]); + &flutter::runtime::__flutter_embedded_service_isolate_resources_[0]); } Dart_Handle result; diff --git a/runtime/dart_vm_entry_points.txt b/runtime/dart_vm_entry_points.txt index 0500cd4145e..3c2a81b721d 100644 --- a/runtime/dart_vm_entry_points.txt +++ b/runtime/dart_vm_entry_points.txt @@ -1,7 +1,6 @@ dart:io,::,_setupHooks dart:io,_Platform,set:_nativeScript dart:isolate,::,_startMainIsolate -dart:mojo.internal,MojoHandleWatcher,mojoControlHandle dart:ui,::,_beginFrame dart:ui,::,_dispatchPlatformMessage dart:ui,::,_dispatchPointerDataPacket diff --git a/runtime/embedder_resources.cc b/runtime/embedder_resources.cc index 851a71b448b..7fe01c53721 100644 --- a/runtime/embedder_resources.cc +++ b/runtime/embedder_resources.cc @@ -10,7 +10,7 @@ namespace blink { -using mojo::dart::ResourcesEntry; +using flutter::runtime::ResourcesEntry; EmbedderResources::EmbedderResources(ResourcesEntry* resources_table) : resources_table_(resources_table) {} diff --git a/runtime/embedder_resources.h b/runtime/embedder_resources.h index 2bc25177c2b..eb3a0b833fd 100644 --- a/runtime/embedder_resources.h +++ b/runtime/embedder_resources.h @@ -5,8 +5,8 @@ #ifndef FLUTTER_RUNTIME_EMBEDDER_RESOURCES_H_ #define FLUTTER_RUNTIME_EMBEDDER_RESOURCES_H_ -namespace mojo { -namespace dart { +namespace flutter { +namespace runtime { struct ResourcesEntry { const char* path_; @@ -14,14 +14,14 @@ struct ResourcesEntry { int length_; }; -} // namespace dart -} // namespace mojo +} // namespace runtime +} // namespace flutter namespace blink { class EmbedderResources { public: - EmbedderResources(mojo::dart::ResourcesEntry* resources_table); + EmbedderResources(flutter::runtime::ResourcesEntry* resources_table); static const int kNoSuchInstance; @@ -29,9 +29,9 @@ class EmbedderResources { const char* Path(int idx); private: - mojo::dart::ResourcesEntry* At(int idx); + flutter::runtime::ResourcesEntry* At(int idx); - mojo::dart::ResourcesEntry* resources_table_; + flutter::runtime::ResourcesEntry* resources_table_; }; } // namespace blink diff --git a/services/platform/BUILD.gn b/services/platform/BUILD.gn deleted file mode 100644 index 05e127bc7b8..00000000000 --- a/services/platform/BUILD.gn +++ /dev/null @@ -1,17 +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("//mojo/public/tools/bindings/mojom.gni") - -mojom("interfaces") { - sources = [ - "app_messages.mojom", - ] -} - -group("platform") { - public_deps = [ - ":interfaces" - ] -} diff --git a/services/platform/app_messages.mojom b/services/platform/app_messages.mojom deleted file mode 100644 index 718f7ab0586..00000000000 --- a/services/platform/app_messages.mojom +++ /dev/null @@ -1,13 +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. - -[DartPackage="sky_services"] -module flutter.platform; - -/// A service that can be implemented by the host application and the -/// Flutter framework to exchange application-specific messages. -[ServiceName="flutter::platform::ApplicationMessages"] -interface ApplicationMessages { - SendString(string messageName, string message) => (string? reply); -}; diff --git a/shell/common/BUILD.gn b/shell/common/BUILD.gn index 4af5f458dc5..4ba7fd36681 100644 --- a/shell/common/BUILD.gn +++ b/shell/common/BUILD.gn @@ -2,7 +2,58 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. -import("//mojo/dart/embedder/embedder.gni") +# Template to generate a dart embedder resource.cc file. +# Required invoker inputs: +# String output (name of output file) +# List inputs (list of input files to be included) +# String table_name (name of symbol for resource table) +# String root_prefix (base directory of resources) +# Optional invoker inputs: +# String input_directory (directory of resources that are recursively added) +# List deps +# List datadeps +template("dart_embedder_resources") { + action(target_name) { + script = "//dart/runtime/tools/create_resources.py" + deps = [] + if (defined(invoker.deps)) { + deps += invoker.deps + } + datadeps = [] + if (defined(invoker.datadeps)) { + datadeps = invoker.datadeps + } + + output = invoker.output + outputs = [ + output, + ] + + inputs = [ script ] + invoker.inputs + + root_prefix = rebase_path(invoker.root_prefix) + + args = [ + "--output", + rebase_path(output), + "--outer_namespace", + "flutter", + "--inner_namespace", + "runtime", + "--table_name", + invoker.table_name, + "--root_prefix", + root_prefix, + ] + if (defined(invoker.input_directory)) { + args += [ + "--client_root", + rebase_path(invoker.input_directory), + ] + } + args += rebase_path(invoker.inputs) + } +} dart_embedder_resources("generate_embedder_diagnostic_server_resources_cc") { inputs = [ @@ -62,7 +113,6 @@ source_set("common") { "//flutter/synchronization", "//lib/ftl", "//lib/tonic", - "//mojo/message_pump", "//third_party/libjpeg", "//third_party/rapidjson", ":generate_embedder_diagnostic_server_resources_cc", diff --git a/shell/common/diagnostic/diagnostic_server.cc b/shell/common/diagnostic/diagnostic_server.cc index bcdd9d6a89e..73c76fddc6c 100644 --- a/shell/common/diagnostic/diagnostic_server.cc +++ b/shell/common/diagnostic/diagnostic_server.cc @@ -19,8 +19,8 @@ #include "lib/tonic/logging/dart_invoke.h" #include "third_party/skia/include/core/SkStream.h" -namespace mojo { -namespace dart { +namespace flutter { +namespace runtime { extern ResourcesEntry __sky_embedder_diagnostic_server_resources_[]; } } @@ -69,7 +69,7 @@ void DiagnosticServer::Start() { } EmbedderResources resources( - &mojo::dart::__sky_embedder_diagnostic_server_resources_[0]); + &flutter::runtime::__sky_embedder_diagnostic_server_resources_[0]); const char* source = nullptr; int source_length = diff --git a/shell/common/engine.cc b/shell/common/engine.cc index a21630aa0bb..58a65b3d382 100644 --- a/shell/common/engine.cc +++ b/shell/common/engine.cc @@ -12,7 +12,6 @@ #include "flutter/assets/unzipper_provider.h" #include "flutter/assets/zip_asset_store.h" #include "flutter/common/threads.h" -#include "flutter/glue/movable_wrapper.h" #include "flutter/glue/trace_event.h" #include "flutter/runtime/asset_font_selector.h" #include "flutter/runtime/dart_controller.h" diff --git a/shell/common/shell.cc b/shell/common/shell.cc index 629e69c4c8b..4c0aef47268 100644 --- a/shell/common/shell.cc +++ b/shell/common/shell.cc @@ -28,17 +28,12 @@ #include "flutter/shell/common/diagnostic/diagnostic_server.h" #include "flutter/skia/ext/event_tracer_impl.h" #include "lib/ftl/files/unique_fd.h" -#include "mojo/message_pump/message_pump_mojo.h" namespace shell { namespace { static Shell* g_shell = nullptr; -scoped_ptr CreateMessagePumpMojo() { - return make_scoped_ptr(new mojo::common::MessagePumpMojo); -} - bool IsInvalid(const ftl::WeakPtr& rasterizer) { return !rasterizer; } @@ -82,7 +77,6 @@ Shell::Shell() { DCHECK(!g_shell); base::Thread::Options options; - options.message_pump_factory = base::Bind(&CreateMessagePumpMojo); gpu_thread_.reset(new base::Thread("gpu_thread")); gpu_thread_->StartWithOptions(options); diff --git a/shell/platform/android/BUILD.gn b/shell/platform/android/BUILD.gn index 6d5a9f79776..95d0032296c 100644 --- a/shell/platform/android/BUILD.gn +++ b/shell/platform/android/BUILD.gn @@ -50,8 +50,6 @@ shared_library("sky_shell") { "//flutter/skia", "//flutter/vulkan", "//lib/ftl", - "//mojo/edk/base_edk", - "//mojo/edk/system", ":jni_headers", ] diff --git a/shell/platform/android/flutter_main.cc b/shell/platform/android/flutter_main.cc index 2a790002d75..8b733731f88 100644 --- a/shell/platform/android/flutter_main.cc +++ b/shell/platform/android/flutter_main.cc @@ -24,8 +24,6 @@ #include "flutter/shell/common/shell.h" #include "jni/FlutterMain_jni.h" #include "lib/ftl/macros.h" -#include "mojo/edk/embedder/embedder.h" -#include "mojo/edk/embedder/simple_platform_support.h" using base::LazyInstance; @@ -78,8 +76,6 @@ static void Init(JNIEnv* env, g_java_message_loop.Get().reset(new base::MessageLoopForUI); base::MessageLoopForUI::current()->Start(); - mojo::embedder::Init(mojo::embedder::CreateSimplePlatformSupport()); - Shell::InitStandalone(); InitializeTracing(); diff --git a/shell/platform/darwin/common/BUILD.gn b/shell/platform/darwin/common/BUILD.gn index e75343c181c..9e6ae40fd5c 100644 --- a/shell/platform/darwin/common/BUILD.gn +++ b/shell/platform/darwin/common/BUILD.gn @@ -26,7 +26,5 @@ source_set("common") { "//flutter/skia", "//flutter/sky/engine/wtf", "//lib/ftl", - "//mojo/edk/base_edk", - "//mojo/edk/system", ] } diff --git a/shell/platform/darwin/common/platform_mac.mm b/shell/platform/darwin/common/platform_mac.mm index 39c8934b5ef..c60460df392 100644 --- a/shell/platform/darwin/common/platform_mac.mm +++ b/shell/platform/darwin/common/platform_mac.mm @@ -23,8 +23,6 @@ #include "flutter/shell/common/switches.h" #include "flutter/shell/common/tracing_controller.h" #include "flutter/sky/engine/wtf/MakeUnique.h" -#include "mojo/edk/embedder/embedder.h" -#include "mojo/edk/embedder/simple_platform_support.h" namespace shell { @@ -92,8 +90,6 @@ class EmbedderState { embedder_message_loop_->Attach(); #endif - mojo::embedder::Init(mojo::embedder::CreateSimplePlatformSupport()); - shell::Shell::InitStandalone(icu_data_path); } diff --git a/shell/platform/darwin/ios/BUILD.gn b/shell/platform/darwin/ios/BUILD.gn index 319f7cf1623..3a7d33d9f29 100644 --- a/shell/platform/darwin/ios/BUILD.gn +++ b/shell/platform/darwin/ios/BUILD.gn @@ -61,8 +61,6 @@ shared_library("flutter_framework_dylib") { "//flutter/sky/engine/platform", "//flutter/sky/engine/wtf", "//lib/ftl", - "//mojo/edk/base_edk", - "//mojo/edk/system", ] defines = [ diff --git a/shell/platform/linux/BUILD.gn b/shell/platform/linux/BUILD.gn index 3a1d8fbda35..3f5785fbbd6 100644 --- a/shell/platform/linux/BUILD.gn +++ b/shell/platform/linux/BUILD.gn @@ -21,8 +21,6 @@ executable("linux") { "//flutter/shell/testing", "//flutter/skia", "//lib/ftl", - "//mojo/edk/base_edk", - "//mojo/edk/system", "//third_party/glfw", ] diff --git a/shell/platform/linux/main_linux.cc b/shell/platform/linux/main_linux.cc index b7599ec0072..9abeb93421a 100644 --- a/shell/platform/linux/main_linux.cc +++ b/shell/platform/linux/main_linux.cc @@ -15,15 +15,12 @@ #include "flutter/shell/platform/linux/message_pump_glfw.h" #include "flutter/shell/platform/linux/platform_view_glfw.h" #include "flutter/shell/testing/testing.h" -#include "mojo/edk/embedder/embedder.h" -#include "mojo/edk/embedder/simple_platform_support.h" namespace { int RunNonInteractive() { base::MessageLoop message_loop; - mojo::embedder::Init(mojo::embedder::CreateSimplePlatformSupport()); shell::Shell::InitStandalone(); if (!shell::InitForTesting()) { @@ -45,7 +42,6 @@ int RunInteractive() { base::MessageLoop message_loop(shell::MessagePumpGLFW::Create()); - mojo::embedder::Init(mojo::embedder::CreateSimplePlatformSupport()); shell::Shell::InitStandalone(); std::string target = command_line.GetSwitchValueASCII(shell::switches::kFLX); diff --git a/sky/engine/web/BUILD.gn b/sky/engine/web/BUILD.gn index 7db498a388e..db4122a0f20 100644 --- a/sky/engine/web/BUILD.gn +++ b/sky/engine/web/BUILD.gn @@ -22,9 +22,5 @@ source_set("web") { deps += [ "//lib/mtl/tasks", ] - } else { - deps += [ - "//mojo/message_pump", - ] } } diff --git a/sky/engine/web/Sky.cpp b/sky/engine/web/Sky.cpp index 0ebdfbb086b..2f2f3e177ae 100644 --- a/sky/engine/web/Sky.cpp +++ b/sky/engine/web/Sky.cpp @@ -48,7 +48,6 @@ #else // defined(OS_FUCHSIA) #include "base/message_loop/message_loop.h" -#include "mojo/message_pump/message_pump_mojo.h" #endif // defined(OS_FUCHSIA) @@ -81,37 +80,21 @@ class TaskObserver : public base::MessageLoop::TaskObserver { } }; -class SignalObserver : public mojo::common::MessagePumpMojo::Observer { - public: - void WillSignalHandler() override {} - void DidSignalHandler() override { didProcessTask(); } -}; - static TaskObserver* s_taskObserver = 0; -static SignalObserver* s_signalObserver = 0; void addMessageLoopObservers() { ASSERT(!s_taskObserver); s_taskObserver = new TaskObserver; - ASSERT(!s_signalObserver); - s_signalObserver = new SignalObserver; - base::MessageLoop::current()->AddTaskObserver(s_taskObserver); - mojo::common::MessagePumpMojo::current()->AddObserver(s_signalObserver); } void removeMessageLoopObservers() { base::MessageLoop::current()->RemoveTaskObserver(s_taskObserver); - mojo::common::MessagePumpMojo::current()->RemoveObserver(s_signalObserver); ASSERT(s_taskObserver); delete s_taskObserver; s_taskObserver = 0; - - ASSERT(s_signalObserver); - delete s_signalObserver; - s_signalObserver = 0; } #endif // defined(OS_FUCHSIA) diff --git a/sky/engine/wtf/BUILD.gn b/sky/engine/wtf/BUILD.gn index a3efa03fb2e..3b07f3ef054 100644 --- a/sky/engine/wtf/BUILD.gn +++ b/sky/engine/wtf/BUILD.gn @@ -256,15 +256,7 @@ executable("unittests") { ] if (is_fuchsia) { + # TODO(abarth): This shouldn't be necessary. deps += [ "//mojo/system" ] - } else { - # TODO(abarth): This is a lie - this test is not embedded in an environment - # that injects the system thunks, so system calls don't actually work. This - # just tricks the linker into thinking that an implementation of these calls - # will be injected at runtime so the link succeeds. - deps += [ - "//mojo/public/cpp/environment:standalone", - "//mojo/public/platform/native:system", - ] } } diff --git a/sky/packages/sky_engine/BUILD.gn b/sky/packages/sky_engine/BUILD.gn index 53981238ed6..969168d4743 100644 --- a/sky/packages/sky_engine/BUILD.gn +++ b/sky/packages/sky_engine/BUILD.gn @@ -5,8 +5,8 @@ import("//dart/sdk/lib/rules.gni") import("//flutter/lib/jni/dart_jni.gni") import("//flutter/lib/ui/dart_ui.gni") -import("//mojo/public/dart/rules.gni") import("//flutter/sky/engine/core/core.gni") +import("//mojo/public/dart/rules.gni") copy("copy_sky_engine_authors") { sources = [ diff --git a/sky/packages/sky_services/BUILD.gn b/sky/packages/sky_services/BUILD.gn index 847d533274d..d51dd3604a0 100644 --- a/sky/packages/sky_services/BUILD.gn +++ b/sky/packages/sky_services/BUILD.gn @@ -23,6 +23,5 @@ dart_pkg("sky_services") { deps = [ ":copy_sky_services_license", - "//flutter/services/platform:interfaces", ] } diff --git a/sky/packages/sky_services/README.md b/sky/packages/sky_services/README.md index bc21610ce6a..350846c272a 100644 --- a/sky/packages/sky_services/README.md +++ b/sky/packages/sky_services/README.md @@ -1,6 +1,4 @@ Flutter Services ================ -This packages contains `mojom` interfaces to services associated with Flutter. Most -developers should depend on the [Flutter package](http://docs.flutter.io/flutter/services/services-library.html) -instead of using this package directly. +This packages is empty. \ No newline at end of file diff --git a/sky/packages/sky_services/pubspec.yaml b/sky/packages/sky_services/pubspec.yaml index d1ff625eae7..a6ff01e596d 100644 --- a/sky/packages/sky_services/pubspec.yaml +++ b/sky/packages/sky_services/pubspec.yaml @@ -1,9 +1,7 @@ name: sky_services version: 0.0.99 author: Flutter Authors -description: Mojom interfaces associated with Flutter +description: An empty package homepage: http://flutter.io -dependencies: - mojo_sdk: 0.2.31 environment: sdk: '>=1.8.0 <2.0.0' diff --git a/travis/analyze.sh b/travis/analyze.sh index 49ba9e989c3..096d96ef9f2 100755 --- a/travis/analyze.sh +++ b/travis/analyze.sh @@ -12,13 +12,10 @@ RESULTS=`dartanalyzer \ --lints \ out/host_debug_unopt/gen/sky/bindings/dart_ui/ui.dart \ 2>&1 \ - | grep -v "\[error\] Target of URI does not exist: 'dart:mojo.internal'" \ | grep -v "\[error\] Native functions can only be declared in the SDK and code that is loaded through native extensions" \ | grep -Ev "\[(hint|error)\] The function '.+' is not used" \ | grep -Ev "\[(warning|error)\] Undefined name 'main'" \ | grep -Ev "\[(warning|error)\] Undefined name 'VMLibraryHooks" \ - | grep -Ev "\[(warning|error)\] Undefined name 'MojoHandleWatcher'" \ - | grep -Ev "\[(warning|error)\] Undefined name 'MojoCoreNatives'" \ | grep -v "\[error\] The library ''dart:_internal'' is internal" \ | grep -Ev "Unused import .+ui\.dart" \ | grep -v "\[info\] TODO" \