#include "test/scoped_set_thread_name.h"
#include <errno.h>
#include <pthread.h>
#include <ostream>
#include <string>
#include "base/check.h"
#include "base/check_op.h"
#include "build/build_config.h"
#if BUILDFLAG(IS_APPLE)
#include <mach/thread_info.h>
#elif BUILDFLAG(IS_ANDROID)
#include <sys/prctl.h>
#endif
namespace crashpad {
namespace test {
namespace {
#if BUILDFLAG(IS_APPLE)
constexpr size_t kPthreadNameMaxLen = MAXTHREADNAMESIZE;
#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_CHROMEOS)
constexpr size_t kPthreadNameMaxLen = …;
#else
#error Port to your platform
#endif
void SetCurrentThreadName(const std::string& thread_name) { … }
std::string GetCurrentThreadName() { … }
}
ScopedSetThreadName::ScopedSetThreadName(const std::string& new_thread_name)
: … { … }
ScopedSetThreadName::~ScopedSetThreadName() { … }
}
}