Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a proc table version of embedder API #21813

Merged
merged 9 commits into from
Oct 29, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ group("flutter") {
"//flutter/lib/ui:ui_unittests",
"//flutter/runtime:runtime_unittests",
"//flutter/shell/common:shell_unittests",
"//flutter/shell/platform/embedder:embedder_proctable_unittests",
"//flutter/shell/platform/embedder:embedder_unittests",
"//flutter/testing:testing_unittests",
"//flutter/third_party/txt:txt_unittests",
Expand Down
3 changes: 2 additions & 1 deletion ci/licenses_golden/licenses_flutter
Original file line number Diff line number Diff line change
Expand Up @@ -1086,7 +1086,7 @@ FILE: ../../../flutter/shell/platform/embedder/embedder_render_target.cc
FILE: ../../../flutter/shell/platform/embedder/embedder_render_target.h
FILE: ../../../flutter/shell/platform/embedder/embedder_render_target_cache.cc
FILE: ../../../flutter/shell/platform/embedder/embedder_render_target_cache.h
FILE: ../../../flutter/shell/platform/embedder/embedder_safe_access.h
FILE: ../../../flutter/shell/platform/embedder/embedder_struct_macros.h
FILE: ../../../flutter/shell/platform/embedder/embedder_surface.cc
FILE: ../../../flutter/shell/platform/embedder/embedder_surface.h
FILE: ../../../flutter/shell/platform/embedder/embedder_surface_gl.cc
Expand Down Expand Up @@ -1114,6 +1114,7 @@ FILE: ../../../flutter/shell/platform/embedder/fixtures/verifyb143464703.png
FILE: ../../../flutter/shell/platform/embedder/fixtures/verifyb143464703_soft_noxform.png
FILE: ../../../flutter/shell/platform/embedder/platform_view_embedder.cc
FILE: ../../../flutter/shell/platform/embedder/platform_view_embedder.h
FILE: ../../../flutter/shell/platform/embedder/test_utils/proc_table_replacement.h
FILE: ../../../flutter/shell/platform/embedder/vsync_waiter_embedder.cc
FILE: ../../../flutter/shell/platform/embedder/vsync_waiter_embedder.h
FILE: ../../../flutter/shell/platform/fuchsia/dart-pkg/fuchsia/lib/fuchsia.dart
Expand Down
37 changes: 36 additions & 1 deletion shell/platform/embedder/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ template("embedder_source_set") {
"embedder_render_target.h",
"embedder_render_target_cache.cc",
"embedder_render_target_cache.h",
"embedder_safe_access.h",
"embedder_struct_macros.h",
"embedder_surface.cc",
"embedder_surface.h",
"embedder_surface_software.cc",
Expand Down Expand Up @@ -110,6 +110,14 @@ source_set("embedder_headers") {
public_configs = [ "//flutter:config" ]
}

source_set("embedder_test_utils") {
public = [ "test_utils/proc_table_replacement.h" ]

deps = [ ":embedder_headers" ]

public_configs = [ "//flutter:config" ]
}

# For using the embedder API as internal implementation detail of an
# embedding.
config("embedder_internal_library_config") {
Expand Down Expand Up @@ -200,6 +208,33 @@ if (enable_unittests) {
deps += [ "//flutter/testing:opengl" ]
}
}

# Tests the build in FLUTTER_ENGINE_NO_PROTOTYPES mode.
executable("embedder_proctable_unittests") {
testonly = true

configs += [
":embedder_gpu_configuration_config",
"//flutter:export_dynamic_symbols",
]

sources = [ "tests/embedder_unittests_proctable.cc" ]

defines = [ "FLUTTER_ENGINE_NO_PROTOTYPES" ]

deps = [
":embedder",
":embedder_gpu_configuration",
":fixtures",
"//flutter/testing",

#"//flutter/testing:dart",
#"//flutter/testing:skia",
#"//flutter/third_party/tonic",
#"//third_party/dart/runtime/bin:elf_loader",
#"//third_party/skia",
]
}
}

shared_library("flutter_engine_library") {
Expand Down
56 changes: 55 additions & 1 deletion shell/platform/embedder/embedder.cc
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ extern const intptr_t kPlatformStrongDillSize;
#include "flutter/shell/platform/embedder/embedder_engine.h"
#include "flutter/shell/platform/embedder/embedder_platform_message_response.h"
#include "flutter/shell/platform/embedder/embedder_render_target.h"
#include "flutter/shell/platform/embedder/embedder_safe_access.h"
#include "flutter/shell/platform/embedder/embedder_struct_macros.h"
#include "flutter/shell/platform/embedder/embedder_task_runner.h"
#include "flutter/shell/platform/embedder/embedder_thread_host.h"
#include "flutter/shell/platform/embedder/platform_view_embedder.h"
Expand Down Expand Up @@ -2048,3 +2048,57 @@ FlutterEngineResult FlutterEngineNotifyDisplayUpdate(
"Invalid FlutterEngineDisplaysUpdateType type specified.");
}
}

FlutterEngineResult FlutterEngineGetProcAddresses(
stuartmorgan marked this conversation as resolved.
Show resolved Hide resolved
FlutterEngineProcTable* table) {
if (!table) {
return LOG_EMBEDDER_ERROR(kInvalidArguments, "Null table specified.");
}
#define SET_PROC(member, function) \
if (STRUCT_HAS_MEMBER(table, member)) { \
table->member = &function; \
}

SET_PROC(CreateAOTData, FlutterEngineCreateAOTData);
SET_PROC(CollectAOTData, FlutterEngineCollectAOTData);
SET_PROC(Run, FlutterEngineRun);
SET_PROC(Shutdown, FlutterEngineShutdown);
SET_PROC(Initialize, FlutterEngineInitialize);
SET_PROC(Deinitialize, FlutterEngineDeinitialize);
SET_PROC(RunInitialized, FlutterEngineRunInitialized);
SET_PROC(SendWindowMetricsEvent, FlutterEngineSendWindowMetricsEvent);
SET_PROC(SendPointerEvent, FlutterEngineSendPointerEvent);
SET_PROC(SendPlatformMessage, FlutterEngineSendPlatformMessage);
SET_PROC(PlatformMessageCreateResponseHandle,
FlutterPlatformMessageCreateResponseHandle);
SET_PROC(PlatformMessageReleaseResponseHandle,
FlutterPlatformMessageReleaseResponseHandle);
SET_PROC(SendPlatformMessageResponse,
FlutterEngineSendPlatformMessageResponse);
SET_PROC(RegisterExternalTexture, FlutterEngineRegisterExternalTexture);
SET_PROC(UnregisterExternalTexture, FlutterEngineUnregisterExternalTexture);
SET_PROC(MarkExternalTextureFrameAvailable,
FlutterEngineMarkExternalTextureFrameAvailable);
SET_PROC(UpdateSemanticsEnabled, FlutterEngineUpdateSemanticsEnabled);
SET_PROC(UpdateAccessibilityFeatures,
FlutterEngineUpdateAccessibilityFeatures);
SET_PROC(DispatchSemanticsAction, FlutterEngineDispatchSemanticsAction);
SET_PROC(OnVsync, FlutterEngineOnVsync);
SET_PROC(ReloadSystemFonts, FlutterEngineReloadSystemFonts);
SET_PROC(TraceEventDurationBegin, FlutterEngineTraceEventDurationBegin);
SET_PROC(TraceEventDurationEnd, FlutterEngineTraceEventDurationEnd);
SET_PROC(TraceEventInstant, FlutterEngineTraceEventInstant);
SET_PROC(PostRenderThreadTask, FlutterEnginePostRenderThreadTask);
SET_PROC(GetCurrentTime, FlutterEngineGetCurrentTime);
SET_PROC(RunTask, FlutterEngineRunTask);
SET_PROC(UpdateLocales, FlutterEngineUpdateLocales);
SET_PROC(RunsAOTCompiledDartCode, FlutterEngineRunsAOTCompiledDartCode);
SET_PROC(PostDartObject, FlutterEnginePostDartObject);
SET_PROC(NotifyLowMemoryWarning, FlutterEngineNotifyLowMemoryWarning);
SET_PROC(PostCallbackOnAllNativeThreads,
FlutterEnginePostCallbackOnAllNativeThreads);
SET_PROC(NotifyDisplayUpdate, FlutterEngineNotifyDisplayUpdate);
#undef SET_PROC

return kSuccess;
}
Loading