Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.
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
17 changes: 17 additions & 0 deletions BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,20 @@ config("config") {
}
}

# This "fuchsia_legacy" configuration includes old, non-embedder API sources and
# defines the LEGACY_FUCHSIA_EMBEDDER symbol. This config and its associated
# template are both transitional and will be removed after the embedder API
# transition is complete.
#
# See `source_set_maybe_fuchsia_legacy` in //flutter/common/config.gni
#
# TODO(fxb/54041): Remove when no longer neccesary.
config("fuchsia_legacy") {
if (is_fuchsia) {
defines = [ "LEGACY_FUCHSIA_EMBEDDER" ]
}
}

config("export_dynamic_symbols") {
if (is_linux || is_fuchsia) {
inputs = [
Expand All @@ -151,9 +165,12 @@ if (is_fuchsia) {

deps = [
"//flutter/flow:flow_tests",
"//flutter/flow:flow_tests_next",
"//flutter/fml:fml_tests",
"//flutter/runtime:runtime_tests",
"//flutter/runtime:runtime_tests_next",
"//flutter/shell/common:shell_tests",
"//flutter/shell/common:shell_tests_next",
"//flutter/shell/platform/fuchsia/flutter:flutter_runner_scenic_tests",
"//flutter/shell/platform/fuchsia/flutter:flutter_runner_tests",
]
Expand Down
116 changes: 116 additions & 0 deletions common/config.gni
Original file line number Diff line number Diff line change
Expand Up @@ -76,3 +76,119 @@ if (is_ios || is_mac) {
]
flutter_cflags_objcc = flutter_cflags_objc
}

# This template creates a `source_set` in both standard and "fuchsia_legacy"
# configurations.
#
# The "fuchsia_legacy" configuration includes old, non-embedder API sources and
# defines the LEGACY_FUCHSIA_EMBEDDER symbol. This template and the config
# are both transitional and will be removed after the embedder API transition
# is complete.
# TODO(fxb/54041): Remove when no longer neccesary.
#
# `sources`, `defines`, `public_configs`, `configs`, `public_deps`, `deps` work
# as they do in a normal `source_set`.
#
# `legacy_deps` is the list of dependencies which should be mutated by
# appending '_fuchsia_legacy' when creating the 2 `source_set`'s. The template adds
# `legacy_deps` to `public_deps`, whether it mutates them or not.
template("source_set_maybe_fuchsia_legacy") {
public_deps_non_legacy = []
deps_non_legacy = []
if (defined(invoker.public_deps)) {
public_deps_non_legacy += invoker.public_deps
}
if (defined(invoker.deps)) {
deps_non_legacy += invoker.deps
}
if (defined(invoker.public_deps_legacy_and_next)) {
foreach(legacy_dep, invoker.public_deps_legacy_and_next) {
public_deps_non_legacy += [ legacy_dep ]
}
}
if (defined(invoker.deps_legacy_and_next)) {
foreach(legacy_dep, invoker.deps_legacy_and_next) {
deps_non_legacy += [ legacy_dep ]
}
}

source_set(target_name) {
forward_variables_from(invoker,
[
"testonly",
"sources",
"defines",
"public_configs",
"configs",
])
public_deps = public_deps_non_legacy
deps = deps_non_legacy
}

if (is_fuchsia) {
legagcy_suffix = "_fuchsia_legacy"

sources_legacy = []
if (defined(invoker.sources_legacy)) {
sources_legacy += invoker.sources_legacy
}
if (defined(invoker.sources)) {
sources_legacy += invoker.sources
}

public_configs_legacy = [ "//flutter:fuchsia_legacy" ]
if (defined(invoker.public_configs)) {
public_configs_legacy += invoker.public_configs
}

public_deps_legacy = []
deps_legacy = []
if (defined(invoker.public_deps)) {
public_deps_legacy += invoker.public_deps
}
if (defined(invoker.deps)) {
deps_legacy += invoker.deps
}
if (defined(invoker.public_deps_legacy)) {
public_deps_legacy += invoker.public_deps_legacy
}
if (defined(invoker.deps_legacy)) {
deps_legacy += invoker.deps_legacy
}
if (defined(invoker.public_deps_legacy_and_next)) {
foreach(legacy_dep, invoker.public_deps_legacy_and_next) {
public_deps_legacy += [ legacy_dep + legagcy_suffix ]
}
}
if (defined(invoker.deps_legacy_and_next)) {
foreach(legacy_dep, invoker.deps_legacy_and_next) {
deps_legacy += [ legacy_dep + legagcy_suffix ]
}
}

source_set(target_name + legagcy_suffix) {
forward_variables_from(invoker,
[
"testonly",
"defines",
"configs",
])
sources = sources_legacy

public_configs = public_configs_legacy

public_deps = public_deps_legacy
deps = deps_legacy
}
} else {
if (defined(invoker.sources_legacy)) {
not_needed(invoker, [ "sources_legacy" ])
}
if (defined(invoker.public_deps_legacy)) {
not_needed(invoker, [ "public_deps_legacy" ])
}
if (defined(invoker.deps_legacy)) {
not_needed(invoker, [ "deps_legacy" ])
}
}
}
117 changes: 87 additions & 30 deletions flow/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

import("//flutter/common/config.gni")
import("//flutter/testing/testing.gni")
if (is_fuchsia) {
import("//build/fuchsia/sdk.gni")
import("//flutter/tools/fuchsia/fuchsia_archive.gni")
}
import("//flutter/testing/testing.gni")

source_set("flow") {
source_set_maybe_fuchsia_legacy("flow") {
sources = [
"compositor_context.cc",
"compositor_context.h",
Expand Down Expand Up @@ -74,37 +75,33 @@ source_set("flow") {

public_configs = [ "//flutter:config" ]

public_deps = []

deps = [
"//flutter/common",
"//flutter/fml",
"//third_party/skia",
]

if (is_fuchsia) {
sources += [
"layers/child_scene_layer.cc",
"layers/child_scene_layer.h",
"scene_update_context.cc",
"scene_update_context.h",
"view_holder.cc",
"view_holder.h",
]
sources_legacy = [
"layers/child_scene_layer.cc",
"layers/child_scene_layer.h",
"scene_update_context.cc",
"scene_update_context.h",
"view_holder.cc",
"view_holder.h",
]

public_deps += [
"$fuchsia_sdk_root/fidl:fuchsia.ui.app",
"$fuchsia_sdk_root/fidl:fuchsia.ui.gfx",
"$fuchsia_sdk_root/pkg:scenic_cpp",
]
}
public_deps_legacy = [
"$fuchsia_sdk_root/fidl:fuchsia.ui.app",
"$fuchsia_sdk_root/fidl:fuchsia.ui.gfx",
"$fuchsia_sdk_root/pkg:scenic_cpp",
]
}

test_fixtures("flow_fixtures") {
fixtures = []
}

source_set("flow_testing") {
source_set_maybe_fuchsia_legacy("flow_testing") {
testonly = true

sources = [
Expand All @@ -113,20 +110,23 @@ source_set("flow_testing") {
"testing/layer_test.h",
"testing/mock_layer.cc",
"testing/mock_layer.h",
"testing/mock_raster_cache.cc",
"testing/mock_raster_cache.h",
"testing/mock_texture.cc",
"testing/mock_texture.h",
"testing/skia_gpu_object_layer_test.cc",
"testing/skia_gpu_object_layer_test.h",
]

public_deps = [
":flow",
"//flutter/testing:skia",
"//third_party/googletest:gtest",
]

deps_legacy_and_next = [ ":flow" ]
}

executable("flow_unittests") {
source_set_maybe_fuchsia_legacy("flow_unittests_common") {
testonly = true

sources = [
Expand Down Expand Up @@ -161,14 +161,8 @@ executable("flow_unittests") {
"texture_unittests.cc",
]

if (is_fuchsia) {
sources += [ "layers/fuchsia_layer_unittests.cc" ]
}

deps = [
":flow",
":flow_fixtures",
":flow_testing",
"//flutter/fml",
"//flutter/testing:skia",
"//flutter/testing:testing_lib",
Expand All @@ -177,8 +171,38 @@ executable("flow_unittests") {
"//third_party/skia",
]

if (is_fuchsia) {
deps += [ "//build/fuchsia/pkg:sys_cpp_testing" ]
sources_legacy = [ "layers/fuchsia_layer_unittests.cc" ]

deps_legacy = [ "//build/fuchsia/pkg:sys_cpp_testing" ]

deps_legacy_and_next = [
":flow",
":flow_testing",
]
}

if (is_fuchsia) {
executable("flow_unittests") {
testonly = true

deps = [
":flow_unittests_common_fuchsia_legacy",
]
}
executable("flow_unittests_next") {
testonly = true

deps = [
":flow_unittests_common",
]
}
} else {
executable("flow_unittests") {
testonly = true

deps = [
":flow_unittests_common",
]
}
}

Expand Down Expand Up @@ -215,4 +239,37 @@ if (is_fuchsia) {
},
]
}

fuchsia_archive("flow_tests_next") {
testonly = true

deps = [
":flow_unittests_next",
]

binary = "flow_unittests_next"

libraries = common_libs

meta_dir = "//flutter/testing/fuchsia/meta"
cmx_file = "$meta_dir/fuchsia_test.cmx"

resources = [
{
path = rebase_path(
"//flutter/testing/resources/performance_overlay_gold_60fps.png")
dest = "flutter/testing/resources/performance_overlay_gold_60fps.png"
},
{
path = rebase_path(
"//flutter/testing/resources/performance_overlay_gold_90fps.png")
dest = "flutter/testing/resources/performance_overlay_gold_90fps.png"
},
{
path = rebase_path(
"//flutter/testing/resources/performance_overlay_gold_120fps.png")
dest = "flutter/testing/resources/performance_overlay_gold_120fps.png"
},
]
}
}
2 changes: 1 addition & 1 deletion flow/compositor_context.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#include "flutter/fml/macros.h"
#include "flutter/fml/raster_thread_merger.h"
#include "third_party/skia/include/core/SkCanvas.h"
#include "third_party/skia/include/core/SkPictureRecorder.h"
#include "third_party/skia/include/gpu/GrContext.h"

namespace flutter {

Expand Down
8 changes: 4 additions & 4 deletions flow/layers/clip_path_layer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@

#include "flutter/flow/layers/clip_path_layer.h"

#if defined(OS_FUCHSIA)
#if defined(LEGACY_FUCHSIA_EMBEDDER)

#include "lib/ui/scenic/cpp/commands.h"

#endif // defined(OS_FUCHSIA)
#endif

namespace flutter {

Expand Down Expand Up @@ -40,7 +40,7 @@ void ClipPathLayer::Preroll(PrerollContext* context, const SkMatrix& matrix) {
context->cull_rect = previous_cull_rect;
}

#if defined(OS_FUCHSIA)
#if defined(LEGACY_FUCHSIA_EMBEDDER)

void ClipPathLayer::UpdateScene(SceneUpdateContext& context) {
TRACE_EVENT0("flutter", "ClipPathLayer::UpdateScene");
Expand All @@ -51,7 +51,7 @@ void ClipPathLayer::UpdateScene(SceneUpdateContext& context) {
UpdateSceneChildren(context);
}

#endif // defined(OS_FUCHSIA)
#endif

void ClipPathLayer::Paint(PaintContext& context) const {
TRACE_EVENT0("flutter", "ClipPathLayer::Paint");
Expand Down
4 changes: 2 additions & 2 deletions flow/layers/clip_path_layer.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ class ClipPathLayer : public ContainerLayer {
return clip_behavior_ == Clip::antiAliasWithSaveLayer;
}

#if defined(OS_FUCHSIA)
#if defined(LEGACY_FUCHSIA_EMBEDDER)
void UpdateScene(SceneUpdateContext& context) override;
#endif // defined(OS_FUCHSIA)
#endif

private:
SkPath clip_path_;
Expand Down
Loading