mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-03-02 14:30:43 +00:00
Bug 1648972 - Fix profiler non-unified build - r=canaltinova
Mostly missing includes, and missing namespace qualifiers. Differential Revision: https://phabricator.services.mozilla.com/D81451
This commit is contained in:
parent
0dcacd6736
commit
3fbe4a7b38
@ -14,6 +14,7 @@
|
||||
#include "js/ProfilingStack.h"
|
||||
#include "mozilla/TimeStamp.h"
|
||||
#include "mozilla/UniquePtr.h"
|
||||
#include "nsIEventTarget.h"
|
||||
|
||||
class ProfileBuffer;
|
||||
|
||||
|
@ -13,7 +13,7 @@
|
||||
|
||||
ProfilerBacktrace::ProfilerBacktrace(
|
||||
const char* aName, int aThreadId,
|
||||
UniquePtr<mozilla::ProfileChunkedBuffer> aProfileChunkedBuffer,
|
||||
mozilla::UniquePtr<mozilla::ProfileChunkedBuffer> aProfileChunkedBuffer,
|
||||
mozilla::UniquePtr<ProfileBuffer> aProfileBuffer)
|
||||
: mName(strdup(aName)),
|
||||
mThreadId(aThreadId),
|
||||
|
@ -9,6 +9,7 @@
|
||||
|
||||
#include "ProfileBuffer.h"
|
||||
|
||||
#include "mozilla/ProfileBufferEntrySerialization.h"
|
||||
#include "mozilla/UniquePtrExtensions.h"
|
||||
|
||||
class ProfileBuffer;
|
||||
@ -27,7 +28,7 @@ class ProfilerBacktrace {
|
||||
public:
|
||||
ProfilerBacktrace(
|
||||
const char* aName, int aThreadId,
|
||||
UniquePtr<mozilla::ProfileChunkedBuffer> aProfileChunkedBuffer,
|
||||
mozilla::UniquePtr<mozilla::ProfileChunkedBuffer> aProfileChunkedBuffer,
|
||||
mozilla::UniquePtr<ProfileBuffer> aProfileBuffer);
|
||||
~ProfilerBacktrace();
|
||||
|
||||
@ -43,14 +44,16 @@ class ProfilerBacktrace {
|
||||
|
||||
private:
|
||||
// Used to serialize a ProfilerBacktrace.
|
||||
friend struct ProfileBufferEntryWriter::Serializer<ProfilerBacktrace>;
|
||||
friend struct ProfileBufferEntryReader::Deserializer<ProfilerBacktrace>;
|
||||
friend struct mozilla::ProfileBufferEntryWriter::Serializer<
|
||||
ProfilerBacktrace>;
|
||||
friend struct mozilla::ProfileBufferEntryReader::Deserializer<
|
||||
ProfilerBacktrace>;
|
||||
|
||||
mozilla::UniqueFreePtr<char> mName;
|
||||
int mThreadId;
|
||||
// `ProfileChunkedBuffer` in which `mProfileBuffer` stores its data; must be
|
||||
// located before `mProfileBuffer` so that it's destroyed after.
|
||||
UniquePtr<mozilla::ProfileChunkedBuffer> mProfileChunkedBuffer;
|
||||
mozilla::UniquePtr<mozilla::ProfileChunkedBuffer> mProfileChunkedBuffer;
|
||||
mozilla::UniquePtr<ProfileBuffer> mProfileBuffer;
|
||||
};
|
||||
|
||||
@ -59,7 +62,7 @@ namespace mozilla {
|
||||
// Format: [ UniquePtr<BlockRingsBuffer> | threadId | name ]
|
||||
// Initial len==0 marks a nullptr or empty backtrace.
|
||||
template <>
|
||||
struct ProfileBufferEntryWriter::Serializer<ProfilerBacktrace> {
|
||||
struct mozilla::ProfileBufferEntryWriter::Serializer<ProfilerBacktrace> {
|
||||
static Length Bytes(const ProfilerBacktrace& aBacktrace) {
|
||||
if (!aBacktrace.mProfileBuffer) {
|
||||
return ULEB128Size<Length>(0);
|
||||
@ -72,7 +75,7 @@ struct ProfileBufferEntryWriter::Serializer<ProfilerBacktrace> {
|
||||
SumBytes(aBacktrace.mThreadId,
|
||||
WrapProfileBufferUnownedCString(aBacktrace.mName.get()));
|
||||
}
|
||||
static void Write(ProfileBufferEntryWriter& aEW,
|
||||
static void Write(mozilla::ProfileBufferEntryWriter& aEW,
|
||||
const ProfilerBacktrace& aBacktrace) {
|
||||
if (!aBacktrace.mProfileBuffer ||
|
||||
SumBytes(*aBacktrace.mProfileChunkedBuffer) == 0) {
|
||||
@ -86,18 +89,18 @@ struct ProfileBufferEntryWriter::Serializer<ProfilerBacktrace> {
|
||||
};
|
||||
|
||||
template <typename Destructor>
|
||||
struct ProfileBufferEntryWriter::Serializer<
|
||||
UniquePtr<ProfilerBacktrace, Destructor>> {
|
||||
struct mozilla::ProfileBufferEntryWriter::Serializer<
|
||||
mozilla::UniquePtr<ProfilerBacktrace, Destructor>> {
|
||||
static Length Bytes(
|
||||
const UniquePtr<ProfilerBacktrace, Destructor>& aBacktrace) {
|
||||
const mozilla::UniquePtr<ProfilerBacktrace, Destructor>& aBacktrace) {
|
||||
if (!aBacktrace) {
|
||||
return ULEB128Size<Length>(0);
|
||||
}
|
||||
return SumBytes(*aBacktrace);
|
||||
}
|
||||
static void Write(
|
||||
ProfileBufferEntryWriter& aEW,
|
||||
const UniquePtr<ProfilerBacktrace, Destructor>& aBacktrace) {
|
||||
mozilla::ProfileBufferEntryWriter& aEW,
|
||||
const mozilla::UniquePtr<ProfilerBacktrace, Destructor>& aBacktrace) {
|
||||
if (!aBacktrace) {
|
||||
aEW.WriteULEB128(0u);
|
||||
return;
|
||||
@ -106,16 +109,17 @@ struct ProfileBufferEntryWriter::Serializer<
|
||||
}
|
||||
};
|
||||
template <typename Destructor>
|
||||
struct ProfileBufferEntryReader::Deserializer<
|
||||
UniquePtr<ProfilerBacktrace, Destructor>> {
|
||||
static void ReadInto(ProfileBufferEntryReader& aER,
|
||||
UniquePtr<ProfilerBacktrace, Destructor>& aBacktrace) {
|
||||
struct mozilla::ProfileBufferEntryReader::Deserializer<
|
||||
mozilla::UniquePtr<ProfilerBacktrace, Destructor>> {
|
||||
static void ReadInto(
|
||||
mozilla::ProfileBufferEntryReader& aER,
|
||||
mozilla::UniquePtr<ProfilerBacktrace, Destructor>& aBacktrace) {
|
||||
aBacktrace = Read(aER);
|
||||
}
|
||||
static UniquePtr<ProfilerBacktrace, Destructor> Read(
|
||||
ProfileBufferEntryReader& aER) {
|
||||
static mozilla::UniquePtr<ProfilerBacktrace, Destructor> Read(
|
||||
mozilla::ProfileBufferEntryReader& aER) {
|
||||
auto profileChunkedBuffer =
|
||||
aER.ReadObject<UniquePtr<ProfileChunkedBuffer>>();
|
||||
aER.ReadObject<mozilla::UniquePtr<ProfileChunkedBuffer>>();
|
||||
if (!profileChunkedBuffer) {
|
||||
return nullptr;
|
||||
}
|
||||
@ -125,9 +129,10 @@ struct ProfileBufferEntryReader::Deserializer<
|
||||
int threadId = aER.ReadObject<int>();
|
||||
std::string name = aER.ReadObject<std::string>();
|
||||
auto profileBuffer = MakeUnique<ProfileBuffer>(*profileChunkedBuffer);
|
||||
return UniquePtr<ProfilerBacktrace, Destructor>{new ProfilerBacktrace(
|
||||
name.c_str(), threadId, std::move(profileChunkedBuffer),
|
||||
std::move(profileBuffer))};
|
||||
return mozilla::UniquePtr<ProfilerBacktrace, Destructor>{
|
||||
new ProfilerBacktrace(name.c_str(), threadId,
|
||||
std::move(profileChunkedBuffer),
|
||||
std::move(profileBuffer))};
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -45,11 +45,11 @@ size_t RegisteredThread::SizeOfIncludingThis(
|
||||
return n;
|
||||
}
|
||||
|
||||
void RegisteredThread::GetRunningEventDelay(const TimeStamp& aNow,
|
||||
TimeDuration& aDelay,
|
||||
TimeDuration& aRunning) {
|
||||
void RegisteredThread::GetRunningEventDelay(const mozilla::TimeStamp& aNow,
|
||||
mozilla::TimeDuration& aDelay,
|
||||
mozilla::TimeDuration& aRunning) {
|
||||
if (mThread) { // can be null right at the start of a process
|
||||
TimeStamp start;
|
||||
mozilla::TimeStamp start;
|
||||
mThread->GetRunningEventDelay(&aDelay, &start);
|
||||
if (!start.IsNull()) {
|
||||
// Note: the timestamp used here will be from when we started to
|
||||
@ -59,6 +59,6 @@ void RegisteredThread::GetRunningEventDelay(const TimeStamp& aNow,
|
||||
return;
|
||||
}
|
||||
}
|
||||
aDelay = TimeDuration();
|
||||
aRunning = TimeDuration();
|
||||
aDelay = mozilla::TimeDuration();
|
||||
aRunning = mozilla::TimeDuration();
|
||||
}
|
||||
|
@ -7,6 +7,7 @@
|
||||
#ifndef RegisteredThread_h
|
||||
#define RegisteredThread_h
|
||||
|
||||
#include "GeckoProfiler.h"
|
||||
#include "platform.h"
|
||||
#include "ThreadInfo.h"
|
||||
|
||||
@ -15,6 +16,7 @@
|
||||
#include "mozilla/NotNull.h"
|
||||
#include "mozilla/RefPtr.h"
|
||||
#include "nsIEventTarget.h"
|
||||
#include "nsIThread.h"
|
||||
|
||||
// This class contains the state for a single thread that is accessible without
|
||||
// protection from gPSMutex in platform.cpp. Because there is no external
|
||||
@ -25,7 +27,7 @@ class RacyRegisteredThread final {
|
||||
public:
|
||||
explicit RacyRegisteredThread(int aThreadId)
|
||||
: mProfilingStackOwner(
|
||||
mozilla::MakeNotNull<RefPtr<class ProfilingStackOwner>>()),
|
||||
mozilla::MakeNotNull<RefPtr<mozilla::ProfilingStackOwner>>()),
|
||||
mThreadId(aThreadId),
|
||||
mSleep(AWAKE),
|
||||
mIsBeingProfiled(false) {
|
||||
@ -88,12 +90,12 @@ class RacyRegisteredThread final {
|
||||
return mProfilingStackOwner->ProfilingStack();
|
||||
}
|
||||
|
||||
class ProfilingStackOwner& ProfilingStackOwner() {
|
||||
mozilla::ProfilingStackOwner& ProfilingStackOwner() {
|
||||
return *mProfilingStackOwner;
|
||||
}
|
||||
|
||||
private:
|
||||
mozilla::NotNull<RefPtr<class ProfilingStackOwner>> mProfilingStackOwner;
|
||||
mozilla::NotNull<RefPtr<mozilla::ProfilingStackOwner>> mProfilingStackOwner;
|
||||
|
||||
// mThreadId contains the thread ID of the current thread. It is safe to read
|
||||
// this from multiple threads concurrently, as it will never be mutated.
|
||||
@ -167,8 +169,9 @@ class RegisteredThread final {
|
||||
// aRunning is the time the event has been running. If no event is
|
||||
// running these will both be TimeDuration() (i.e. 0). Both are out
|
||||
// params, and are always set. Their initial value is discarded.
|
||||
void GetRunningEventDelay(const TimeStamp& aNow, TimeDuration& aDelay,
|
||||
TimeDuration& aRunning);
|
||||
void GetRunningEventDelay(const mozilla::TimeStamp& aNow,
|
||||
mozilla::TimeDuration& aDelay,
|
||||
mozilla::TimeDuration& aRunning);
|
||||
|
||||
size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const;
|
||||
|
||||
|
@ -31,9 +31,10 @@
|
||||
#include "GeckoProfiler.h"
|
||||
#include "GeckoProfilerReporter.h"
|
||||
#include "PageInformation.h"
|
||||
#include "ProfileBuffer.h"
|
||||
#include "ProfiledThreadData.h"
|
||||
#include "ProfilerBacktrace.h"
|
||||
#include "ProfileBuffer.h"
|
||||
#include "ProfilerCodeAddressService.h"
|
||||
#include "ProfilerIOInterposeObserver.h"
|
||||
#include "ProfilerMarkerPayload.h"
|
||||
#include "ProfilerParent.h"
|
||||
|
@ -47,6 +47,7 @@
|
||||
#include "mozilla/Assertions.h"
|
||||
|
||||
#include <stdint.h>
|
||||
#include <string>
|
||||
|
||||
typedef signed char int8;
|
||||
typedef short int16;
|
||||
|
@ -10,6 +10,7 @@
|
||||
#include "PlatformMacros.h"
|
||||
#include "LulMain.h" // for TaggedUWord
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "mozilla/Assertions.h"
|
||||
|
@ -8,6 +8,7 @@
|
||||
#define ProfilerCodeAddressService_h
|
||||
|
||||
#include "CodeAddressService.h"
|
||||
#include "nsTArray.h"
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user