Skip to content

Commit

Permalink
Backed out 6 changesets (bug 1592822) for bustages complaining about …
Browse files Browse the repository at this point in the history
…layout/painting/nsDisplayList.cpp CLOSED TREE

Backed out changeset 90d0f2ebd310 (bug 1592822)
Backed out changeset 9890bad86a0e (bug 1592822)
Backed out changeset 43870cc90433 (bug 1592822)
Backed out changeset d80e0e3f5b87 (bug 1592822)
Backed out changeset 99be49183325 (bug 1592822)
Backed out changeset 9ce641556acc (bug 1592822)
  • Loading branch information
bogdant-old committed Jan 22, 2020
1 parent e55b148 commit 2a866f6
Show file tree
Hide file tree
Showing 22 changed files with 902 additions and 449 deletions.
101 changes: 70 additions & 31 deletions gfx/layers/ipc/LayersMessageUtils.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
#include "mozilla/GfxMessageUtils.h"
#include "mozilla/MotionPathUtils.h"
#include "mozilla/ServoBindings.h"
#include "mozilla/ipc/ByteBufUtils.h"
#include "mozilla/ipc/ByteBuf.h"
#include "mozilla/layers/APZInputBridge.h"
#include "mozilla/layers/APZTypes.h"
#include "mozilla/layers/AsyncDragMetrics.h"
Expand Down Expand Up @@ -815,6 +815,75 @@ struct ParamTraits<mozilla::layers::CompositionPayload> {
}
};

inline mozilla::ipc::ByteBuf ConvertToByteBuf(mozilla::StyleVecU8&& aVec) {
mozilla::ipc::ByteBuf out(aVec.data, aVec.length, aVec.capacity);
aVec.data = nullptr;
aVec.length = 0;
aVec.capacity = 0;
return out;
}

inline mozilla::StyleVecU8 ConvertToStyleVecU8(mozilla::ipc::ByteBuf&& aOther) {
mozilla::StyleVecU8 v;
v.data = aOther.mData;
v.length = aOther.mLen;
v.capacity = aOther.mCapacity;
aOther.mData = nullptr;
aOther.mLen = 0;
aOther.mCapacity = 0;
return v;
}

template <>
struct ParamTraits<mozilla::LengthPercentage> {
typedef mozilla::LengthPercentage paramType;

static void Write(Message* aMsg, const paramType& aParam) {
mozilla::StyleVecU8 v;
mozilla::DebugOnly<bool> rv = Servo_LengthPercentage_Serialize(&aParam, &v);
MOZ_ASSERT(rv, "Serialize LengthPercentage failed");

WriteParam(aMsg, ConvertToByteBuf(std::move(v)));
}

static bool Read(const Message* aMsg, PickleIterator* aIter,
paramType* aResult) {
mozilla::ipc::ByteBuf in;
bool rv = ReadParam(aMsg, aIter, &in);
if (!rv) {
return false;
}

mozilla::StyleVecU8 v = ConvertToStyleVecU8(std::move(in));
return v.data && Servo_LengthPercentage_Deserialize(&v, aResult);
}
};

template <>
struct ParamTraits<mozilla::RayFunction> {
typedef mozilla::RayFunction paramType;

static void Write(Message* aMsg, const paramType& aParam) {
mozilla::StyleVecU8 v;
mozilla::DebugOnly<bool> rv = Servo_RayFunction_Serialize(&aParam, &v);
MOZ_ASSERT(rv, "Serialize RayFunction failed");

WriteParam(aMsg, ConvertToByteBuf(std::move(v)));
}

static bool Read(const Message* aMsg, PickleIterator* aIter,
paramType* aResult) {
mozilla::ipc::ByteBuf in;
bool rv = ReadParam(aMsg, aIter, &in);
if (!rv) {
return false;
}

mozilla::StyleVecU8 v = ConvertToStyleVecU8(std::move(in));
return v.data && Servo_RayFunction_Deserialize(&v, aResult);
}
};

template <>
struct ParamTraits<mozilla::RayReferenceData> {
typedef mozilla::RayReferenceData paramType;
Expand All @@ -831,36 +900,6 @@ struct ParamTraits<mozilla::RayReferenceData> {
}
};

#define IMPL_PARAMTRAITS_BY_SERDE(type_) \
template <> \
struct ParamTraits<mozilla::type_> { \
typedef mozilla::type_ paramType; \
static void Write(Message* aMsg, const paramType& aParam) { \
mozilla::ipc::ByteBuf v; \
mozilla::DebugOnly<bool> rv = Servo_##type_##_Serialize(&aParam, &v); \
MOZ_ASSERT(rv, "Serialize ##type_## failed"); \
WriteParam(aMsg, std::move(v)); \
} \
static bool Read(const Message* aMsg, PickleIterator* aIter, \
paramType* aResult) { \
mozilla::ipc::ByteBuf in; \
bool rv = ReadParam(aMsg, aIter, &in); \
if (!rv) { \
return false; \
} \
return in.mData && Servo_##type_##_Deserialize(&in, aResult); \
} \
};

IMPL_PARAMTRAITS_BY_SERDE(LengthPercentage)
IMPL_PARAMTRAITS_BY_SERDE(StyleOffsetPath)
IMPL_PARAMTRAITS_BY_SERDE(StyleOffsetRotate)
IMPL_PARAMTRAITS_BY_SERDE(StylePositionOrAuto)
IMPL_PARAMTRAITS_BY_SERDE(StyleRotate)
IMPL_PARAMTRAITS_BY_SERDE(StyleScale)
IMPL_PARAMTRAITS_BY_SERDE(StyleTranslate)
IMPL_PARAMTRAITS_BY_SERDE(StyleTransform)

} /* namespace IPC */

#endif /* mozilla_layers_LayersMessageUtils */
136 changes: 122 additions & 14 deletions gfx/layers/ipc/LayersMessages.ipdlh
Original file line number Diff line number Diff line change
Expand Up @@ -59,14 +59,8 @@ using mozilla::layers::LayersId from "mozilla/layers/LayersTypes.h";
using mozilla::layers::TransactionId from "mozilla/layers/LayersTypes.h";
using mozilla::VsyncId from "mozilla/VsyncDispatcher.h";
using mozilla::LengthPercentage from "mozilla/ServoStyleConsts.h";
using mozilla::RayFunction from "mozilla/MotionPathUtils.h";
using mozilla::RayReferenceData from "mozilla/MotionPathUtils.h";
using mozilla::StyleOffsetPath from "mozilla/ServoStyleConsts.h";
using mozilla::StyleOffsetRotate from "mozilla/ServoStyleConsts.h";
using mozilla::StylePositionOrAuto from "mozilla/ServoStyleConsts.h";
using mozilla::StyleRotate from "mozilla/ServoStyleConsts.h";
using mozilla::StyleScale from "mozilla/ServoStyleConsts.h";
using mozilla::StyleTranslate from "mozilla/ServoStyleConsts.h";
using mozilla::StyleTransform from "mozilla/ServoStyleConsts.h";

namespace mozilla {
namespace layers {
Expand Down Expand Up @@ -119,20 +113,134 @@ union TimingFunction {
StepFunction;
};

// Send the angle with units rather than sending all angles in radians
// to avoid having floating point error introduced by unit switching.
struct CSSAngle {
float value;
int unit; // an nsCSSUnit that is valid for angles
};

struct LayerColor { Color value; };
struct Perspective { float value; };
struct RotationX { CSSAngle angle; };
struct RotationY { CSSAngle angle; };
struct RotationZ { CSSAngle angle; };
struct Rotation { CSSAngle angle; };
struct Rotation3D {
float x;
float y;
float z;
CSSAngle angle;
};
struct Scale {
float x;
float y;
float z;
};
struct Skew { CSSAngle x; CSSAngle y; };
struct SkewX { CSSAngle x; };
struct SkewY { CSSAngle y; };
struct TransformMatrix { Matrix4x4 value; };
struct Translation {
float x;
float y;
float z;
};

union Rotate {
// null_t represents |rotate: none|.
null_t;
Rotation;
Rotation3D;
};

union TransformFunction {
Perspective;
RotationX;
RotationY;
RotationZ;
Rotation;
Rotation3D;
Scale;
Skew;
SkewX;
SkewY;
Translation;
TransformMatrix;
};

struct MoveTo { Point point; };
struct LineTo { Point point; };
struct HorizontalLineTo { float x; };
struct VerticalLineTo { float y; };
struct CurveTo {
Point control1;
Point control2;
Point point;
};
struct SmoothCurveTo { Point control2; Point point; };
struct QuadBezierCurveTo { Point control1; Point point; };
struct SmoothQuadBezierCurveTo { Point point; };
struct EllipticalArc {
float rx;
float ry;
float angle;
bool largeArcFlag;
bool sweepFlag;
Point point;
};

// PathCommand should be always absolute because we normalize it when passing
// it through ipc.
union PathCommand {
// Use null_t to represent ClosePath.
null_t;
MoveTo;
LineTo;
HorizontalLineTo;
VerticalLineTo;
CurveTo;
SmoothCurveTo;
QuadBezierCurveTo;
SmoothQuadBezierCurveTo;
EllipticalArc;
};

union OffsetPath {
// null_t represents None.
null_t;
PathCommand[];
RayFunction;
};

struct OffsetRotate {
CSSAngle angle;
bool isAuto;
};

struct AnchorPosition {
LengthPercentage horizontal;
LengthPercentage vertical;
};

union OffsetAnchor {
// null_t represents auto
null_t;
AnchorPosition;
};

union Animatable {
null_t;
float;
nscolor;
StyleRotate;
StyleScale;
StyleTranslate;
StyleTransform;
StyleOffsetPath;
Rotate;
Scale;
Translation;
TransformFunction[];
OffsetPath;
LengthPercentage;
StyleOffsetRotate;
StylePositionOrAuto;
OffsetRotate;
OffsetAnchor;
};

struct AnimationSegment {
Expand Down
44 changes: 37 additions & 7 deletions ipc/glue/ByteBuf.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,7 @@
#ifndef mozilla_ipc_ByteBuf_h
#define mozilla_ipc_ByteBuf_h

#include "mozilla/Assertions.h"

namespace IPC {
template <typename T>
struct ParamTraits;
}
#include "ipc/IPCMessageUtils.h"

namespace mozilla {

Expand Down Expand Up @@ -68,4 +63,39 @@ class ByteBuf final {
} // namespace ipc
} // namespace mozilla

#endif // ifndef mozilla_ipc_ByteBuf_h
namespace IPC {

template <>
struct ParamTraits<mozilla::ipc::ByteBuf> {
typedef mozilla::ipc::ByteBuf paramType;

// this is where we transfer the memory from the ByteBuf to IPDL, avoiding a
// copy
static void Write(Message* aMsg, paramType&& aParam) {
WriteParam(aMsg, aParam.mLen);
// hand over ownership of the buffer to the Message
aMsg->WriteBytesZeroCopy(aParam.mData, aParam.mLen, aParam.mCapacity);
aParam.mData = nullptr;
aParam.mCapacity = 0;
aParam.mLen = 0;
}

static bool Read(const Message* aMsg, PickleIterator* aIter,
paramType* aResult) {
// We make a copy from the BufferList so that we get a contigous result.
// For users the can handle a non-contiguous result using ExtractBuffers
// is an option, alternatively if the users don't need to take ownership of
// the data they can use the removed FlattenBytes (bug 1297981)
size_t length;
return ReadParam(aMsg, aIter, &length) && aResult->Allocate(length) &&
aMsg->ReadBytesInto(aIter, aResult->mData, length);
}

static void Log(const paramType& aParam, std::wstring* aLog) {
aLog->append(L"(byte buf)");
}
};

} // namespace IPC

#endif // ifndef mozilla_ipc_Shmem_h
52 changes: 0 additions & 52 deletions ipc/glue/ByteBufUtils.h

This file was deleted.

1 change: 0 additions & 1 deletion ipc/glue/moz.build
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ EXPORTS.mozilla.ipc += [
'BackgroundUtils.h',
'BrowserProcessSubThread.h',
'ByteBuf.h',
'ByteBufUtils.h',
'CrashReporterClient.h',
'CrashReporterHelper.h',
'CrashReporterHost.h',
Expand Down
Loading

0 comments on commit 2a866f6

Please sign in to comment.