From 6da61e7fd60b93da4e4ded2f78e1c1295a47deb6 Mon Sep 17 00:00:00 2001 From: Dan Field Date: Mon, 7 Mar 2022 17:52:30 -0800 Subject: [PATCH] Remove FML dependency on geometry, tessellator (#59) * Remove FML dependency on geometry, tessellator * update readme --- impeller/README.md | 4 +++- impeller/aiks/BUILD.gn | 8 ++++++++ impeller/archivist/BUILD.gn | 9 ++++++++- impeller/base/BUILD.gn | 8 ++++++++ impeller/base/config.h | 2 -- impeller/entity/BUILD.gn | 9 +++++++++ impeller/geometry/matrix_decomposition.h | 1 - impeller/geometry/path.cc | 3 --- impeller/geometry/path_builder.h | 4 ++-- impeller/geometry/scalar.h | 2 -- impeller/image/BUILD.gn | 11 +++++++++-- impeller/renderer/BUILD.gn | 8 ++++++++ impeller/tessellator/BUILD.gn | 1 - impeller/tessellator/tessellator.cc | 3 --- impeller/tools/impeller.gni | 7 ------- impeller/typographer/BUILD.gn | 8 ++++++++ 16 files changed, 63 insertions(+), 25 deletions(-) diff --git a/impeller/README.md b/impeller/README.md index 6c2980751a146..6e0ebe684573a 100644 --- a/impeller/README.md +++ b/impeller/README.md @@ -38,7 +38,9 @@ Impeller itself may not depend on anything in `//flutter` except `//flutter/fml` and `flutter/display_list`. FML is a base library for C++ projects and Impeller implements the display list dispatcher interface to make it easy for Flutter to swap the renderer with Impeller. Impeller is meant to be used by the Flow -(`//flutter/flow`) subsystem. Hence the name. +(`//flutter/flow`) subsystem. Hence the name. The tessellator and geometry +libraries are exceptions - they unconditionally may not depend on anything from +`//flutter`. An overview of the major sub-frameworks, their responsibilities, and, relative states of completion: diff --git a/impeller/aiks/BUILD.gn b/impeller/aiks/BUILD.gn index 8f7df7aa66a46..db0e733258490 100644 --- a/impeller/aiks/BUILD.gn +++ b/impeller/aiks/BUILD.gn @@ -27,6 +27,14 @@ impeller_component("aiks") { "../entity", "../geometry", ] + + deps = [ + "//flutter/fml", + + # FML depends on the Dart VM for tracing and getting the current + # timepoint. + "//flutter/runtime:libdart", + ] } impeller_component("aiks_unittests") { diff --git a/impeller/archivist/BUILD.gn b/impeller/archivist/BUILD.gn index 3d3fce98e2264..ab25781748c45 100644 --- a/impeller/archivist/BUILD.gn +++ b/impeller/archivist/BUILD.gn @@ -31,7 +31,14 @@ impeller_component("archivist") { public_deps = [ "../base" ] - deps = [ "//third_party/sqlite" ] + deps = [ + "//flutter/fml", + + # FML depends on the Dart VM for tracing and getting the current + # timepoint. + "//flutter/runtime:libdart", + "//third_party/sqlite", + ] } impeller_component("archivist_unittests") { diff --git a/impeller/base/BUILD.gn b/impeller/base/BUILD.gn index 0a4ba5fcec5f4..489459bc5fc4d 100644 --- a/impeller/base/BUILD.gn +++ b/impeller/base/BUILD.gn @@ -18,6 +18,14 @@ impeller_component("base") { "validation.cc", "validation.h", ] + + deps = [ + "//flutter/fml", + + # FML depends on the Dart VM for tracing and getting the current + # timepoint. + "//flutter/runtime:libdart", + ] } impeller_component("base_unittests") { diff --git a/impeller/base/config.h b/impeller/base/config.h index c0077d983b892..a0750d5db17fe 100644 --- a/impeller/base/config.h +++ b/impeller/base/config.h @@ -4,8 +4,6 @@ #pragma once -#include "flutter/fml/build_config.h" - #if defined(__GNUC__) || defined(__clang__) #define IMPELLER_COMPILER_CLANG 1 #else // defined(__GNUC__) || defined(__clang__) diff --git a/impeller/entity/BUILD.gn b/impeller/entity/BUILD.gn index 0181edfd2c34f..e069fdde3cf0a 100644 --- a/impeller/entity/BUILD.gn +++ b/impeller/entity/BUILD.gn @@ -54,6 +54,15 @@ impeller_component("entity") { "../renderer", "../typographer", ] + + + deps = [ + "//flutter/fml", + + # FML depends on the Dart VM for tracing and getting the current + # timepoint. + "//flutter/runtime:libdart", + ] } impeller_component("entity_unittests") { diff --git a/impeller/geometry/matrix_decomposition.h b/impeller/geometry/matrix_decomposition.h index def9029ea7369..31c01ec5c6266 100644 --- a/impeller/geometry/matrix_decomposition.h +++ b/impeller/geometry/matrix_decomposition.h @@ -4,7 +4,6 @@ #pragma once -#include "flutter/fml/macros.h" #include "impeller/geometry/quaternion.h" #include "impeller/geometry/scalar.h" #include "impeller/geometry/shear.h" diff --git a/impeller/geometry/path.cc b/impeller/geometry/path.cc index 3a31ac61b96d7..981969461709d 100644 --- a/impeller/geometry/path.cc +++ b/impeller/geometry/path.cc @@ -6,7 +6,6 @@ #include -#include "flutter/fml/logging.h" #include "impeller/geometry/path_component.h" namespace impeller { @@ -19,8 +18,6 @@ Path::~Path() = default; std::tuple Path::Polyline::GetContourPointBounds( size_t contour_index) const { - FML_DCHECK(contour_index < contours.size()); - const size_t start_index = contours[contour_index].start_index; const size_t end_index = (contour_index >= contours.size() - 1) ? points.size() diff --git a/impeller/geometry/path_builder.h b/impeller/geometry/path_builder.h index 3c495e4f872a6..038a9f49f3219 100644 --- a/impeller/geometry/path_builder.h +++ b/impeller/geometry/path_builder.h @@ -4,7 +4,6 @@ #pragma once -#include "flutter/fml/macros.h" #include "impeller/geometry/path.h" #include "impeller/geometry/rect.h" #include "impeller/geometry/scalar.h" @@ -109,7 +108,8 @@ class PathBuilder { Point ReflectedCubicControlPoint1() const; - FML_DISALLOW_COPY_AND_ASSIGN(PathBuilder); + PathBuilder(const PathBuilder&) = delete; + PathBuilder& operator=(const PathBuilder&&) = delete; }; } // namespace impeller diff --git a/impeller/geometry/scalar.h b/impeller/geometry/scalar.h index 918e1491cd12e..9350f825114f6 100644 --- a/impeller/geometry/scalar.h +++ b/impeller/geometry/scalar.h @@ -7,7 +7,6 @@ #include #include -#include "flutter/fml/logging.h" #include "impeller/geometry/constants.h" namespace impeller { @@ -17,7 +16,6 @@ using Scalar = float; constexpr inline bool ScalarNearlyEqual(Scalar x, Scalar y, Scalar tolerance = 1e-3) { - FML_DCHECK(tolerance >= 0); return std::abs(x - y) <= tolerance; } diff --git a/impeller/image/BUILD.gn b/impeller/image/BUILD.gn index 0d61d2deeb7ea..3d2b787c2740f 100644 --- a/impeller/image/BUILD.gn +++ b/impeller/image/BUILD.gn @@ -17,12 +17,19 @@ impeller_component("image") { "decompressed_image.cc", ] - deps = [ "//third_party/skia" ] - public_deps = [ "../base", "../geometry", ] + + deps = [ + "//flutter/fml", + + # FML depends on the Dart VM for tracing and getting the current + # timepoint. + "//flutter/runtime:libdart", + "//third_party/skia", + ] } impeller_component("image_unittests") { diff --git a/impeller/renderer/BUILD.gn b/impeller/renderer/BUILD.gn index 540e1e45eb3f2..0520d394d387b 100644 --- a/impeller/renderer/BUILD.gn +++ b/impeller/renderer/BUILD.gn @@ -110,6 +110,14 @@ impeller_component("renderer") { "../tessellator", ] + deps = [ + "//flutter/fml", + + # FML depends on the Dart VM for tracing and getting the current + # timepoint. + "//flutter/runtime:libdart", + ] + frameworks = [ "Metal.framework" ] } diff --git a/impeller/tessellator/BUILD.gn b/impeller/tessellator/BUILD.gn index cde82096ffba8..4dba135b99bf1 100644 --- a/impeller/tessellator/BUILD.gn +++ b/impeller/tessellator/BUILD.gn @@ -27,7 +27,6 @@ shared_library("tessellator_shared") { deps = [ "../geometry", - "//flutter/fml", "//third_party/libtess2", ] } diff --git a/impeller/tessellator/tessellator.cc b/impeller/tessellator/tessellator.cc index eb8bb3ec43a2c..d63ac18461bb3 100644 --- a/impeller/tessellator/tessellator.cc +++ b/impeller/tessellator/tessellator.cc @@ -4,8 +4,6 @@ #include "impeller/tessellator/tessellator.h" -#include "flutter/fml/logging.h" -#include "flutter/fml/trace_event.h" #include "third_party/libtess2/Include/tesselator.h" namespace impeller { @@ -38,7 +36,6 @@ static void DestroyTessellator(TESStesselator* tessellator) { bool Tessellator::Tessellate(const Path::Polyline& polyline, VertexCallback callback) const { - TRACE_EVENT0("impeller", "Tessellator::Tessellate"); if (!callback) { return false; } diff --git a/impeller/tools/impeller.gni b/impeller/tools/impeller.gni index 2af17e3490405..3594914db1c2b 100644 --- a/impeller/tools/impeller.gni +++ b/impeller/tools/impeller.gni @@ -36,13 +36,6 @@ template("impeller_component") { cflags_objcc += flutter_cflags_objcc_arc + objc_warning_flags public_configs += [ "//flutter/impeller:impeller_public_config" ] - - deps += [ - "//flutter/fml", - - # For tracing, seems to be pulled in by FML. Must be removed. - "//flutter/runtime:libdart", - ] } } diff --git a/impeller/typographer/BUILD.gn b/impeller/typographer/BUILD.gn index 3e06926491f76..10d95c452589b 100644 --- a/impeller/typographer/BUILD.gn +++ b/impeller/typographer/BUILD.gn @@ -36,6 +36,14 @@ impeller_component("typographer") { "../renderer", "//third_party/skia", ] + + deps = [ + "//flutter/fml", + + # FML depends on the Dart VM for tracing and getting the current + # timepoint. + "//flutter/runtime:libdart", + ] } impeller_component("typographer_unittests") {