diff --git a/rtc_base/BUILD.gn b/rtc_base/BUILD.gn index c5b9024cc1..fa60656541 100644 --- a/rtc_base/BUILD.gn +++ b/rtc_base/BUILD.gn @@ -314,7 +314,10 @@ rtc_library("platform_thread_types") { "platform_thread_types.cc", "platform_thread_types.h", ] - deps = [ ":macromagic" ] + deps = [ + ":checks", + ":macromagic", + ] } rtc_source_set("refcount") { diff --git a/rtc_base/platform_thread_types.cc b/rtc_base/platform_thread_types.cc index b0243b41dc..d64ea689bb 100644 --- a/rtc_base/platform_thread_types.cc +++ b/rtc_base/platform_thread_types.cc @@ -25,6 +25,13 @@ typedef HRESULT(WINAPI* RTC_SetThreadDescription)(HANDLE hThread, PCWSTR lpThreadDescription); #endif +#if defined(WEBRTC_FUCHSIA) +#include +#include + +#include "rtc_base/checks.h" +#endif + namespace rtc { PlatformThreadId CurrentThreadId() { @@ -109,6 +116,10 @@ void SetCurrentThreadName(const char* name) { prctl(PR_SET_NAME, reinterpret_cast(name)); // NOLINT #elif defined(WEBRTC_MAC) || defined(WEBRTC_IOS) pthread_setname_np(name); +#elif defined(WEBRTC_FUCHSIA) + zx_status_t status = zx_object_set_property(zx_thread_self(), ZX_PROP_NAME, + name, strlen(name)); + RTC_DCHECK_EQ(status, ZX_OK); #endif }