Revert "Fix thread names + add test (#27897)" This reverts commit 851eea5d2041c12df4f69e5a737aebcc45caf6d8.
diff --git a/shell/platform/fuchsia/flutter/BUILD.gn b/shell/platform/fuchsia/flutter/BUILD.gn index c4d126e..70dae94 100644 --- a/shell/platform/fuchsia/flutter/BUILD.gn +++ b/shell/platform/fuchsia/flutter/BUILD.gn
@@ -21,10 +21,6 @@ enable_metal = false } -config("runner_base_config") { - defines = [ "FML_USED_ON_EMBEDDER" ] -} - config("runner_debug_config") { defines = [ "DEBUG" ] # Needed due to direct dart dependencies. } @@ -40,7 +36,7 @@ template("runner_sources") { assert(defined(invoker.product), "runner_sources must define product") - runner_configs = [ ":runner_base_config" ] + runner_configs = [] if (is_debug) { runner_configs += [ ":runner_debug_config" ] }
diff --git a/shell/platform/fuchsia/flutter/component.cc b/shell/platform/fuchsia/flutter/component.cc index c7efd20..3f75c3b 100644 --- a/shell/platform/fuchsia/flutter/component.cc +++ b/shell/platform/fuchsia/flutter/component.cc
@@ -2,6 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#define FML_USED_ON_EMBEDDER + #include "component.h" #include <dlfcn.h>
diff --git a/shell/platform/fuchsia/flutter/engine.cc b/shell/platform/fuchsia/flutter/engine.cc index 502b799..350e0e4 100644 --- a/shell/platform/fuchsia/flutter/engine.cc +++ b/shell/platform/fuchsia/flutter/engine.cc
@@ -2,6 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#define FML_USED_ON_EMBEDDER + #include "engine.h" #include <lib/async/cpp/task.h> @@ -41,13 +43,6 @@ } // namespace -flutter::ThreadHost Engine::CreateThreadHost(const std::string& name_prefix) { - fml::Thread::SetCurrentThreadName(name_prefix + ".platform"); - return flutter::ThreadHost(name_prefix, flutter::ThreadHost::Type::RASTER | - flutter::ThreadHost::Type::UI | - flutter::ThreadHost::Type::IO); -} - Engine::Engine(Delegate& delegate, std::string thread_label, std::shared_ptr<sys::ServiceDirectory> svc, @@ -60,7 +55,10 @@ FlutterRunnerProductConfiguration product_config) : delegate_(delegate), thread_label_(std::move(thread_label)), - thread_host_(CreateThreadHost(thread_label_)), + thread_host_(thread_label_ + ".", + flutter::ThreadHost::Type::RASTER | + flutter::ThreadHost::Type::UI | + flutter::ThreadHost::Type::IO), intercept_all_input_(product_config.get_intercept_all_input()), weak_factory_(this) { // Get the task runners from the managed threads. The current thread will be
diff --git a/shell/platform/fuchsia/flutter/engine.h b/shell/platform/fuchsia/flutter/engine.h index 5108b03..bc7a66f 100644 --- a/shell/platform/fuchsia/flutter/engine.h +++ b/shell/platform/fuchsia/flutter/engine.h
@@ -45,8 +45,6 @@ virtual void OnEngineTerminate(const Engine* holder) = 0; }; - static flutter::ThreadHost CreateThreadHost(const std::string& name_prefix); - Engine(Delegate& delegate, std::string thread_label, std::shared_ptr<sys::ServiceDirectory> svc,
diff --git a/shell/platform/fuchsia/flutter/main.cc b/shell/platform/fuchsia/flutter/main.cc index cd34ab8..d5bfebb 100644 --- a/shell/platform/fuchsia/flutter/main.cc +++ b/shell/platform/fuchsia/flutter/main.cc
@@ -2,6 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#define FML_USED_ON_EMBEDDER + #include <lib/async-loop/cpp/loop.h> #include <lib/sys/inspect/cpp/component.h> #include <lib/trace-provider/provider.h>
diff --git a/shell/platform/fuchsia/flutter/tests/engine_unittests.cc b/shell/platform/fuchsia/flutter/tests/engine_unittests.cc index 534aa6a..b077878 100644 --- a/shell/platform/fuchsia/flutter/tests/engine_unittests.cc +++ b/shell/platform/fuchsia/flutter/tests/engine_unittests.cc
@@ -12,7 +12,6 @@ #include "flutter/fml/message_loop_impl.h" #include "flutter/fml/task_runner.h" #include "flutter/shell/common/serialization_callbacks.h" -#include "flutter/shell/common/thread_host.h" #include "flutter/shell/platform/fuchsia/flutter/gfx_session_connection.h" #include "flutter/shell/platform/fuchsia/flutter/logging.h" #include "flutter/shell/platform/fuchsia/flutter/runner.h" @@ -26,13 +25,6 @@ namespace flutter_runner { namespace testing { -namespace { - -std::string GetCurrentTestName() { - return ::testing::UnitTest::GetInstance()->current_test_info()->name(); -} - -} // namespace class MockTaskRunner : public fml::BasicTaskRunner { public: @@ -91,41 +83,6 @@ std::optional<scenic::Session> session_; }; -TEST_F(EngineTest, ThreadNames) { - std::string prefix = GetCurrentTestName(); - flutter::ThreadHost engine_thread_host = Engine::CreateThreadHost(prefix); - - char thread_name[ZX_MAX_NAME_LEN]; - zx::thread::self()->get_property(ZX_PROP_NAME, thread_name, - sizeof(thread_name)); - EXPECT_EQ(std::string(thread_name), prefix + std::string(".platform")); - EXPECT_EQ(engine_thread_host.platform_thread, nullptr); - - engine_thread_host.raster_thread->GetTaskRunner()->PostTask([&prefix]() { - char thread_name[ZX_MAX_NAME_LEN]; - zx::thread::self()->get_property(ZX_PROP_NAME, thread_name, - sizeof(thread_name)); - EXPECT_EQ(std::string(thread_name), prefix + std::string(".raster")); - }); - engine_thread_host.raster_thread->Join(); - - engine_thread_host.ui_thread->GetTaskRunner()->PostTask([&prefix]() { - char thread_name[ZX_MAX_NAME_LEN]; - zx::thread::self()->get_property(ZX_PROP_NAME, thread_name, - sizeof(thread_name)); - EXPECT_EQ(std::string(thread_name), prefix + std::string(".ui")); - }); - engine_thread_host.ui_thread->Join(); - - engine_thread_host.io_thread->GetTaskRunner()->PostTask([&prefix]() { - char thread_name[ZX_MAX_NAME_LEN]; - zx::thread::self()->get_property(ZX_PROP_NAME, thread_name, - sizeof(thread_name)); - EXPECT_EQ(std::string(thread_name), prefix + std::string(".io")); - }); - engine_thread_host.io_thread->Join(); -} - TEST_F(EngineTest, SkpWarmup) { SkISize draw_size = SkISize::Make(100, 100); SkPictureRecorder recorder;