Skip to content

Commit

Permalink
Delete fml::ThreadLocalUniquePtr. (flutter#50310)
Browse files Browse the repository at this point in the history
  • Loading branch information
chinmaygarde committed Feb 4, 2024
1 parent 20742e3 commit f34c658
Show file tree
Hide file tree
Showing 12 changed files with 9 additions and 173 deletions.
1 change: 0 additions & 1 deletion ci/licenses_golden/excluded_files
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,6 @@
../../../flutter/fml/synchronization/sync_switch_unittest.cc
../../../flutter/fml/synchronization/waitable_event_unittest.cc
../../../flutter/fml/task_source_unittests.cc
../../../flutter/fml/thread_local_unittests.cc
../../../flutter/fml/thread_unittests.cc
../../../flutter/fml/time/time_delta_unittest.cc
../../../flutter/fml/time/time_point_unittest.cc
Expand Down
4 changes: 0 additions & 4 deletions ci/licenses_golden/licenses_flutter
Original file line number Diff line number Diff line change
Expand Up @@ -4920,8 +4920,6 @@ ORIGIN: ../../../flutter/fml/task_source.h + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/fml/task_source_grade.h + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/fml/thread.cc + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/fml/thread.h + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/fml/thread_local.cc + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/fml/thread_local.h + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/fml/time/chrono_timestamp_provider.cc + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/fml/time/chrono_timestamp_provider.h + ../../../flutter/LICENSE
ORIGIN: ../../../flutter/fml/time/time_delta.h + ../../../flutter/LICENSE
Expand Down Expand Up @@ -7779,8 +7777,6 @@ FILE: ../../../flutter/fml/task_source.h
FILE: ../../../flutter/fml/task_source_grade.h
FILE: ../../../flutter/fml/thread.cc
FILE: ../../../flutter/fml/thread.h
FILE: ../../../flutter/fml/thread_local.cc
FILE: ../../../flutter/fml/thread_local.h
FILE: ../../../flutter/fml/time/chrono_timestamp_provider.cc
FILE: ../../../flutter/fml/time/chrono_timestamp_provider.h
FILE: ../../../flutter/fml/time/time_delta.h
Expand Down
4 changes: 1 addition & 3 deletions flow/testing/gl_context_switch_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,10 @@

#include "gl_context_switch_test.h"

#include "flutter/fml/thread_local.h"

namespace flutter {
namespace testing {

FML_THREAD_LOCAL fml::ThreadLocalUniquePtr<int> current_context;
static thread_local std::unique_ptr<int> current_context;

TestSwitchableGLContext::TestSwitchableGLContext(int context)
: context_(context){};
Expand Down
3 changes: 0 additions & 3 deletions fml/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,6 @@ source_set("fml") {
"task_source.h",
"thread.cc",
"thread.h",
"thread_local.cc",
"thread_local.h",
"time/time_delta.h",
"time/time_point.cc",
"time/time_point.h",
Expand Down Expand Up @@ -361,7 +359,6 @@ if (enable_unittests) {
"synchronization/sync_switch_unittest.cc",
"synchronization/waitable_event_unittest.cc",
"task_source_unittests.cc",
"thread_local_unittests.cc",
"thread_unittests.cc",
"time/chrono_timestamp_provider.cc",
"time/chrono_timestamp_provider.h",
Expand Down
4 changes: 2 additions & 2 deletions fml/message_loop.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,17 @@

#include "flutter/fml/message_loop.h"

#include <memory>
#include <utility>

#include "flutter/fml/memory/ref_counted.h"
#include "flutter/fml/memory/ref_ptr.h"
#include "flutter/fml/message_loop_impl.h"
#include "flutter/fml/task_runner.h"
#include "flutter/fml/thread_local.h"

namespace fml {

FML_THREAD_LOCAL ThreadLocalUniquePtr<MessageLoop> tls_message_loop;
static thread_local std::unique_ptr<MessageLoop> tls_message_loop;

MessageLoop& MessageLoop::GetCurrent() {
auto* loop = tls_message_loop.get();
Expand Down
3 changes: 1 addition & 2 deletions fml/message_loop_task_queues.cc
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@

#include "flutter/fml/make_copyable.h"
#include "flutter/fml/task_source.h"
#include "flutter/fml/thread_local.h"

namespace fml {

Expand All @@ -32,7 +31,7 @@ class TaskSourceGradeHolder {
};
} // namespace

FML_THREAD_LOCAL ThreadLocalUniquePtr<TaskSourceGradeHolder>
static thread_local std::unique_ptr<TaskSourceGradeHolder>
tls_task_source_grade;

TaskQueueEntry::TaskQueueEntry(TaskQueueId created_for_arg)
Expand Down
4 changes: 2 additions & 2 deletions fml/platform/android/jni_util.cc
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@

#include <sys/prctl.h>

#include <memory>
#include <string>

#include "flutter/fml/logging.h"
#include "flutter/fml/string_conversion.h"
#include "flutter/fml/thread_local.h"

namespace fml {
namespace jni {
Expand All @@ -24,7 +24,7 @@ struct JNIDetach {
};

// Thread-local object that will detach from JNI during thread shutdown;
FML_THREAD_LOCAL fml::ThreadLocalUniquePtr<JNIDetach> tls_jni_detach;
static thread_local std::unique_ptr<JNIDetach> tls_jni_detach;

void InitJavaVM(JavaVM* vm) {
FML_DCHECK(g_jvm == nullptr);
Expand Down
5 changes: 0 additions & 5 deletions fml/thread_local.cc

This file was deleted.

42 changes: 0 additions & 42 deletions fml/thread_local.h

This file was deleted.

104 changes: 0 additions & 104 deletions fml/thread_local_unittests.cc

This file was deleted.

3 changes: 1 addition & 2 deletions impeller/renderer/backend/vulkan/command_pool_vk.cc
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
#include <optional>
#include <utility>

#include "fml/thread_local.h"
#include "impeller/renderer/backend/vulkan/context_vk.h"
#include "impeller/renderer/backend/vulkan/resource_manager_vk.h"

Expand Down Expand Up @@ -130,7 +129,7 @@ void CommandPoolVK::Destroy() {
// Associates a resource with a thread and context.
using CommandPoolMap =
std::unordered_map<uint64_t, std::shared_ptr<CommandPoolVK>>;
FML_THREAD_LOCAL fml::ThreadLocalUniquePtr<CommandPoolMap> tls_command_pool_map;
static thread_local std::unique_ptr<CommandPoolMap> tls_command_pool_map;

// Map each context to a list of all thread-local command pools associated
// with that context.
Expand Down
5 changes: 2 additions & 3 deletions impeller/renderer/backend/vulkan/test/mock_vulkan.cc
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
#include <vector>

#include "fml/macros.h"
#include "fml/thread_local.h"
#include "impeller/base/thread_safety.h"
#include "impeller/renderer/backend/vulkan/vk.h" // IWYU pragma: keep.
#include "third_party/swiftshader/include/vulkan/vulkan_core.h"
Expand Down Expand Up @@ -105,7 +104,7 @@ class MockDevice final {

void noop() {}

FML_THREAD_LOCAL std::vector<std::string> g_instance_extensions;
static thread_local std::vector<std::string> g_instance_extensions;

VkResult vkEnumerateInstanceExtensionProperties(
const char* pLayerName,
Expand All @@ -125,7 +124,7 @@ VkResult vkEnumerateInstanceExtensionProperties(
return VK_SUCCESS;
}

FML_THREAD_LOCAL std::vector<std::string> g_instance_layers;
static thread_local std::vector<std::string> g_instance_layers;

VkResult vkEnumerateInstanceLayerProperties(uint32_t* pPropertyCount,
VkLayerProperties* pProperties) {
Expand Down

0 comments on commit f34c658

Please sign in to comment.