[base] Use wrapper type for PlatformThreadId

Introduce a wrapper class (similar to base::StrongAlias) for
PlatformThreadId, whose API assumes that the value can be 64-bit. It
forces explicit conversion to integers with various bitness, and makes
conversion to 32-bit be explicit about truncation.

The values are currently all still 32-bit -- follow-up work will make
thread id values on macOS 64-bit.

Bug: 40187449
Change-Id: Ic635c346be1c3a0d62fd573572f4fcdc642a734f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6206469
Reviewed-by: Peter McNeeley <petermcneeley@google.com>
Reviewed-by: Mark Mentovai <mark@chromium.org>
Owners-Override: Mark Mentovai <mark@chromium.org>
Auto-Submit: Leszek Swirski <leszeks@chromium.org>
Reviewed-by: Victor Vianna <victorvianna@google.com>
Commit-Queue: Leszek Swirski <leszeks@chromium.org>
Reviewed-by: Mikhail Khokhlov <khokhlov@google.com>
Reviewed-by: Ahmed Fakhry <afakhry@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1416712}
NOKEYCHECK=True
GitOrigin-RevId: b3fb42320c2b4354477bf76aab232336f2961eee
diff --git a/partition_allocator/pa_tcache_inspect.cc b/partition_allocator/pa_tcache_inspect.cc
index 0f75814..8759b4e 100644
--- a/partition_allocator/pa_tcache_inspect.cc
+++ b/partition_allocator/pa_tcache_inspect.cc
@@ -36,10 +36,10 @@
 #include "base/strings/string_split.h"
 #include "base/strings/stringprintf.h"
 #include "base/thread_annotations.h"
-#include "base/threading/platform_thread.h"
 #include "base/time/time.h"
 #include "base/values.h"
 #include "build/build_config.h"
+#include "partition_alloc/partition_alloc_base/threading/platform_thread.h"
 #include "partition_alloc/partition_root.h"
 #include "partition_alloc/partition_stats.h"
 #include "partition_alloc/thread_cache.h"
@@ -47,10 +47,10 @@
 
 namespace partition_alloc::tools {
 
-using ::base::PlatformThreadId;
 using partition_alloc::internal::BucketIndexLookup;
 using partition_alloc::internal::MetadataKind;
 using partition_alloc::internal::PartitionBucket;
+using partition_alloc::internal::base::PlatformThreadId;
 template <MetadataKind kind>
 using SlotSpanMetadata = partition_alloc::internal::SlotSpanMetadata<kind>;
 
@@ -63,8 +63,8 @@
 }
 
 // List all thread names for a given PID.
-std::map<base::PlatformThreadId, std::string> ThreadNames(pid_t pid) {
-  std::map<base::PlatformThreadId, std::string> result;
+std::map<PlatformThreadId, std::string> ThreadNames(pid_t pid) {
+  std::map<PlatformThreadId, std::string> result;
 
   base::FilePath root_path =
       base::FilePath(base::StringPrintf("/proc/%d/task", pid));
@@ -114,7 +114,7 @@
       }
     }
 
-    result[base::PlatformThreadId(process_id)] = std::string(name);
+    result[PlatformThreadId(process_id)] = std::string(name);
   }
 
   return result;
@@ -362,7 +362,7 @@
 
 void DisplayPerThreadData(
     ThreadCacheInspector& inspector,
-    std::map<base::PlatformThreadId, std::string>& tid_to_name) {
+    std::map<PlatformThreadId, std::string>& tid_to_name) {
   std::cout << "Found " << inspector.thread_caches().size()
             << " caches, total cached memory = "
             << inspector.CachedMemory() / 1024 << "kiB"
@@ -557,6 +557,8 @@
 }  // namespace partition_alloc::tools
 
 int main(int argc, char** argv) {
+  using partition_alloc::tools::PlatformThreadId;
+
   base::CommandLine::Init(argc, argv);
 
   if (!base::CommandLine::ForCurrentProcess()->HasSwitch("pid")) {
@@ -581,7 +583,7 @@
   LOG(INFO) << "Getting the thread cache registry";
   partition_alloc::tools::ThreadCacheInspector thread_cache_inspector{
       registry_address, pid};
-  std::map<base::PlatformThreadId, std::string> tid_to_name;
+  std::map<PlatformThreadId, std::string> tid_to_name;
 
   size_t iter = 0;
   while (true) {