From 42cc820c92b28c857ec3cc1409fae8068c415a49 Mon Sep 17 00:00:00 2001 From: eggfly Date: Tue, 1 Feb 2022 10:20:02 +0800 Subject: [PATCH] Cleanup unused code in the UIDartState and other tests. (flutter/engine#31152) --- .../flow/testing/gl_context_switch_test.cc | 2 -- .../flow/testing/gl_context_switch_test.h | 5 ---- engine/src/flutter/lib/ui/ui_dart_state.cc | 11 ------- engine/src/flutter/lib/ui/ui_dart_state.h | 4 --- .../platform_configuration_unittests.cc | 29 ------------------- engine/src/flutter/runtime/test_font_data.cc | 4 --- engine/src/flutter/runtime/test_font_data.h | 1 - 7 files changed, 56 deletions(-) diff --git a/engine/src/flutter/flow/testing/gl_context_switch_test.cc b/engine/src/flutter/flow/testing/gl_context_switch_test.cc index 0fd02f8233..d049d0c6e4 100644 --- a/engine/src/flutter/flow/testing/gl_context_switch_test.cc +++ b/engine/src/flutter/flow/testing/gl_context_switch_test.cc @@ -11,8 +11,6 @@ namespace testing { FML_THREAD_LOCAL fml::ThreadLocalUniquePtr current_context; -GLContextSwitchTest::GLContextSwitchTest() = default; - TestSwitchableGLContext::TestSwitchableGLContext(int context) : context_(context){}; diff --git a/engine/src/flutter/flow/testing/gl_context_switch_test.h b/engine/src/flutter/flow/testing/gl_context_switch_test.h index f3d06daf6b..a2d182d86f 100644 --- a/engine/src/flutter/flow/testing/gl_context_switch_test.h +++ b/engine/src/flutter/flow/testing/gl_context_switch_test.h @@ -11,11 +11,6 @@ namespace flutter { namespace testing { -class GLContextSwitchTest : public ::testing::Test { - public: - GLContextSwitchTest(); -}; - //------------------------------------------------------------------------------ /// The renderer context used for testing class TestSwitchableGLContext : public SwitchableGLContext { diff --git a/engine/src/flutter/lib/ui/ui_dart_state.cc b/engine/src/flutter/lib/ui/ui_dart_state.cc index 9284e6553b..b9bd6a749f 100644 --- a/engine/src/flutter/lib/ui/ui_dart_state.cc +++ b/engine/src/flutter/lib/ui/ui_dart_state.cc @@ -79,10 +79,6 @@ const std::string& UIDartState::GetAdvisoryScriptURI() const { return context_.advisory_script_uri; } -const std::string& UIDartState::GetAdvisoryScriptEntrypoint() const { - return context_.advisory_script_entrypoint; -} - void UIDartState::DidSetIsolate() { main_port_ = Dart_GetMainPortId(); std::ostringstream debug_name; @@ -169,13 +165,6 @@ fml::WeakPtr UIDartState::GetSnapshotDelegate() const { return context_.snapshot_delegate; } -fml::WeakPtr UIDartState::GetResourceContext() const { - if (!context_.io_manager) { - return {}; - } - return context_.io_manager->GetResourceContext(); -} - fml::WeakPtr UIDartState::GetImageDecoder() const { return context_.image_decoder; } diff --git a/engine/src/flutter/lib/ui/ui_dart_state.h b/engine/src/flutter/lib/ui/ui_dart_state.h index df0460b914..8269ba34c9 100644 --- a/engine/src/flutter/lib/ui/ui_dart_state.h +++ b/engine/src/flutter/lib/ui/ui_dart_state.h @@ -120,8 +120,6 @@ class UIDartState : public tonic::DartState { fml::WeakPtr GetSnapshotDelegate() const; - fml::WeakPtr GetResourceContext() const; - fml::WeakPtr GetImageDecoder() const; fml::WeakPtr GetImageGeneratorRegistry() const; @@ -175,8 +173,6 @@ class UIDartState : public tonic::DartState { const std::string& GetAdvisoryScriptURI() const; - const std::string& GetAdvisoryScriptEntrypoint() const; - private: void DidSetIsolate() override; diff --git a/engine/src/flutter/lib/ui/window/platform_configuration_unittests.cc b/engine/src/flutter/lib/ui/window/platform_configuration_unittests.cc index a19dc476bd..e18c9e466b 100644 --- a/engine/src/flutter/lib/ui/window/platform_configuration_unittests.cc +++ b/engine/src/flutter/lib/ui/window/platform_configuration_unittests.cc @@ -19,35 +19,6 @@ namespace flutter { namespace testing { -class DummyPlatformConfigurationClient : public PlatformConfigurationClient { - public: - DummyPlatformConfigurationClient() { - std::vector data; - isolate_data_.reset(new ::fml::DataMapping(data)); - } - std::string DefaultRouteName() override { return "TestRoute"; } - void ScheduleFrame() override {} - void Render(Scene* scene) override {} - void UpdateSemantics(SemanticsUpdate* update) override {} - void HandlePlatformMessage( - std::unique_ptr message) override {} - FontCollection& GetFontCollection() override { return font_collection_; } - void UpdateIsolateDescription(const std::string isolate_name, - int64_t isolate_port) override {} - void SetNeedsReportTimings(bool value) override {} - std::shared_ptr GetPersistentIsolateData() override { - return isolate_data_; - } - std::unique_ptr> ComputePlatformResolvedLocale( - const std::vector& supported_locale_data) override { - return nullptr; - }; - - private: - FontCollection font_collection_; - std::shared_ptr isolate_data_; -}; - TEST_F(ShellTest, PlatformConfigurationInitialization) { auto message_latch = std::make_shared(); diff --git a/engine/src/flutter/runtime/test_font_data.cc b/engine/src/flutter/runtime/test_font_data.cc index 302c8d05c2..ce21eef6e1 100644 --- a/engine/src/flutter/runtime/test_font_data.cc +++ b/engine/src/flutter/runtime/test_font_data.cc @@ -1390,10 +1390,6 @@ std::vector> GetTestFontData() { return data; } -std::string GetTestFontFamilyName() { - return "Ahem"; -} - std::vector GetTestFontFamilyNames() { std::vector names = {"Ahem", "Cough"}; return names; diff --git a/engine/src/flutter/runtime/test_font_data.h b/engine/src/flutter/runtime/test_font_data.h index 83ef523aa1..d1ba0728bd 100644 --- a/engine/src/flutter/runtime/test_font_data.h +++ b/engine/src/flutter/runtime/test_font_data.h @@ -14,7 +14,6 @@ namespace flutter { std::vector> GetTestFontData(); -std::string GetTestFontFamilyName(); std::vector GetTestFontFamilyNames(); } // namespace flutter