Bug 1722261 - Remove the old PlatformData, which is now unused - r=canaltinova

Differential Revision: https://phabricator.services.mozilla.com/D121965
This commit is contained in:
Gerald Squelart 2021-08-19 02:45:04 +00:00
Родитель 1ddcd6f2cd
Коммит f76e1393d4
7 изменённых файлов: 1 добавлений и 96 удалений

Просмотреть файл

@ -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

Просмотреть файл

@ -105,8 +105,6 @@ class RegisteredThread final {
private:
class RacyRegisteredThread mRacyRegisteredThread;
const UniquePlatformData mPlatformData;
};
#endif // RegisteredThread_h

Просмотреть файл

@ -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<clockid_t> GetClockId() const { return mClockId; }
private:
Maybe<clockid_t> mClockId;
};
mozilla::profiler::PlatformData::PlatformData(ProfilerThreadId aThreadId) {
MOZ_ASSERT(aThreadId == profiler_current_thread_id());
if (clockid_t clockid; pthread_getcpuclockid(pthread_self(), &clockid) == 0) {

Просмотреть файл

@ -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()) {}

Просмотреть файл

@ -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<mozilla::profiler::PlatformData::WindowsHandle, HANDLE>);

Просмотреть файл

@ -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
////////////////////////////////////////////////////////////////////////

Просмотреть файл

@ -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<PlatformData, PlatformDataDestructor>
UniquePlatformData;
UniquePlatformData AllocPlatformData(ProfilerThreadId aThreadId);
namespace mozilla {
class JSONWriter;
}