forked from mirrors/gecko-dev
Bug 1822862 - Fix profiler build errors on non-MOZ_GECKO_PROFILER platforms r=mstange
Differential Revision: https://phabricator.services.mozilla.com/D172846
This commit is contained in:
parent
42a177a0d7
commit
2b7a0266d8
3 changed files with 23 additions and 4 deletions
|
|
@ -12,7 +12,9 @@
|
||||||
#include "js/Value.h"
|
#include "js/Value.h"
|
||||||
#include "mozilla/JSONStringWriteFuncs.h"
|
#include "mozilla/JSONStringWriteFuncs.h"
|
||||||
#include "mozilla/ipc/IPDLParamTraits.h"
|
#include "mozilla/ipc/IPDLParamTraits.h"
|
||||||
#include "platform.h"
|
|
||||||
|
#ifdef MOZ_GECKO_PROFILER
|
||||||
|
# include "platform.h"
|
||||||
|
|
||||||
void mozilla::ProfileGenerationAdditionalInformation::ToJSValue(
|
void mozilla::ProfileGenerationAdditionalInformation::ToJSValue(
|
||||||
JSContext* aCx, JS::MutableHandle<JS::Value> aRetVal) const {
|
JSContext* aCx, JS::MutableHandle<JS::Value> aRetVal) const {
|
||||||
|
|
@ -34,9 +36,11 @@ void mozilla::ProfileGenerationAdditionalInformation::ToJSValue(
|
||||||
JS_SetProperty(aCx, additionalInfoObj, "sharedLibraries", sharedLibrariesVal);
|
JS_SetProperty(aCx, additionalInfoObj, "sharedLibraries", sharedLibrariesVal);
|
||||||
aRetVal.setObject(*additionalInfoObj);
|
aRetVal.setObject(*additionalInfoObj);
|
||||||
}
|
}
|
||||||
|
#endif // MOZ_GECKO_PROFILER
|
||||||
|
|
||||||
namespace IPC {
|
namespace IPC {
|
||||||
|
|
||||||
|
#ifdef MOZ_GECKO_PROFILER
|
||||||
void IPC::ParamTraits<SharedLibrary>::Write(MessageWriter* aWriter,
|
void IPC::ParamTraits<SharedLibrary>::Write(MessageWriter* aWriter,
|
||||||
const paramType& aParam) {
|
const paramType& aParam) {
|
||||||
WriteParam(aWriter, aParam.mStart);
|
WriteParam(aWriter, aParam.mStart);
|
||||||
|
|
@ -77,15 +81,22 @@ bool IPC::ParamTraits<SharedLibraryInfo>::Read(MessageReader* aReader,
|
||||||
paramType* aResult) {
|
paramType* aResult) {
|
||||||
return ReadParam(aReader, &aResult->mEntries);
|
return ReadParam(aReader, &aResult->mEntries);
|
||||||
}
|
}
|
||||||
|
#endif // MOZ_GECKO_PROFILER
|
||||||
|
|
||||||
void IPC::ParamTraits<mozilla::ProfileGenerationAdditionalInformation>::Write(
|
void IPC::ParamTraits<mozilla::ProfileGenerationAdditionalInformation>::Write(
|
||||||
MessageWriter* aWriter, const paramType& aParam) {
|
MessageWriter* aWriter, const paramType& aParam) {
|
||||||
|
#ifdef MOZ_GECKO_PROFILER
|
||||||
WriteParam(aWriter, aParam.mSharedLibraries);
|
WriteParam(aWriter, aParam.mSharedLibraries);
|
||||||
|
#endif // MOZ_GECKO_PROFILER
|
||||||
}
|
}
|
||||||
|
|
||||||
bool IPC::ParamTraits<mozilla::ProfileGenerationAdditionalInformation>::Read(
|
bool IPC::ParamTraits<mozilla::ProfileGenerationAdditionalInformation>::Read(
|
||||||
MessageReader* aReader, paramType* aResult) {
|
MessageReader* aReader, paramType* aResult) {
|
||||||
|
#ifdef MOZ_GECKO_PROFILER
|
||||||
return ReadParam(aReader, &aResult->mSharedLibraries);
|
return ReadParam(aReader, &aResult->mSharedLibraries);
|
||||||
|
#else
|
||||||
|
return true;
|
||||||
|
#endif // MOZ_GECKO_PROFILER
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace IPC
|
} // namespace IPC
|
||||||
|
|
|
||||||
|
|
@ -55,8 +55,9 @@ class ChildProfilerController final {
|
||||||
mozilla::ipc::Endpoint<PProfilerChild>&& aEndpoint) {
|
mozilla::ipc::Endpoint<PProfilerChild>&& aEndpoint) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
[[nodiscard]] nsCString GrabShutdownProfileAndShutdown() {
|
[[nodiscard]] ProfileAndAdditionalInformation
|
||||||
return EmptyCString();
|
GrabShutdownProfileAndShutdown() {
|
||||||
|
return ProfileAndAdditionalInformation(std::move(EmptyCString()));
|
||||||
}
|
}
|
||||||
void Shutdown() {}
|
void Shutdown() {}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -14,8 +14,11 @@
|
||||||
#ifndef ProfileAdditionalInformation_h
|
#ifndef ProfileAdditionalInformation_h
|
||||||
#define ProfileAdditionalInformation_h
|
#define ProfileAdditionalInformation_h
|
||||||
|
|
||||||
#include "shared-libraries.h"
|
#ifdef MOZ_GECKO_PROFILER
|
||||||
|
# include "shared-libraries.h"
|
||||||
|
#endif
|
||||||
#include "js/Value.h"
|
#include "js/Value.h"
|
||||||
|
#include "nsString.h"
|
||||||
|
|
||||||
namespace IPC {
|
namespace IPC {
|
||||||
class MessageReader;
|
class MessageReader;
|
||||||
|
|
@ -28,6 +31,7 @@ namespace mozilla {
|
||||||
// This structure contains additional information gathered while generating the
|
// This structure contains additional information gathered while generating the
|
||||||
// profile json and iterating the buffer.
|
// profile json and iterating the buffer.
|
||||||
struct ProfileGenerationAdditionalInformation {
|
struct ProfileGenerationAdditionalInformation {
|
||||||
|
#ifdef MOZ_GECKO_PROFILER
|
||||||
ProfileGenerationAdditionalInformation() = default;
|
ProfileGenerationAdditionalInformation() = default;
|
||||||
explicit ProfileGenerationAdditionalInformation(
|
explicit ProfileGenerationAdditionalInformation(
|
||||||
const SharedLibraryInfo&& aSharedLibraries)
|
const SharedLibraryInfo&& aSharedLibraries)
|
||||||
|
|
@ -44,6 +48,7 @@ struct ProfileGenerationAdditionalInformation {
|
||||||
void ToJSValue(JSContext* aCx, JS::MutableHandle<JS::Value> aRetVal) const;
|
void ToJSValue(JSContext* aCx, JS::MutableHandle<JS::Value> aRetVal) const;
|
||||||
|
|
||||||
SharedLibraryInfo mSharedLibraries;
|
SharedLibraryInfo mSharedLibraries;
|
||||||
|
#endif // MOZ_GECKO_PROFILER
|
||||||
};
|
};
|
||||||
|
|
||||||
struct ProfileAndAdditionalInformation {
|
struct ProfileAndAdditionalInformation {
|
||||||
|
|
@ -59,9 +64,11 @@ struct ProfileAndAdditionalInformation {
|
||||||
|
|
||||||
size_t SizeOf() const {
|
size_t SizeOf() const {
|
||||||
size_t size = mProfile.Length();
|
size_t size = mProfile.Length();
|
||||||
|
#ifdef MOZ_GECKO_PROFILER
|
||||||
if (mAdditionalInformation.isSome()) {
|
if (mAdditionalInformation.isSome()) {
|
||||||
size += mAdditionalInformation->SizeOf();
|
size += mAdditionalInformation->SizeOf();
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
return size;
|
return size;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue