mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
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.
This commit is contained in:
parent
c5c69a2462
commit
63e71803de
@ -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 = [
|
||||
|
||||
@ -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 <utility>
|
||||
|
||||
namespace glue {
|
||||
|
||||
template <typename T>
|
||||
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 <typename T>
|
||||
MovableWrapper<T> WrapMovable(T object) {
|
||||
return MovableWrapper<T>(std::move(object));
|
||||
}
|
||||
|
||||
} // namespace glue
|
||||
|
||||
#endif // FLUTTER_GLU_MOVABLE_WRAPPER_H_
|
||||
@ -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",
|
||||
]
|
||||
}
|
||||
}
|
||||
@ -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
|
||||
@ -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_
|
||||
@ -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",
|
||||
]
|
||||
|
||||
@ -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';
|
||||
|
||||
@ -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") {
|
||||
|
||||
@ -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) {
|
||||
|
||||
@ -28,9 +28,6 @@ Future<developer.ServiceExtensionResponse> _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);
|
||||
|
||||
@ -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<SkImage> image,
|
||||
}
|
||||
|
||||
void DecodeImageAndInvokeImageCallback(
|
||||
glue::MovableWrapper<std::unique_ptr<DartPersistentValue>> callback,
|
||||
std::unique_ptr<DartPersistentValue> callback,
|
||||
std::vector<uint8_t> buffer) {
|
||||
sk_sp<SkImage> 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<DartPersistentValue>(
|
||||
new DartPersistentValue(tonic::DartState::Current(), callback_handle)));
|
||||
|
||||
const uint8_t* bytes = reinterpret_cast<const uint8_t*>(list.data());
|
||||
std::vector<uint8_t> 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<DartPersistentValue>(
|
||||
tonic::DartState::Current(), callback_handle),
|
||||
buffer = std::move(buffer)
|
||||
]() mutable {
|
||||
DecodeImageAndInvokeImageCallback(std::move(callback), std::move(buffer));
|
||||
}));
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
@ -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';
|
||||
|
||||
|
||||
@ -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",
|
||||
]
|
||||
|
||||
|
||||
@ -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<uint8_t*>(DART_SYMBOL(kIsolateSnapshot)),
|
||||
nullptr, static_cast<tonic::DartState*>(state.get()), &error);
|
||||
reinterpret_cast<uint8_t*>(DART_SYMBOL(kIsolateSnapshot)), nullptr,
|
||||
static_cast<tonic::DartState*>(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<tonic::DartClassProvider> ui_class_provider(
|
||||
|
||||
@ -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<DartClassProvider> ui_class_provider(
|
||||
@ -582,9 +578,6 @@ void InitDartVM() {
|
||||
}
|
||||
}
|
||||
|
||||
DartMojoInternal::SetHandleWatcherProducerHandle(
|
||||
mojo::dart::HandleWatcher::Start());
|
||||
|
||||
std::vector<const char*> args;
|
||||
|
||||
// Instruct the VM to ignore unrecognized flags.
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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
|
||||
|
||||
@ -10,7 +10,7 @@
|
||||
|
||||
namespace blink {
|
||||
|
||||
using mojo::dart::ResourcesEntry;
|
||||
using flutter::runtime::ResourcesEntry;
|
||||
|
||||
EmbedderResources::EmbedderResources(ResourcesEntry* resources_table)
|
||||
: resources_table_(resources_table) {}
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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"
|
||||
]
|
||||
}
|
||||
@ -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);
|
||||
};
|
||||
@ -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",
|
||||
|
||||
@ -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 =
|
||||
|
||||
@ -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"
|
||||
|
||||
@ -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<base::MessagePump> CreateMessagePumpMojo() {
|
||||
return make_scoped_ptr(new mojo::common::MessagePumpMojo);
|
||||
}
|
||||
|
||||
bool IsInvalid(const ftl::WeakPtr<Rasterizer>& 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);
|
||||
|
||||
@ -50,8 +50,6 @@ shared_library("sky_shell") {
|
||||
"//flutter/skia",
|
||||
"//flutter/vulkan",
|
||||
"//lib/ftl",
|
||||
"//mojo/edk/base_edk",
|
||||
"//mojo/edk/system",
|
||||
":jni_headers",
|
||||
]
|
||||
|
||||
|
||||
@ -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();
|
||||
|
||||
@ -26,7 +26,5 @@ source_set("common") {
|
||||
"//flutter/skia",
|
||||
"//flutter/sky/engine/wtf",
|
||||
"//lib/ftl",
|
||||
"//mojo/edk/base_edk",
|
||||
"//mojo/edk/system",
|
||||
]
|
||||
}
|
||||
|
||||
@ -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);
|
||||
}
|
||||
|
||||
|
||||
@ -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 = [
|
||||
|
||||
@ -21,8 +21,6 @@ executable("linux") {
|
||||
"//flutter/shell/testing",
|
||||
"//flutter/skia",
|
||||
"//lib/ftl",
|
||||
"//mojo/edk/base_edk",
|
||||
"//mojo/edk/system",
|
||||
"//third_party/glfw",
|
||||
]
|
||||
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -22,9 +22,5 @@ source_set("web") {
|
||||
deps += [
|
||||
"//lib/mtl/tasks",
|
||||
]
|
||||
} else {
|
||||
deps += [
|
||||
"//mojo/message_pump",
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
@ -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)
|
||||
|
||||
@ -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",
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
@ -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 = [
|
||||
|
||||
@ -23,6 +23,5 @@ dart_pkg("sky_services") {
|
||||
|
||||
deps = [
|
||||
":copy_sky_services_license",
|
||||
"//flutter/services/platform:interfaces",
|
||||
]
|
||||
}
|
||||
|
||||
@ -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.
|
||||
@ -1,9 +1,7 @@
|
||||
name: sky_services
|
||||
version: 0.0.99
|
||||
author: Flutter Authors <flutter-dev@googlegroups.com>
|
||||
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'
|
||||
|
||||
@ -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" \
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user