diff --git a/tools/profiler/core/RegisteredThread.cpp b/tools/profiler/core/RegisteredThread.cpp index b8e1a75da8e9..8eef3728d04d 100644 --- a/tools/profiler/core/RegisteredThread.cpp +++ b/tools/profiler/core/RegisteredThread.cpp @@ -20,9 +20,7 @@ RacyRegisteredThread::RacyRegisteredThread( RegisteredThread::RegisteredThread( mozilla::profiler::ThreadRegistration& aThreadRegistration) - : mRacyRegisteredThread(aThreadRegistration), - mPlatformData( - AllocPlatformData(aThreadRegistration.mData.mInfo.ThreadId())) { + : mRacyRegisteredThread(aThreadRegistration) { MOZ_COUNT_CTOR(RegisteredThread); // NOTE: aThread can be null for the first thread, before the ThreadManager @@ -35,10 +33,6 @@ size_t RegisteredThread::SizeOfIncludingThis( mozilla::MallocSizeOf aMallocSizeOf) const { size_t n = aMallocSizeOf(this); - // Measurement of the following members may be added later if DMD finds it - // is worthwhile: - // - mPlatformData - // // The following members are not measured: // - mThreadInfo: because it is non-owning diff --git a/tools/profiler/core/RegisteredThread.h b/tools/profiler/core/RegisteredThread.h index 5199828facae..f2e04720aafa 100644 --- a/tools/profiler/core/RegisteredThread.h +++ b/tools/profiler/core/RegisteredThread.h @@ -105,8 +105,6 @@ class RegisteredThread final { private: class RacyRegisteredThread mRacyRegisteredThread; - - const UniquePlatformData mPlatformData; }; #endif // RegisteredThread_h diff --git a/tools/profiler/core/platform-linux-android.cpp b/tools/profiler/core/platform-linux-android.cpp index 045cbc74784a..7797d4658acb 100644 --- a/tools/profiler/core/platform-linux-android.cpp +++ b/tools/profiler/core/platform-linux-android.cpp @@ -133,27 +133,6 @@ int tgkill(pid_t tgid, pid_t tid, int signalno) { # define tgkill thr_kill2 #endif -class PlatformData { - public: - explicit PlatformData(ProfilerThreadId aThreadId) { - MOZ_ASSERT(aThreadId == profiler_current_thread_id()); - MOZ_COUNT_CTOR(PlatformData); - if (clockid_t clockid; - pthread_getcpuclockid(pthread_self(), &clockid) == 0) { - mClockId = Some(clockid); - } - } - - MOZ_COUNTED_DTOR(PlatformData) - - // Clock Id for this profiled thread. `Nothing` if `pthread_getcpuclockid` - // failed (e.g., if the system doesn't support per-thread clocks). - Maybe GetClockId() const { return mClockId; } - - private: - Maybe mClockId; -}; - mozilla::profiler::PlatformData::PlatformData(ProfilerThreadId aThreadId) { MOZ_ASSERT(aThreadId == profiler_current_thread_id()); if (clockid_t clockid; pthread_getcpuclockid(pthread_self(), &clockid) == 0) { diff --git a/tools/profiler/core/platform-macos.cpp b/tools/profiler/core/platform-macos.cpp index 32ca802ce0e2..da20a7aea27d 100644 --- a/tools/profiler/core/platform-macos.cpp +++ b/tools/profiler/core/platform-macos.cpp @@ -34,29 +34,6 @@ // this port is based off of v8 svn revision 9837 -class PlatformData { - public: - explicit PlatformData(ProfilerThreadId aThreadId) - : mProfiledThread(mach_thread_self()) { - MOZ_COUNT_CTOR(PlatformData); - } - - ~PlatformData() { - // Deallocate Mach port for thread. - mach_port_deallocate(mach_task_self(), mProfiledThread); - - MOZ_COUNT_DTOR(PlatformData); - } - - thread_act_t ProfiledThread() const { return mProfiledThread; } - - private: - // Note: for mProfiledThread Mach primitives are used instead of pthread's - // because the latter doesn't provide thread manipulation primitives required. - // For details, consult "Mac OS X Internals" book, Section 7.3. - thread_act_t mProfiledThread; -}; - mozilla::profiler::PlatformData::PlatformData(ProfilerThreadId aThreadId) : mProfiledThread(mach_thread_self()) {} diff --git a/tools/profiler/core/platform-win32.cpp b/tools/profiler/core/platform-win32.cpp index 4e2276447827..85a240a32cde 100644 --- a/tools/profiler/core/platform-win32.cpp +++ b/tools/profiler/core/platform-win32.cpp @@ -73,31 +73,6 @@ static HANDLE GetRealCurrentThreadHandleForProfiling() { return realCurrentThreadHandle; } -class PlatformData { - public: - // Get a handle to the calling thread. This is the thread that we are - // going to profile. We need a real handle because we are going to use it in - // the sampler thread. - explicit PlatformData(ProfilerThreadId aThreadId) - : mProfiledThread(GetRealCurrentThreadHandleForProfiling()) { - MOZ_ASSERT(aThreadId == profiler_current_thread_id()); - MOZ_COUNT_CTOR(PlatformData); - } - - ~PlatformData() { - if (mProfiledThread != nullptr) { - CloseHandle(mProfiledThread); - mProfiledThread = nullptr; - } - MOZ_COUNT_DTOR(PlatformData); - } - - HANDLE ProfiledThread() { return mProfiledThread; } - - private: - HANDLE mProfiledThread; -}; - static_assert( std::is_same_v); diff --git a/tools/profiler/core/platform.cpp b/tools/profiler/core/platform.cpp index 7584317e19f4..7d5f87050d95 100644 --- a/tools/profiler/core/platform.cpp +++ b/tools/profiler/core/platform.cpp @@ -4036,12 +4036,6 @@ void SamplerThread::Run() { # error "bad platform" #endif -UniquePlatformData AllocPlatformData(ProfilerThreadId aThreadId) { - return UniquePlatformData(new PlatformData(aThreadId)); -} - -void PlatformDataDestructor::operator()(PlatformData* aData) { delete aData; } - // END SamplerThread //////////////////////////////////////////////////////////////////////// diff --git a/tools/profiler/core/platform.h b/tools/profiler/core/platform.h index bf628d84a0a3..c03cea6c3d7b 100644 --- a/tools/profiler/core/platform.h +++ b/tools/profiler/core/platform.h @@ -73,18 +73,6 @@ typedef uint8_t* Address; // ---------------------------------------------------------------------------- // Miscellaneous -class PlatformData; - -// We can't new/delete the type safely without defining it -// (-Wdelete-incomplete). Use these to hide the details from clients. -struct PlatformDataDestructor { - void operator()(PlatformData*); -}; - -typedef mozilla::UniquePtr - UniquePlatformData; -UniquePlatformData AllocPlatformData(ProfilerThreadId aThreadId); - namespace mozilla { class JSONWriter; }