зеркало из https://github.com/mozilla/gecko-dev.git
Backed out 2 changesets (bug 1720965) for causing bustages on nsContentUtils.cpp. CLOSED TREE
Backed out changeset 2ed56ddce45a (bug 1720965) Backed out changeset 3531708ab54e (bug 1720965)
This commit is contained in:
Родитель
0aaa1c42b8
Коммит
e954091acf
|
@ -903,10 +903,8 @@ RefPtr<gfx::SourceSurface> ClientWebGLContext::GetFrontBufferSnapshot(
|
|||
if (!child->SendGetFrontBufferSnapshot(&res)) {
|
||||
res = {};
|
||||
}
|
||||
if (!res.shmem) return nullptr;
|
||||
|
||||
const auto& surfSize = res.surfSize;
|
||||
const webgl::RaiiShmem shmem{child, res.shmem.ref()};
|
||||
const webgl::RaiiShmem shmem{child, res.shmem};
|
||||
const auto& shmemBytes = shmem.ByteRange();
|
||||
if (!surfSize.x) return nullptr; // Zero means failure.
|
||||
|
||||
|
|
|
@ -112,9 +112,9 @@ template <>
|
|||
struct IPDLParamTraits<mozilla::webgl::FrontBufferSnapshotIpc> final {
|
||||
using T = mozilla::webgl::FrontBufferSnapshotIpc;
|
||||
|
||||
static void Write(IPC::Message* const msg, IProtocol* actor, const T& in) {
|
||||
static void Write(IPC::Message* const msg, IProtocol* actor, T& in) {
|
||||
WriteParam(msg, in.surfSize);
|
||||
WriteIPDLParam(msg, actor, in.shmem);
|
||||
WriteIPDLParam(msg, actor, std::move(in.shmem));
|
||||
}
|
||||
|
||||
static bool Read(const IPC::Message* const msg, PickleIterator* const itr,
|
||||
|
@ -130,10 +130,10 @@ template <>
|
|||
struct IPDLParamTraits<mozilla::webgl::ReadPixelsResultIpc> final {
|
||||
using T = mozilla::webgl::ReadPixelsResultIpc;
|
||||
|
||||
static void Write(IPC::Message* const msg, IProtocol* actor, const T& in) {
|
||||
static void Write(IPC::Message* const msg, IProtocol* actor, T& in) {
|
||||
WriteParam(msg, in.subrect);
|
||||
WriteParam(msg, in.byteStride);
|
||||
WriteIPDLParam(msg, actor, in.shmem);
|
||||
WriteIPDLParam(msg, actor, std::move(in.shmem));
|
||||
}
|
||||
|
||||
static bool Read(const IPC::Message* const msg, PickleIterator* const itr,
|
||||
|
|
|
@ -100,16 +100,16 @@ IPCResult WebGLParent::RecvGetFrontBufferSnapshot(
|
|||
NS_WARNING("Failed to alloc shmem for RecvGetFrontBufferSnapshot.");
|
||||
return IPC_FAIL(this, "Failed to allocate shmem for result");
|
||||
}
|
||||
const auto range = shmem.ByteRange();
|
||||
*ret = {surfSize, Some(shmem.Extract())};
|
||||
|
||||
const auto range = shmem.ByteRange();
|
||||
auto retSize = surfSize;
|
||||
if (!mHost->FrontBufferSnapshotInto(Some(range))) {
|
||||
gfxCriticalNote << "WebGLParent::RecvGetFrontBufferSnapshot: "
|
||||
"FrontBufferSnapshotInto(some) failed after "
|
||||
"FrontBufferSnapshotInto(none)";
|
||||
// Zero means failure, as we still need to send any shmem we alloc.
|
||||
ret->surfSize = {0, 0};
|
||||
retSize = {0, 0}; // Zero means failure.
|
||||
}
|
||||
*ret = {retSize, shmem.Extract()};
|
||||
}
|
||||
return IPC_OK();
|
||||
}
|
||||
|
|
|
@ -740,7 +740,7 @@ struct GetUniformData final {
|
|||
|
||||
struct FrontBufferSnapshotIpc final {
|
||||
uvec2 surfSize = {};
|
||||
Maybe<mozilla::ipc::Shmem> shmem = {};
|
||||
mozilla::ipc::Shmem shmem = {};
|
||||
};
|
||||
|
||||
struct ReadPixelsResult {
|
||||
|
|
|
@ -1213,7 +1213,7 @@ struct IPDLParamTraits<gfx::PaintFragment> {
|
|||
aParam.mRecording.mLen);
|
||||
|
||||
WriteParam(aMsg, aParam.mSize);
|
||||
WriteIPDLParam(aMsg, aActor, shmem);
|
||||
WriteIPDLParam(aMsg, aActor, std::move(shmem));
|
||||
WriteParam(aMsg, aParam.mDependencies);
|
||||
}
|
||||
|
||||
|
|
|
@ -265,7 +265,7 @@ void Shmem::AssertInvariants() const {
|
|||
Unused << checkMappingBack;
|
||||
}
|
||||
|
||||
void Shmem::RevokeRights(PrivateIPDLCaller) const {
|
||||
void Shmem::RevokeRights(PrivateIPDLCaller) {
|
||||
AssertInvariants();
|
||||
|
||||
size_t pageSize = SharedMemory::SystemPageSize();
|
||||
|
@ -437,11 +437,11 @@ UniquePtr<IPC::Message> Shmem::UnshareFrom(PrivateIPDLCaller,
|
|||
}
|
||||
|
||||
void IPDLParamTraits<Shmem>::Write(IPC::Message* aMsg, IProtocol* aActor,
|
||||
const Shmem& aParam) {
|
||||
MOZ_ASSERT(aParam.IsReadable());
|
||||
Shmem&& aParam) {
|
||||
WriteIPDLParam(aMsg, aActor, aParam.mId);
|
||||
|
||||
aParam.RevokeRights(Shmem::PrivateIPDLCaller());
|
||||
aParam.forget(Shmem::PrivateIPDLCaller());
|
||||
}
|
||||
|
||||
bool IPDLParamTraits<Shmem>::Read(const IPC::Message* aMsg,
|
||||
|
|
|
@ -138,9 +138,9 @@ class Shmem final {
|
|||
SharedMemory* Segment(PrivateIPDLCaller) const { return mSegment; }
|
||||
|
||||
#ifndef DEBUG
|
||||
void RevokeRights(PrivateIPDLCaller) const {}
|
||||
void RevokeRights(PrivateIPDLCaller) {}
|
||||
#else
|
||||
void RevokeRights(PrivateIPDLCaller) const;
|
||||
void RevokeRights(PrivateIPDLCaller);
|
||||
#endif
|
||||
|
||||
void forget(PrivateIPDLCaller) {
|
||||
|
|
|
@ -18,20 +18,7 @@ template <>
|
|||
struct IPDLParamTraits<Shmem> {
|
||||
typedef Shmem paramType;
|
||||
|
||||
// NB: std::move(Shmem) is a /copy/.
|
||||
// It would be nice to make a Shmem a move-only class, but the ipdlh
|
||||
// generator can't handle those yet. One solution would be to use a dumb
|
||||
// struct/descriptor for ipdlh purposes. Arguably this dumb non-move-only
|
||||
// struct *is* Shmem.
|
||||
// Because Shmem is not move-only, when previous versions of this code
|
||||
// required Shmem&& here, it caused devs to assume that Shmem was move-aware,
|
||||
// when it is not. People would then cargo-cult std::move(shmem), even though
|
||||
// that's a copy. This can be a sign that people are getting the wrong idea
|
||||
// about how to use it, and when things happen. In particular,
|
||||
// `std::move(shmem)` leaves the strong references in `shmem` intact, and we
|
||||
// should avoid causing readers to believe otherwise.
|
||||
static void Write(IPC::Message* aMsg, IProtocol* aActor,
|
||||
const paramType& aParam);
|
||||
static void Write(IPC::Message* aMsg, IProtocol* aActor, paramType&& aParam);
|
||||
static bool Read(const IPC::Message* aMsg, PickleIterator* aIter,
|
||||
IProtocol* aActor, paramType* aResult);
|
||||
|
||||
|
|
|
@ -559,6 +559,9 @@ def _cxxConstRefType(ipdltype, side):
|
|||
t = _cxxBareType(ipdltype, side)
|
||||
if ipdltype.isIPDL() and ipdltype.isActor():
|
||||
return t
|
||||
if ipdltype.isIPDL() and ipdltype.isShmem():
|
||||
t.ref = True
|
||||
return t
|
||||
if ipdltype.isIPDL() and ipdltype.isByteBuf():
|
||||
t.ref = True
|
||||
return t
|
||||
|
@ -610,7 +613,8 @@ def _cxxTypeNeedsMoveForSend(ipdltype):
|
|||
if ipdltype.hasBaseType():
|
||||
return _cxxTypeNeedsMove(ipdltype.basetype)
|
||||
return (
|
||||
ipdltype.isByteBuf()
|
||||
ipdltype.isShmem()
|
||||
or ipdltype.isByteBuf()
|
||||
or ipdltype.isEndpoint()
|
||||
or ipdltype.isManagedEndpoint()
|
||||
)
|
||||
|
@ -845,6 +849,8 @@ class _StructField(_CompoundTypeComponent):
|
|||
def constRefExpr(self, thisexpr=None):
|
||||
# sigh, gross hack
|
||||
refexpr = self.refExpr(thisexpr)
|
||||
if "Shmem" == self.ipdltype.name():
|
||||
refexpr = ExprCast(refexpr, Type("Shmem", ref=True), const=True)
|
||||
if "ByteBuf" == self.ipdltype.name():
|
||||
refexpr = ExprCast(refexpr, Type("ByteBuf", ref=True), const=True)
|
||||
if "FileDescriptor" == self.ipdltype.name():
|
||||
|
@ -1024,6 +1030,8 @@ class _UnionMember(_CompoundTypeComponent):
|
|||
# sigh
|
||||
if "ByteBuf" == self.ipdltype.name():
|
||||
v = ExprCast(v, Type("ByteBuf", ref=True), const=True)
|
||||
if "Shmem" == self.ipdltype.name():
|
||||
v = ExprCast(v, Type("Shmem", ref=True), const=True)
|
||||
if "FileDescriptor" == self.ipdltype.name():
|
||||
v = ExprCast(v, Type("FileDescriptor", ref=True), const=True)
|
||||
return v
|
||||
|
|
Загрузка…
Ссылка в новой задаче