Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit 0419b81

Browse files
authored
Delete unused/test only code from FML (#48327)
This is more-or-less a revert of #14011 This code never ended up being used outside of tests, and it's not how we handle asset loading at this point anyway. I was hopeful we could kill off all runtime dependencies on Dart in `FML` when looking at this, but it looks like trace_event.h still wants to import dart_api_tools.h for some Dart enum types. This may or may not matter if we ever want to build FML for web/wasm. /cc @eyebrowsoffire. If we really need to do that, we can refactor the trace event stuff so that it has a web and Dart implementation that's selected at build time.
1 parent 78fd6de commit 0419b81

File tree

10 files changed

+0
-264
lines changed

10 files changed

+0
-264
lines changed

ci/licenses_golden/licenses_flutter

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4697,8 +4697,6 @@ ORIGIN: ../../../flutter/fml/concurrent_message_loop_factory.cc + ../../../flutt
46974697
ORIGIN: ../../../flutter/fml/container.h + ../../../flutter/LICENSE
46984698
ORIGIN: ../../../flutter/fml/cpu_affinity.cc + ../../../flutter/LICENSE
46994699
ORIGIN: ../../../flutter/fml/cpu_affinity.h + ../../../flutter/LICENSE
4700-
ORIGIN: ../../../flutter/fml/dart/dart_converter.cc + ../../../flutter/LICENSE
4701-
ORIGIN: ../../../flutter/fml/dart/dart_converter.h + ../../../flutter/LICENSE
47024700
ORIGIN: ../../../flutter/fml/delayed_task.cc + ../../../flutter/LICENSE
47034701
ORIGIN: ../../../flutter/fml/delayed_task.h + ../../../flutter/LICENSE
47044702
ORIGIN: ../../../flutter/fml/eintr_wrapper.h + ../../../flutter/LICENSE
@@ -7471,8 +7469,6 @@ FILE: ../../../flutter/fml/concurrent_message_loop_factory.cc
74717469
FILE: ../../../flutter/fml/container.h
74727470
FILE: ../../../flutter/fml/cpu_affinity.cc
74737471
FILE: ../../../flutter/fml/cpu_affinity.h
7474-
FILE: ../../../flutter/fml/dart/dart_converter.cc
7475-
FILE: ../../../flutter/fml/dart/dart_converter.h
74767472
FILE: ../../../flutter/fml/delayed_task.cc
74777473
FILE: ../../../flutter/fml/delayed_task.h
74787474
FILE: ../../../flutter/fml/eintr_wrapper.h

fml/BUILD.gn

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -387,7 +387,6 @@ if (enable_unittests) {
387387
deps = [
388388
":fml_fixtures",
389389
"//flutter/fml",
390-
"//flutter/fml/dart",
391390
"//flutter/runtime",
392391
"//flutter/runtime:libdart",
393392
"//flutter/testing",

fml/dart/BUILD.gn

Lines changed: 0 additions & 19 deletions
This file was deleted.

fml/dart/dart_converter.cc

Lines changed: 0 additions & 11 deletions
This file was deleted.

fml/dart/dart_converter.h

Lines changed: 0 additions & 127 deletions
This file was deleted.

shell/common/BUILD.gn

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,6 @@ if (enable_unittests) {
245245
public_deps = [
246246
"//flutter/common/graphics",
247247
"//flutter/flow",
248-
"//flutter/fml/dart",
249248
"//flutter/runtime",
250249
"//flutter/shell/common",
251250
"//flutter/testing",

shell/common/fixtures/shell_test.dart

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -220,29 +220,6 @@ void callNotifyDestroyed() {
220220
@pragma('vm:external-name', 'NotifyMessage')
221221
external void notifyMessage(String string);
222222

223-
@pragma('vm:entry-point')
224-
void canConvertMappings() {
225-
sendFixtureMapping(getFixtureMapping());
226-
}
227-
228-
@pragma('vm:external-name', 'GetFixtureMapping')
229-
external List<int> getFixtureMapping();
230-
@pragma('vm:external-name', 'SendFixtureMapping')
231-
external void sendFixtureMapping(List<int> list);
232-
233-
@pragma('vm:entry-point')
234-
void canDecompressImageFromAsset() {
235-
decodeImageFromList(
236-
Uint8List.fromList(getFixtureImage()),
237-
(Image result) {
238-
notifyWidthHeight(result.width, result.height);
239-
},
240-
);
241-
}
242-
243-
@pragma('vm:external-name', 'GetFixtureImage')
244-
external List<int> getFixtureImage();
245-
246223
@pragma('vm:entry-point')
247224
void canRegisterImageDecoders() {
248225
decodeImageFromList(

shell/common/shell_fuchsia_unittests.cc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
#include <fuchsia/settings/cpp/fidl.h>
1919
#include <lib/sys/cpp/component_context.h>
2020

21-
#include "flutter/fml/dart/dart_converter.h"
2221
#include "flutter/fml/logging.h"
2322
#include "flutter/fml/synchronization/count_down_latch.h"
2423
#include "flutter/runtime/dart_vm.h"

shell/common/shell_unittests.cc

Lines changed: 0 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
#include "flutter/flow/layers/transform_layer.h"
2929
#include "flutter/fml/backtrace.h"
3030
#include "flutter/fml/command_line.h"
31-
#include "flutter/fml/dart/dart_converter.h"
3231
#include "flutter/fml/make_copyable.h"
3332
#include "flutter/fml/message_loop.h"
3433
#include "flutter/fml/synchronization/count_down_latch.h"
@@ -2207,52 +2206,6 @@ TEST_F(ShellTest, Screenshot) {
22072206
DestroyShell(std::move(shell));
22082207
}
22092208

2210-
TEST_F(ShellTest, CanConvertToAndFromMappings) {
2211-
const size_t buffer_size = 2 << 20;
2212-
2213-
uint8_t* buffer = static_cast<uint8_t*>(::malloc(buffer_size));
2214-
// NOLINTNEXTLINE(clang-analyzer-unix.Malloc)
2215-
ASSERT_TRUE(buffer != nullptr);
2216-
ASSERT_TRUE(MemsetPatternSetOrCheck(
2217-
buffer, buffer_size, MemsetPatternOp::kMemsetPatternOpSetBuffer));
2218-
2219-
std::unique_ptr<fml::Mapping> mapping =
2220-
std::make_unique<fml::MallocMapping>(buffer, buffer_size);
2221-
2222-
ASSERT_EQ(mapping->GetSize(), buffer_size);
2223-
2224-
fml::AutoResetWaitableEvent latch;
2225-
AddNativeCallback(
2226-
"SendFixtureMapping", CREATE_NATIVE_ENTRY([&](auto args) {
2227-
auto mapping_from_dart =
2228-
tonic::DartConverter<std::unique_ptr<fml::Mapping>>::FromDart(
2229-
Dart_GetNativeArgument(args, 0));
2230-
ASSERT_NE(mapping_from_dart, nullptr);
2231-
ASSERT_EQ(mapping_from_dart->GetSize(), buffer_size);
2232-
ASSERT_TRUE(MemsetPatternSetOrCheck(
2233-
const_cast<uint8_t*>(mapping_from_dart->GetMapping()), // buffer
2234-
mapping_from_dart->GetSize(), // size
2235-
MemsetPatternOp::kMemsetPatternOpCheckBuffer // op
2236-
));
2237-
latch.Signal();
2238-
}));
2239-
2240-
AddNativeCallback(
2241-
"GetFixtureMapping", CREATE_NATIVE_ENTRY([&](auto args) {
2242-
tonic::DartConverter<tonic::DartConverterMapping>::SetReturnValue(
2243-
args, mapping);
2244-
}));
2245-
2246-
auto settings = CreateSettingsForFixture();
2247-
auto configuration = RunConfiguration::InferFromSettings(settings);
2248-
configuration.SetEntrypoint("canConvertMappings");
2249-
std::unique_ptr<Shell> shell = CreateShell(settings);
2250-
ASSERT_NE(shell.get(), nullptr);
2251-
RunEngine(shell.get(), std::move(configuration));
2252-
latch.Wait();
2253-
DestroyShell(std::move(shell));
2254-
}
2255-
22562209
// Compares local times as seen by the dart isolate and as seen by this test
22572210
// fixture, to a resolution of 1 hour.
22582211
//
@@ -2301,35 +2254,6 @@ TEST_F(ShellTest, LocaltimesMatch) {
23012254
DestroyShell(std::move(shell));
23022255
}
23032256

2304-
TEST_F(ShellTest, CanDecompressImageFromAsset) {
2305-
fml::AutoResetWaitableEvent latch;
2306-
AddNativeCallback("NotifyWidthHeight", CREATE_NATIVE_ENTRY([&](auto args) {
2307-
auto width = tonic::DartConverter<int>::FromDart(
2308-
Dart_GetNativeArgument(args, 0));
2309-
auto height = tonic::DartConverter<int>::FromDart(
2310-
Dart_GetNativeArgument(args, 1));
2311-
ASSERT_EQ(width, 100);
2312-
ASSERT_EQ(height, 100);
2313-
latch.Signal();
2314-
}));
2315-
2316-
AddNativeCallback(
2317-
"GetFixtureImage", CREATE_NATIVE_ENTRY([](auto args) {
2318-
auto fixture = OpenFixtureAsMapping("shelltest_screenshot.png");
2319-
tonic::DartConverter<tonic::DartConverterMapping>::SetReturnValue(
2320-
args, fixture);
2321-
}));
2322-
2323-
auto settings = CreateSettingsForFixture();
2324-
auto configuration = RunConfiguration::InferFromSettings(settings);
2325-
configuration.SetEntrypoint("canDecompressImageFromAsset");
2326-
std::unique_ptr<Shell> shell = CreateShell(settings);
2327-
ASSERT_NE(shell.get(), nullptr);
2328-
RunEngine(shell.get(), std::move(configuration));
2329-
latch.Wait();
2330-
DestroyShell(std::move(shell));
2331-
}
2332-
23332257
/// An image generator that always creates a 1x1 single-frame green image.
23342258
class SinglePixelImageGenerator : public ImageGenerator {
23352259
public:

shell/gpu/BUILD.gn

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,6 @@ if (is_mac) {
105105
":gpu_surface_metal",
106106
"//flutter/impeller/fixtures",
107107
"//flutter/fml",
108-
"//flutter/fml/dart",
109108
"//flutter/runtime",
110109
"//flutter/runtime:libdart",
111110
"//flutter/testing",

0 commit comments

Comments
 (0)