Bug 1757929 - Remove a bunch of IPC headers from gfxFont and co. r=jfkthame,layout-reviewers

Removing the whole chromium IPC config is not possible because
gfxPlatformFontList uses base::*, but this should speed up builds a
little so seems worth landing regardless.

Differential Revision: https://phabricator.services.mozilla.com/D143371
This commit is contained in:
Emilio Cobos Álvarez 2022-05-05 11:37:51 +00:00
parent 3edae2885b
commit 2ee4fc0f24
9 changed files with 67 additions and 77 deletions

View File

@ -7,6 +7,7 @@
#include "AccessCheck.h" #include "AccessCheck.h"
#include "base/basictypes.h" #include "base/basictypes.h"
#include "ipc/IPCMessageUtils.h" #include "ipc/IPCMessageUtils.h"
#include "ipc/IPCMessageUtilsSpecializations.h"
#include "mozilla/EventDispatcher.h" #include "mozilla/EventDispatcher.h"
#include "mozilla/BasePrincipal.h" #include "mozilla/BasePrincipal.h"
#include "mozilla/ContentEvents.h" #include "mozilla/ContentEvents.h"

View File

@ -6,6 +6,7 @@
#include "base/basictypes.h" #include "base/basictypes.h"
#include "ipc/IPCMessageUtils.h" #include "ipc/IPCMessageUtils.h"
#include "ipc/IPCMessageUtilsSpecializations.h"
#include "mozilla/dom/DOMRect.h" #include "mozilla/dom/DOMRect.h"
#include "mozilla/dom/ScrollAreaEvent.h" #include "mozilla/dom/ScrollAreaEvent.h"
#include "mozilla/ContentEvents.h" #include "mozilla/ContentEvents.h"

View File

@ -15,6 +15,7 @@
#include "mozilla/TouchEvents.h" #include "mozilla/TouchEvents.h"
#include "nsContentUtils.h" #include "nsContentUtils.h"
#include "nsIDocShell.h" #include "nsIDocShell.h"
#include "nsExceptionHandler.h"
namespace mozilla::dom { namespace mozilla::dom {

View File

@ -6,6 +6,7 @@
#include "base/basictypes.h" #include "base/basictypes.h"
#include "ipc/IPCMessageUtils.h" #include "ipc/IPCMessageUtils.h"
#include "ipc/IPCMessageUtilsSpecializations.h"
#include "mozilla/dom/UIEvent.h" #include "mozilla/dom/UIEvent.h"
#include "mozilla/ArrayUtils.h" #include "mozilla/ArrayUtils.h"
#include "mozilla/Assertions.h" #include "mozilla/Assertions.h"

View File

@ -12,6 +12,7 @@
#include "RegionBuilder.h" #include "RegionBuilder.h"
#include "chrome/common/ipc_message_utils.h" #include "chrome/common/ipc_message_utils.h"
#include "gfxFeature.h" #include "gfxFeature.h"
#include "gfxFontUtils.h"
#include "gfxFallback.h" #include "gfxFallback.h"
#include "gfxPoint.h" #include "gfxPoint.h"
#include "gfxRect.h" #include "gfxRect.h"
@ -23,6 +24,7 @@
#include "mozilla/gfx/Matrix.h" #include "mozilla/gfx/Matrix.h"
#include "mozilla/gfx/ScaleFactor.h" #include "mozilla/gfx/ScaleFactor.h"
#include "mozilla/gfx/ScaleFactors2D.h" #include "mozilla/gfx/ScaleFactors2D.h"
#include "SharedFontList.h"
#include "nsRect.h" #include "nsRect.h"
#include "nsRegion.h" #include "nsRegion.h"
#include "mozilla/Array.h" #include "mozilla/Array.h"
@ -1136,7 +1138,54 @@ struct ParamTraits<mozilla::SideBits>
: public BitFlagsEnumSerializer<mozilla::SideBits, : public BitFlagsEnumSerializer<mozilla::SideBits,
mozilla::SideBits::eAll> {}; mozilla::SideBits::eAll> {};
} /* namespace IPC */ template <>
struct ParamTraits<gfxSparseBitSet> {
typedef gfxSparseBitSet paramType;
static void Write(MessageWriter* aWriter, const paramType& aParam) {
WriteParam(aWriter, aParam.mBlockIndex);
WriteParam(aWriter, aParam.mBlocks);
}
static bool Read(MessageReader* aReader, paramType* aResult) {
return ReadParam(aReader, &aResult->mBlockIndex) &&
ReadParam(aReader, &aResult->mBlocks);
}
};
template <>
struct ParamTraits<gfxSparseBitSet::Block> {
typedef gfxSparseBitSet::Block paramType;
static void Write(MessageWriter* aWriter, const paramType& aParam) {
aWriter->WriteBytes(&aParam, sizeof(aParam));
}
static bool Read(MessageReader* aReader, paramType* aResult) {
return aReader->ReadBytesInto(aResult, sizeof(*aResult));
}
};
// The actual FontVisibility enum is defined in gfxTypes.h
template <>
struct ParamTraits<FontVisibility>
: public ContiguousEnumSerializer<FontVisibility, FontVisibility::Unknown,
FontVisibility::Count> {};
template <>
struct ParamTraits<mozilla::fontlist::Pointer> {
typedef mozilla::fontlist::Pointer paramType;
static void Write(MessageWriter* aWriter, const paramType& aParam) {
uint32_t v = aParam.mBlockAndOffset;
WriteParam(aWriter, v);
}
static bool Read(MessageReader* aReader, paramType* aResult) {
uint32_t v;
if (ReadParam(aReader, &v)) {
aResult->mBlockAndOffset.store(v);
return true;
}
return false;
}
};
} // namespace IPC
namespace mozilla { namespace mozilla {
namespace ipc { namespace ipc {

View File

@ -378,29 +378,6 @@ struct LocalFaceRec {
} // namespace fontlist } // namespace fontlist
} // namespace mozilla } // namespace mozilla
#include "ipc/IPCMessageUtils.h"
namespace IPC {
template <>
struct ParamTraits<mozilla::fontlist::Pointer> {
typedef mozilla::fontlist::Pointer paramType;
static void Write(MessageWriter* aWriter, const paramType& aParam) {
uint32_t v = aParam.mBlockAndOffset;
WriteParam(aWriter, v);
}
static bool Read(MessageReader* aReader, paramType* aResult) {
uint32_t v;
if (ReadParam(aReader, &v)) {
aResult->mBlockAndOffset.store(v);
return true;
}
return false;
}
};
} // namespace IPC
#undef ERROR // This is defined via Windows.h, but conflicts with some bindings #undef ERROR // This is defined via Windows.h, but conflicts with some bindings
// code when this gets included in the same compilation unit. // code when this gets included in the same compilation unit.

View File

@ -21,11 +21,11 @@
#include "mozilla/Mutex.h" #include "mozilla/Mutex.h"
#include "mozilla/RefPtr.h" #include "mozilla/RefPtr.h"
#include "mozilla/RWLock.h" #include "mozilla/RWLock.h"
#include "mozilla/ServoStyleConsts.h"
#include "mozilla/TypedEnumBits.h" #include "mozilla/TypedEnumBits.h"
#include "mozilla/UniquePtr.h" #include "mozilla/UniquePtr.h"
#include "mozilla/gfx/MatrixFwd.h" #include "mozilla/gfx/MatrixFwd.h"
#include "mozilla/gfx/Point.h" #include "mozilla/gfx/Point.h"
#include "mozilla/gfx/2D.h"
#include "mozilla/intl/UnicodeScriptCodes.h" #include "mozilla/intl/UnicodeScriptCodes.h"
#include "nsCOMPtr.h" #include "nsCOMPtr.h"
#include "nsColor.h" #include "nsColor.h"
@ -43,21 +43,9 @@
#include "nscore.h" #include "nscore.h"
#include "DrawMode.h" #include "DrawMode.h"
// Only required for function bodys // Only required for function bodies
#include <stdlib.h>
#include <string.h>
#include <algorithm>
#include "mozilla/Assertions.h"
#include "mozilla/HashFunctions.h"
#include "mozilla/ServoUtils.h"
#include "mozilla/gfx/2D.h"
#include "gfxFontEntry.h" #include "gfxFontEntry.h"
#include "gfxFontFeatures.h" #include "gfxFontFeatures.h"
#include "gfxFontUtils.h"
#include "gfxPlatform.h"
#include "nsAtom.h"
#include "nsDebug.h"
#include "nsMathUtils.h"
class gfxContext; class gfxContext;
class gfxGraphiteShaper; class gfxGraphiteShaper;
@ -527,6 +515,9 @@ class gfxTextPerfMetrics {
namespace mozilla { namespace mozilla {
namespace gfx { namespace gfx {
class UnscaledFont;
// Flags that live in the gfxShapedText::mFlags field. // Flags that live in the gfxShapedText::mFlags field.
// (Note that gfxTextRun has an additional mFlags2 field for use // (Note that gfxTextRun has an additional mFlags2 field for use
// by textrun clients like nsTextFrame.) // by textrun clients like nsTextFrame.)

View File

@ -15,7 +15,6 @@
#include "gfxRect.h" #include "gfxRect.h"
#include "gfxTypes.h" #include "gfxTypes.h"
#include "harfbuzz/hb.h" #include "harfbuzz/hb.h"
#include "ipc/EnumSerializer.h"
#include "mozilla/AlreadyAddRefed.h" #include "mozilla/AlreadyAddRefed.h"
#include "mozilla/Assertions.h" #include "mozilla/Assertions.h"
#include "mozilla/FontPropertyTypes.h" #include "mozilla/FontPropertyTypes.h"
@ -834,14 +833,6 @@ struct GlobalFontMatch {
double mMatchDistance = INFINITY; // metric indicating closest match double mMatchDistance = INFINITY; // metric indicating closest match
}; };
// The actual FontVisibility enum is defined in gfxTypes.h
namespace IPC {
template <>
struct ParamTraits<FontVisibility>
: public ContiguousEnumSerializer<FontVisibility, FontVisibility::Unknown,
FontVisibility::Count> {};
} // namespace IPC
class gfxFontFamily { class gfxFontFamily {
public: public:
// Used by stylo // Used by stylo

View File

@ -11,8 +11,6 @@
#include <new> #include <new>
#include <utility> #include <utility>
#include "gfxPlatform.h" #include "gfxPlatform.h"
#include "ipc/IPCMessageUtils.h"
#include "ipc/IPCMessageUtilsSpecializations.h"
#include "mozilla/Assertions.h" #include "mozilla/Assertions.h"
#include "mozilla/Attributes.h" #include "mozilla/Attributes.h"
#include "mozilla/Casting.h" #include "mozilla/Casting.h"
@ -51,6 +49,11 @@ typedef struct hb_blob_t hb_blob_t;
class SharedBitSet; class SharedBitSet;
namespace IPC {
template <typename T>
struct ParamTraits;
}
class gfxSparseBitSet { class gfxSparseBitSet {
private: private:
friend class SharedBitSet; friend class SharedBitSet;
@ -66,6 +69,9 @@ class gfxSparseBitSet {
uint8_t mBits[BLOCK_SIZE]; uint8_t mBits[BLOCK_SIZE];
}; };
friend struct IPC::ParamTraits<gfxSparseBitSet>;
friend struct IPC::ParamTraits<Block>;
public: public:
gfxSparseBitSet() = default; gfxSparseBitSet() = default;
@ -331,38 +337,10 @@ class gfxSparseBitSet {
} }
private: private:
friend struct IPC::ParamTraits<gfxSparseBitSet>;
friend struct IPC::ParamTraits<gfxSparseBitSet::Block>;
CopyableTArray<uint16_t> mBlockIndex; CopyableTArray<uint16_t> mBlockIndex;
CopyableTArray<Block> mBlocks; CopyableTArray<Block> mBlocks;
}; };
namespace IPC {
template <>
struct ParamTraits<gfxSparseBitSet> {
typedef gfxSparseBitSet paramType;
static void Write(MessageWriter* aWriter, const paramType& aParam) {
WriteParam(aWriter, aParam.mBlockIndex);
WriteParam(aWriter, aParam.mBlocks);
}
static bool Read(MessageReader* aReader, paramType* aResult) {
return ReadParam(aReader, &aResult->mBlockIndex) &&
ReadParam(aReader, &aResult->mBlocks);
}
};
template <>
struct ParamTraits<gfxSparseBitSet::Block> {
typedef gfxSparseBitSet::Block paramType;
static void Write(MessageWriter* aWriter, const paramType& aParam) {
aWriter->WriteBytes(&aParam, sizeof(aParam));
}
static bool Read(MessageReader* aReader, paramType* aResult) {
return aReader->ReadBytesInto(aResult, sizeof(*aResult));
}
};
} // namespace IPC
/** /**
* SharedBitSet is a version of gfxSparseBitSet that is intended to be used * SharedBitSet is a version of gfxSparseBitSet that is intended to be used
* in a shared-memory block, and can be used regardless of the address at which * in a shared-memory block, and can be used regardless of the address at which