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 "mozilla/JSONStringWriteFuncs.h"
|
||||
#include "mozilla/ipc/IPDLParamTraits.h"
|
||||
#include "platform.h"
|
||||
|
||||
#ifdef MOZ_GECKO_PROFILER
|
||||
# include "platform.h"
|
||||
|
||||
void mozilla::ProfileGenerationAdditionalInformation::ToJSValue(
|
||||
JSContext* aCx, JS::MutableHandle<JS::Value> aRetVal) const {
|
||||
|
|
@ -34,9 +36,11 @@ void mozilla::ProfileGenerationAdditionalInformation::ToJSValue(
|
|||
JS_SetProperty(aCx, additionalInfoObj, "sharedLibraries", sharedLibrariesVal);
|
||||
aRetVal.setObject(*additionalInfoObj);
|
||||
}
|
||||
#endif // MOZ_GECKO_PROFILER
|
||||
|
||||
namespace IPC {
|
||||
|
||||
#ifdef MOZ_GECKO_PROFILER
|
||||
void IPC::ParamTraits<SharedLibrary>::Write(MessageWriter* aWriter,
|
||||
const paramType& aParam) {
|
||||
WriteParam(aWriter, aParam.mStart);
|
||||
|
|
@ -77,15 +81,22 @@ bool IPC::ParamTraits<SharedLibraryInfo>::Read(MessageReader* aReader,
|
|||
paramType* aResult) {
|
||||
return ReadParam(aReader, &aResult->mEntries);
|
||||
}
|
||||
#endif // MOZ_GECKO_PROFILER
|
||||
|
||||
void IPC::ParamTraits<mozilla::ProfileGenerationAdditionalInformation>::Write(
|
||||
MessageWriter* aWriter, const paramType& aParam) {
|
||||
#ifdef MOZ_GECKO_PROFILER
|
||||
WriteParam(aWriter, aParam.mSharedLibraries);
|
||||
#endif // MOZ_GECKO_PROFILER
|
||||
}
|
||||
|
||||
bool IPC::ParamTraits<mozilla::ProfileGenerationAdditionalInformation>::Read(
|
||||
MessageReader* aReader, paramType* aResult) {
|
||||
#ifdef MOZ_GECKO_PROFILER
|
||||
return ReadParam(aReader, &aResult->mSharedLibraries);
|
||||
#else
|
||||
return true;
|
||||
#endif // MOZ_GECKO_PROFILER
|
||||
}
|
||||
|
||||
} // namespace IPC
|
||||
|
|
|
|||
|
|
@ -55,8 +55,9 @@ class ChildProfilerController final {
|
|||
mozilla::ipc::Endpoint<PProfilerChild>&& aEndpoint) {
|
||||
return nullptr;
|
||||
}
|
||||
[[nodiscard]] nsCString GrabShutdownProfileAndShutdown() {
|
||||
return EmptyCString();
|
||||
[[nodiscard]] ProfileAndAdditionalInformation
|
||||
GrabShutdownProfileAndShutdown() {
|
||||
return ProfileAndAdditionalInformation(std::move(EmptyCString()));
|
||||
}
|
||||
void Shutdown() {}
|
||||
|
||||
|
|
|
|||
|
|
@ -14,8 +14,11 @@
|
|||
#ifndef ProfileAdditionalInformation_h
|
||||
#define ProfileAdditionalInformation_h
|
||||
|
||||
#include "shared-libraries.h"
|
||||
#ifdef MOZ_GECKO_PROFILER
|
||||
# include "shared-libraries.h"
|
||||
#endif
|
||||
#include "js/Value.h"
|
||||
#include "nsString.h"
|
||||
|
||||
namespace IPC {
|
||||
class MessageReader;
|
||||
|
|
@ -28,6 +31,7 @@ namespace mozilla {
|
|||
// This structure contains additional information gathered while generating the
|
||||
// profile json and iterating the buffer.
|
||||
struct ProfileGenerationAdditionalInformation {
|
||||
#ifdef MOZ_GECKO_PROFILER
|
||||
ProfileGenerationAdditionalInformation() = default;
|
||||
explicit ProfileGenerationAdditionalInformation(
|
||||
const SharedLibraryInfo&& aSharedLibraries)
|
||||
|
|
@ -44,6 +48,7 @@ struct ProfileGenerationAdditionalInformation {
|
|||
void ToJSValue(JSContext* aCx, JS::MutableHandle<JS::Value> aRetVal) const;
|
||||
|
||||
SharedLibraryInfo mSharedLibraries;
|
||||
#endif // MOZ_GECKO_PROFILER
|
||||
};
|
||||
|
||||
struct ProfileAndAdditionalInformation {
|
||||
|
|
@ -59,9 +64,11 @@ struct ProfileAndAdditionalInformation {
|
|||
|
||||
size_t SizeOf() const {
|
||||
size_t size = mProfile.Length();
|
||||
#ifdef MOZ_GECKO_PROFILER
|
||||
if (mAdditionalInformation.isSome()) {
|
||||
size += mAdditionalInformation->SizeOf();
|
||||
}
|
||||
#endif
|
||||
return size;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue