mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-23 12:51:06 +00:00
Bug 1754037 - Part 3c: Automatically update all ParamTraits implementations, r=ipc-reviewers,media-playback-reviewers,bryce,mccr8
Automatically generated rewrites of all ParamTraits and IPDLParamTraits implementations in-tree to use IPC::Message{Reader,Writer}. Differential Revision: https://phabricator.services.mozilla.com/D140004
This commit is contained in:
parent
1d44e4355c
commit
05dc5e0d76
@ -49,13 +49,12 @@ template <>
|
||||
struct ParamTraits<mozilla::a11y::FontSize> {
|
||||
typedef mozilla::a11y::FontSize paramType;
|
||||
|
||||
static void Write(Message* aMsg, const paramType& aParam) {
|
||||
WriteParam(aMsg, aParam.mValue);
|
||||
static void Write(MessageWriter* aWriter, const paramType& aParam) {
|
||||
WriteParam(aWriter, aParam.mValue);
|
||||
}
|
||||
|
||||
static bool Read(const Message* aMsg, PickleIterator* aIter,
|
||||
paramType* aResult) {
|
||||
return ReadParam(aMsg, aIter, &(aResult->mValue));
|
||||
static bool Read(MessageReader* aReader, paramType* aResult) {
|
||||
return ReadParam(aReader, &(aResult->mValue));
|
||||
}
|
||||
};
|
||||
|
||||
@ -63,13 +62,12 @@ template <>
|
||||
struct ParamTraits<mozilla::a11y::DeleteEntry> {
|
||||
typedef mozilla::a11y::DeleteEntry paramType;
|
||||
|
||||
static void Write(Message* aMsg, const paramType& aParam) {
|
||||
WriteParam(aMsg, aParam.mValue);
|
||||
static void Write(MessageWriter* aWriter, const paramType& aParam) {
|
||||
WriteParam(aWriter, aParam.mValue);
|
||||
}
|
||||
|
||||
static bool Read(const Message* aMsg, PickleIterator* aIter,
|
||||
paramType* aResult) {
|
||||
return ReadParam(aMsg, aIter, &(aResult->mValue));
|
||||
static bool Read(MessageReader* aReader, paramType* aResult) {
|
||||
return ReadParam(aReader, &(aResult->mValue));
|
||||
}
|
||||
};
|
||||
|
||||
@ -77,12 +75,11 @@ template <>
|
||||
struct ParamTraits<mozilla::a11y::AccGroupInfo> {
|
||||
typedef mozilla::a11y::AccGroupInfo paramType;
|
||||
|
||||
static void Write(Message* aMsg, const paramType& aParam) {
|
||||
static void Write(MessageWriter* aWriter, const paramType& aParam) {
|
||||
MOZ_ASSERT_UNREACHABLE("Cannot serialize AccGroupInfo");
|
||||
}
|
||||
|
||||
static bool Read(const Message* aMsg, PickleIterator* aIter,
|
||||
paramType* aResult) {
|
||||
static bool Read(MessageReader* aReader, paramType* aResult) {
|
||||
MOZ_ASSERT_UNREACHABLE("Cannot de-serialize AccGroupInfo");
|
||||
return false;
|
||||
}
|
||||
@ -92,13 +89,12 @@ template <>
|
||||
struct ParamTraits<mozilla::a11y::Color> {
|
||||
typedef mozilla::a11y::Color paramType;
|
||||
|
||||
static void Write(Message* aMsg, const paramType& aParam) {
|
||||
WriteParam(aMsg, aParam.mValue);
|
||||
static void Write(MessageWriter* aWriter, const paramType& aParam) {
|
||||
WriteParam(aWriter, aParam.mValue);
|
||||
}
|
||||
|
||||
static bool Read(const Message* aMsg, PickleIterator* aIter,
|
||||
paramType* aResult) {
|
||||
return ReadParam(aMsg, aIter, &(aResult->mValue));
|
||||
static bool Read(MessageReader* aReader, paramType* aResult) {
|
||||
return ReadParam(aReader, &(aResult->mValue));
|
||||
}
|
||||
};
|
||||
|
||||
@ -106,27 +102,26 @@ template <>
|
||||
struct ParamTraits<mozilla::a11y::AccAttributes*> {
|
||||
typedef mozilla::a11y::AccAttributes paramType;
|
||||
|
||||
static void Write(Message* aMsg, const paramType* aParam) {
|
||||
static void Write(MessageWriter* aWriter, const paramType* aParam) {
|
||||
if (!aParam) {
|
||||
WriteParam(aMsg, true);
|
||||
WriteParam(aWriter, true);
|
||||
return;
|
||||
}
|
||||
|
||||
WriteParam(aMsg, false);
|
||||
WriteParam(aWriter, false);
|
||||
uint32_t count = aParam->mData.Count();
|
||||
WriteParam(aMsg, count);
|
||||
WriteParam(aWriter, count);
|
||||
for (auto iter = aParam->mData.ConstIter(); !iter.Done(); iter.Next()) {
|
||||
RefPtr<nsAtom> key = iter.Key();
|
||||
WriteParam(aMsg, key);
|
||||
WriteParam(aWriter, key);
|
||||
const paramType::AttrValueType& data = iter.Data();
|
||||
WriteParam(aMsg, data);
|
||||
WriteParam(aWriter, data);
|
||||
}
|
||||
}
|
||||
|
||||
static bool Read(const Message* aMsg, PickleIterator* aIter,
|
||||
RefPtr<paramType>* aResult) {
|
||||
static bool Read(MessageReader* aReader, RefPtr<paramType>* aResult) {
|
||||
bool isNull = false;
|
||||
if (!ReadParam(aMsg, aIter, &isNull)) {
|
||||
if (!ReadParam(aReader, &isNull)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -137,16 +132,16 @@ struct ParamTraits<mozilla::a11y::AccAttributes*> {
|
||||
|
||||
*aResult = mozilla::MakeRefPtr<mozilla::a11y::AccAttributes>();
|
||||
uint32_t count;
|
||||
if (!ReadParam(aMsg, aIter, &count)) {
|
||||
if (!ReadParam(aReader, &count)) {
|
||||
return false;
|
||||
}
|
||||
for (uint32_t i = 0; i < count; ++i) {
|
||||
RefPtr<nsAtom> key;
|
||||
if (!ReadParam(aMsg, aIter, &key)) {
|
||||
if (!ReadParam(aReader, &key)) {
|
||||
return false;
|
||||
}
|
||||
paramType::AttrValueType val(0);
|
||||
if (!ReadParam(aMsg, aIter, &val)) {
|
||||
if (!ReadParam(aReader, &val)) {
|
||||
return false;
|
||||
}
|
||||
(*aResult)->mData.InsertOrUpdate(key, std::move(val));
|
||||
|
@ -59,14 +59,13 @@ template <>
|
||||
struct ParamTraits<SerializedURI> {
|
||||
typedef SerializedURI paramType;
|
||||
|
||||
static void Write(Message* aMsg, const paramType& aParam) {
|
||||
WriteParam(aMsg, aParam.spec);
|
||||
static void Write(MessageWriter* aWriter, const paramType& aParam) {
|
||||
WriteParam(aWriter, aParam.spec);
|
||||
}
|
||||
|
||||
static bool Read(const Message* aMsg, PickleIterator* aIter,
|
||||
paramType* aResult) {
|
||||
static bool Read(MessageReader* aReader, paramType* aResult) {
|
||||
nsCString spec;
|
||||
if (ReadParam(aMsg, aIter, &spec)) {
|
||||
if (ReadParam(aReader, &spec)) {
|
||||
aResult->spec = spec;
|
||||
return true;
|
||||
}
|
||||
@ -78,25 +77,22 @@ template <>
|
||||
struct ParamTraits<ChromePackage> {
|
||||
typedef ChromePackage paramType;
|
||||
|
||||
static void Write(Message* aMsg, const paramType& aParam) {
|
||||
WriteParam(aMsg, aParam.package);
|
||||
WriteParam(aMsg, aParam.contentBaseURI);
|
||||
WriteParam(aMsg, aParam.localeBaseURI);
|
||||
WriteParam(aMsg, aParam.skinBaseURI);
|
||||
WriteParam(aMsg, aParam.flags);
|
||||
static void Write(MessageWriter* aWriter, const paramType& aParam) {
|
||||
WriteParam(aWriter, aParam.package);
|
||||
WriteParam(aWriter, aParam.contentBaseURI);
|
||||
WriteParam(aWriter, aParam.localeBaseURI);
|
||||
WriteParam(aWriter, aParam.skinBaseURI);
|
||||
WriteParam(aWriter, aParam.flags);
|
||||
}
|
||||
|
||||
static bool Read(const Message* aMsg, PickleIterator* aIter,
|
||||
paramType* aResult) {
|
||||
static bool Read(MessageReader* aReader, paramType* aResult) {
|
||||
nsCString package;
|
||||
SerializedURI contentBaseURI, localeBaseURI, skinBaseURI;
|
||||
uint32_t flags;
|
||||
|
||||
if (ReadParam(aMsg, aIter, &package) &&
|
||||
ReadParam(aMsg, aIter, &contentBaseURI) &&
|
||||
ReadParam(aMsg, aIter, &localeBaseURI) &&
|
||||
ReadParam(aMsg, aIter, &skinBaseURI) &&
|
||||
ReadParam(aMsg, aIter, &flags)) {
|
||||
if (ReadParam(aReader, &package) && ReadParam(aReader, &contentBaseURI) &&
|
||||
ReadParam(aReader, &localeBaseURI) &&
|
||||
ReadParam(aReader, &skinBaseURI) && ReadParam(aReader, &flags)) {
|
||||
aResult->package = package;
|
||||
aResult->contentBaseURI = contentBaseURI;
|
||||
aResult->localeBaseURI = localeBaseURI;
|
||||
@ -119,22 +115,20 @@ template <>
|
||||
struct ParamTraits<SubstitutionMapping> {
|
||||
typedef SubstitutionMapping paramType;
|
||||
|
||||
static void Write(Message* aMsg, const paramType& aParam) {
|
||||
WriteParam(aMsg, aParam.scheme);
|
||||
WriteParam(aMsg, aParam.path);
|
||||
WriteParam(aMsg, aParam.resolvedURI);
|
||||
WriteParam(aMsg, aParam.flags);
|
||||
static void Write(MessageWriter* aWriter, const paramType& aParam) {
|
||||
WriteParam(aWriter, aParam.scheme);
|
||||
WriteParam(aWriter, aParam.path);
|
||||
WriteParam(aWriter, aParam.resolvedURI);
|
||||
WriteParam(aWriter, aParam.flags);
|
||||
}
|
||||
|
||||
static bool Read(const Message* aMsg, PickleIterator* aIter,
|
||||
paramType* aResult) {
|
||||
static bool Read(MessageReader* aReader, paramType* aResult) {
|
||||
nsCString scheme, path;
|
||||
SerializedURI resolvedURI;
|
||||
uint32_t flags;
|
||||
|
||||
if (ReadParam(aMsg, aIter, &scheme) && ReadParam(aMsg, aIter, &path) &&
|
||||
ReadParam(aMsg, aIter, &resolvedURI) &&
|
||||
ReadParam(aMsg, aIter, &flags)) {
|
||||
if (ReadParam(aReader, &scheme) && ReadParam(aReader, &path) &&
|
||||
ReadParam(aReader, &resolvedURI) && ReadParam(aReader, &flags)) {
|
||||
aResult->scheme = scheme;
|
||||
aResult->path = path;
|
||||
aResult->resolvedURI = resolvedURI;
|
||||
@ -155,18 +149,16 @@ template <>
|
||||
struct ParamTraits<OverrideMapping> {
|
||||
typedef OverrideMapping paramType;
|
||||
|
||||
static void Write(Message* aMsg, const paramType& aParam) {
|
||||
WriteParam(aMsg, aParam.originalURI);
|
||||
WriteParam(aMsg, aParam.overrideURI);
|
||||
static void Write(MessageWriter* aWriter, const paramType& aParam) {
|
||||
WriteParam(aWriter, aParam.originalURI);
|
||||
WriteParam(aWriter, aParam.overrideURI);
|
||||
}
|
||||
|
||||
static bool Read(const Message* aMsg, PickleIterator* aIter,
|
||||
paramType* aResult) {
|
||||
static bool Read(MessageReader* aReader, paramType* aResult) {
|
||||
SerializedURI originalURI;
|
||||
SerializedURI overrideURI;
|
||||
|
||||
if (ReadParam(aMsg, aIter, &originalURI) &&
|
||||
ReadParam(aMsg, aIter, &overrideURI)) {
|
||||
if (ReadParam(aReader, &originalURI) && ReadParam(aReader, &overrideURI)) {
|
||||
aResult->originalURI = originalURI;
|
||||
aResult->overrideURI = overrideURI;
|
||||
return true;
|
||||
|
@ -3711,19 +3711,19 @@ void BrowsingContext::ResetLocationChangeRateLimit() {
|
||||
namespace ipc {
|
||||
|
||||
void IPDLParamTraits<dom::MaybeDiscarded<dom::BrowsingContext>>::Write(
|
||||
IPC::Message* aMsg, IProtocol* aActor,
|
||||
IPC::MessageWriter* aWriter, IProtocol* aActor,
|
||||
const dom::MaybeDiscarded<dom::BrowsingContext>& aParam) {
|
||||
MOZ_DIAGNOSTIC_ASSERT(!aParam.GetMaybeDiscarded() ||
|
||||
aParam.GetMaybeDiscarded()->EverAttached());
|
||||
uint64_t id = aParam.ContextId();
|
||||
WriteIPDLParam(aMsg, aActor, id);
|
||||
WriteIPDLParam(aWriter, aActor, id);
|
||||
}
|
||||
|
||||
bool IPDLParamTraits<dom::MaybeDiscarded<dom::BrowsingContext>>::Read(
|
||||
const IPC::Message* aMsg, PickleIterator* aIter, IProtocol* aActor,
|
||||
IPC::MessageReader* aReader, IProtocol* aActor,
|
||||
dom::MaybeDiscarded<dom::BrowsingContext>* aResult) {
|
||||
uint64_t id = 0;
|
||||
if (!ReadIPDLParam(aMsg, aIter, aActor, &id)) {
|
||||
if (!ReadIPDLParam(aReader, aActor, &id)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -3738,43 +3738,39 @@ bool IPDLParamTraits<dom::MaybeDiscarded<dom::BrowsingContext>>::Read(
|
||||
}
|
||||
|
||||
void IPDLParamTraits<dom::BrowsingContext::IPCInitializer>::Write(
|
||||
IPC::Message* aMessage, IProtocol* aActor,
|
||||
IPC::MessageWriter* aWriter, IProtocol* aActor,
|
||||
const dom::BrowsingContext::IPCInitializer& aInit) {
|
||||
// Write actor ID parameters.
|
||||
WriteIPDLParam(aMessage, aActor, aInit.mId);
|
||||
WriteIPDLParam(aMessage, aActor, aInit.mParentId);
|
||||
WriteIPDLParam(aMessage, aActor, aInit.mWindowless);
|
||||
WriteIPDLParam(aMessage, aActor, aInit.mUseRemoteTabs);
|
||||
WriteIPDLParam(aMessage, aActor, aInit.mUseRemoteSubframes);
|
||||
WriteIPDLParam(aMessage, aActor, aInit.mCreatedDynamically);
|
||||
WriteIPDLParam(aMessage, aActor, aInit.mChildOffset);
|
||||
WriteIPDLParam(aMessage, aActor, aInit.mOriginAttributes);
|
||||
WriteIPDLParam(aMessage, aActor, aInit.mRequestContextId);
|
||||
WriteIPDLParam(aMessage, aActor, aInit.mSessionHistoryIndex);
|
||||
WriteIPDLParam(aMessage, aActor, aInit.mSessionHistoryCount);
|
||||
WriteIPDLParam(aMessage, aActor, aInit.mFields);
|
||||
WriteIPDLParam(aWriter, aActor, aInit.mId);
|
||||
WriteIPDLParam(aWriter, aActor, aInit.mParentId);
|
||||
WriteIPDLParam(aWriter, aActor, aInit.mWindowless);
|
||||
WriteIPDLParam(aWriter, aActor, aInit.mUseRemoteTabs);
|
||||
WriteIPDLParam(aWriter, aActor, aInit.mUseRemoteSubframes);
|
||||
WriteIPDLParam(aWriter, aActor, aInit.mCreatedDynamically);
|
||||
WriteIPDLParam(aWriter, aActor, aInit.mChildOffset);
|
||||
WriteIPDLParam(aWriter, aActor, aInit.mOriginAttributes);
|
||||
WriteIPDLParam(aWriter, aActor, aInit.mRequestContextId);
|
||||
WriteIPDLParam(aWriter, aActor, aInit.mSessionHistoryIndex);
|
||||
WriteIPDLParam(aWriter, aActor, aInit.mSessionHistoryCount);
|
||||
WriteIPDLParam(aWriter, aActor, aInit.mFields);
|
||||
}
|
||||
|
||||
bool IPDLParamTraits<dom::BrowsingContext::IPCInitializer>::Read(
|
||||
const IPC::Message* aMessage, PickleIterator* aIterator, IProtocol* aActor,
|
||||
IPC::MessageReader* aReader, IProtocol* aActor,
|
||||
dom::BrowsingContext::IPCInitializer* aInit) {
|
||||
// Read actor ID parameters.
|
||||
if (!ReadIPDLParam(aMessage, aIterator, aActor, &aInit->mId) ||
|
||||
!ReadIPDLParam(aMessage, aIterator, aActor, &aInit->mParentId) ||
|
||||
!ReadIPDLParam(aMessage, aIterator, aActor, &aInit->mWindowless) ||
|
||||
!ReadIPDLParam(aMessage, aIterator, aActor, &aInit->mUseRemoteTabs) ||
|
||||
!ReadIPDLParam(aMessage, aIterator, aActor,
|
||||
&aInit->mUseRemoteSubframes) ||
|
||||
!ReadIPDLParam(aMessage, aIterator, aActor,
|
||||
&aInit->mCreatedDynamically) ||
|
||||
!ReadIPDLParam(aMessage, aIterator, aActor, &aInit->mChildOffset) ||
|
||||
!ReadIPDLParam(aMessage, aIterator, aActor, &aInit->mOriginAttributes) ||
|
||||
!ReadIPDLParam(aMessage, aIterator, aActor, &aInit->mRequestContextId) ||
|
||||
!ReadIPDLParam(aMessage, aIterator, aActor,
|
||||
&aInit->mSessionHistoryIndex) ||
|
||||
!ReadIPDLParam(aMessage, aIterator, aActor,
|
||||
&aInit->mSessionHistoryCount) ||
|
||||
!ReadIPDLParam(aMessage, aIterator, aActor, &aInit->mFields)) {
|
||||
if (!ReadIPDLParam(aReader, aActor, &aInit->mId) ||
|
||||
!ReadIPDLParam(aReader, aActor, &aInit->mParentId) ||
|
||||
!ReadIPDLParam(aReader, aActor, &aInit->mWindowless) ||
|
||||
!ReadIPDLParam(aReader, aActor, &aInit->mUseRemoteTabs) ||
|
||||
!ReadIPDLParam(aReader, aActor, &aInit->mUseRemoteSubframes) ||
|
||||
!ReadIPDLParam(aReader, aActor, &aInit->mCreatedDynamically) ||
|
||||
!ReadIPDLParam(aReader, aActor, &aInit->mChildOffset) ||
|
||||
!ReadIPDLParam(aReader, aActor, &aInit->mOriginAttributes) ||
|
||||
!ReadIPDLParam(aReader, aActor, &aInit->mRequestContextId) ||
|
||||
!ReadIPDLParam(aReader, aActor, &aInit->mSessionHistoryIndex) ||
|
||||
!ReadIPDLParam(aReader, aActor, &aInit->mSessionHistoryCount) ||
|
||||
!ReadIPDLParam(aReader, aActor, &aInit->mFields)) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
@ -1345,20 +1345,18 @@ extern template class syncedcontext::Transaction<BrowsingContext>;
|
||||
namespace ipc {
|
||||
template <>
|
||||
struct IPDLParamTraits<dom::MaybeDiscarded<dom::BrowsingContext>> {
|
||||
static void Write(IPC::Message* aMsg, IProtocol* aActor,
|
||||
static void Write(IPC::MessageWriter* aWriter, IProtocol* aActor,
|
||||
const dom::MaybeDiscarded<dom::BrowsingContext>& aParam);
|
||||
static bool Read(const IPC::Message* aMsg, PickleIterator* aIter,
|
||||
IProtocol* aActor,
|
||||
static bool Read(IPC::MessageReader* aReader, IProtocol* aActor,
|
||||
dom::MaybeDiscarded<dom::BrowsingContext>* aResult);
|
||||
};
|
||||
|
||||
template <>
|
||||
struct IPDLParamTraits<dom::BrowsingContext::IPCInitializer> {
|
||||
static void Write(IPC::Message* aMessage, IProtocol* aActor,
|
||||
static void Write(IPC::MessageWriter* aWriter, IProtocol* aActor,
|
||||
const dom::BrowsingContext::IPCInitializer& aInitializer);
|
||||
|
||||
static bool Read(const IPC::Message* aMessage, PickleIterator* aIterator,
|
||||
IProtocol* aActor,
|
||||
static bool Read(IPC::MessageReader* aReader, IProtocol* aActor,
|
||||
dom::BrowsingContext::IPCInitializer* aInitializer);
|
||||
};
|
||||
} // namespace ipc
|
||||
|
@ -63,29 +63,28 @@ template <>
|
||||
struct ParamTraits<SerializedLoadContext> {
|
||||
typedef SerializedLoadContext paramType;
|
||||
|
||||
static void Write(Message* aMsg, const paramType& aParam) {
|
||||
static void Write(MessageWriter* aWriter, const paramType& aParam) {
|
||||
nsAutoCString suffix;
|
||||
aParam.mOriginAttributes.CreateSuffix(suffix);
|
||||
|
||||
WriteParam(aMsg, aParam.mIsNotNull);
|
||||
WriteParam(aMsg, aParam.mIsContent);
|
||||
WriteParam(aMsg, aParam.mIsPrivateBitValid);
|
||||
WriteParam(aMsg, aParam.mUseRemoteTabs);
|
||||
WriteParam(aMsg, aParam.mUseRemoteSubframes);
|
||||
WriteParam(aMsg, aParam.mUseTrackingProtection);
|
||||
WriteParam(aMsg, suffix);
|
||||
WriteParam(aWriter, aParam.mIsNotNull);
|
||||
WriteParam(aWriter, aParam.mIsContent);
|
||||
WriteParam(aWriter, aParam.mIsPrivateBitValid);
|
||||
WriteParam(aWriter, aParam.mUseRemoteTabs);
|
||||
WriteParam(aWriter, aParam.mUseRemoteSubframes);
|
||||
WriteParam(aWriter, aParam.mUseTrackingProtection);
|
||||
WriteParam(aWriter, suffix);
|
||||
}
|
||||
|
||||
static bool Read(const Message* aMsg, PickleIterator* aIter,
|
||||
paramType* aResult) {
|
||||
static bool Read(MessageReader* aReader, paramType* aResult) {
|
||||
nsAutoCString suffix;
|
||||
if (!ReadParam(aMsg, aIter, &aResult->mIsNotNull) ||
|
||||
!ReadParam(aMsg, aIter, &aResult->mIsContent) ||
|
||||
!ReadParam(aMsg, aIter, &aResult->mIsPrivateBitValid) ||
|
||||
!ReadParam(aMsg, aIter, &aResult->mUseRemoteTabs) ||
|
||||
!ReadParam(aMsg, aIter, &aResult->mUseRemoteSubframes) ||
|
||||
!ReadParam(aMsg, aIter, &aResult->mUseTrackingProtection) ||
|
||||
!ReadParam(aMsg, aIter, &suffix)) {
|
||||
if (!ReadParam(aReader, &aResult->mIsNotNull) ||
|
||||
!ReadParam(aReader, &aResult->mIsContent) ||
|
||||
!ReadParam(aReader, &aResult->mIsPrivateBitValid) ||
|
||||
!ReadParam(aReader, &aResult->mUseRemoteTabs) ||
|
||||
!ReadParam(aReader, &aResult->mUseRemoteSubframes) ||
|
||||
!ReadParam(aReader, &aResult->mUseTrackingProtection) ||
|
||||
!ReadParam(aReader, &suffix)) {
|
||||
return false;
|
||||
}
|
||||
return aResult->mOriginAttributes.PopulateFromSuffix(suffix);
|
||||
|
@ -90,9 +90,9 @@ class Transaction {
|
||||
private:
|
||||
friend struct mozilla::ipc::IPDLParamTraits<Transaction<Context>>;
|
||||
|
||||
void Write(IPC::Message* aMsg, mozilla::ipc::IProtocol* aActor) const;
|
||||
bool Read(const IPC::Message* aMsg, PickleIterator* aIter,
|
||||
mozilla::ipc::IProtocol* aActor);
|
||||
void Write(IPC::MessageWriter* aWriter,
|
||||
mozilla::ipc::IProtocol* aActor) const;
|
||||
bool Read(IPC::MessageReader* aReader, mozilla::ipc::IProtocol* aActor);
|
||||
|
||||
// You probably don't want to directly call this method - instead call
|
||||
// `Commit`, which will perform the necessary synchronization.
|
||||
@ -141,9 +141,9 @@ class FieldValues : public Base {
|
||||
private:
|
||||
friend struct mozilla::ipc::IPDLParamTraits<FieldValues<Base, Count>>;
|
||||
|
||||
void Write(IPC::Message* aMsg, mozilla::ipc::IProtocol* aActor) const;
|
||||
bool Read(const IPC::Message* aMsg, PickleIterator* aIter,
|
||||
mozilla::ipc::IProtocol* aActor);
|
||||
void Write(IPC::MessageWriter* aWriter,
|
||||
mozilla::ipc::IProtocol* aActor) const;
|
||||
bool Read(IPC::MessageReader* aReader, mozilla::ipc::IProtocol* aActor);
|
||||
|
||||
template <typename F, size_t... Indexes>
|
||||
static void EachIndexInner(std::index_sequence<Indexes...> aIndexes,
|
||||
@ -324,14 +324,14 @@ template <typename Context>
|
||||
struct IPDLParamTraits<dom::syncedcontext::Transaction<Context>> {
|
||||
typedef dom::syncedcontext::Transaction<Context> paramType;
|
||||
|
||||
static void Write(IPC::Message* aMsg, IProtocol* aActor,
|
||||
static void Write(IPC::MessageWriter* aWriter, IProtocol* aActor,
|
||||
const paramType& aParam) {
|
||||
aParam.Write(aMsg, aActor);
|
||||
aParam.Write(aWriter, aActor);
|
||||
}
|
||||
|
||||
static bool Read(const IPC::Message* aMsg, PickleIterator* aIter,
|
||||
IProtocol* aActor, paramType* aResult) {
|
||||
return aResult->Read(aMsg, aIter, aActor);
|
||||
static bool Read(IPC::MessageReader* aReader, IProtocol* aActor,
|
||||
paramType* aResult) {
|
||||
return aResult->Read(aReader, aActor);
|
||||
}
|
||||
};
|
||||
|
||||
@ -339,14 +339,14 @@ template <typename Base, size_t Count>
|
||||
struct IPDLParamTraits<dom::syncedcontext::FieldValues<Base, Count>> {
|
||||
typedef dom::syncedcontext::FieldValues<Base, Count> paramType;
|
||||
|
||||
static void Write(IPC::Message* aMsg, IProtocol* aActor,
|
||||
static void Write(IPC::MessageWriter* aWriter, IProtocol* aActor,
|
||||
const paramType& aParam) {
|
||||
aParam.Write(aMsg, aActor);
|
||||
aParam.Write(aWriter, aActor);
|
||||
}
|
||||
|
||||
static bool Read(const IPC::Message* aMsg, PickleIterator* aIter,
|
||||
IProtocol* aActor, paramType* aResult) {
|
||||
return aResult->Read(aMsg, aIter, aActor);
|
||||
static bool Read(IPC::MessageReader* aReader, IProtocol* aActor,
|
||||
paramType* aResult) {
|
||||
return aResult->Read(aReader, aActor);
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -294,27 +294,27 @@ typename Transaction<Context>::IndexSet Transaction<Context>::Validate(
|
||||
}
|
||||
|
||||
template <typename Context>
|
||||
void Transaction<Context>::Write(IPC::Message* aMsg,
|
||||
void Transaction<Context>::Write(IPC::MessageWriter* aWriter,
|
||||
mozilla::ipc::IProtocol* aActor) const {
|
||||
// Record which field indices will be included, and then write those fields
|
||||
// out.
|
||||
typename IndexSet::serializedType modified = mModified.serialize();
|
||||
WriteIPDLParam(aMsg, aActor, modified);
|
||||
WriteIPDLParam(aWriter, aActor, modified);
|
||||
EachIndex([&](auto idx) {
|
||||
if (mModified.contains(idx)) {
|
||||
WriteIPDLParam(aMsg, aActor, mValues.Get(idx));
|
||||
WriteIPDLParam(aWriter, aActor, mValues.Get(idx));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
template <typename Context>
|
||||
bool Transaction<Context>::Read(const IPC::Message* aMsg, PickleIterator* aIter,
|
||||
bool Transaction<Context>::Read(IPC::MessageReader* aReader,
|
||||
mozilla::ipc::IProtocol* aActor) {
|
||||
// Read in which field indices were sent by the remote, followed by the fields
|
||||
// identified by those indices.
|
||||
typename IndexSet::serializedType modified =
|
||||
typename IndexSet::serializedType{};
|
||||
if (!ReadIPDLParam(aMsg, aIter, aActor, &modified)) {
|
||||
if (!ReadIPDLParam(aReader, aActor, &modified)) {
|
||||
return false;
|
||||
}
|
||||
mModified.deserialize(modified);
|
||||
@ -322,30 +322,29 @@ bool Transaction<Context>::Read(const IPC::Message* aMsg, PickleIterator* aIter,
|
||||
bool ok = true;
|
||||
EachIndex([&](auto idx) {
|
||||
if (ok && mModified.contains(idx)) {
|
||||
ok = ReadIPDLParam(aMsg, aIter, aActor, &mValues.Get(idx));
|
||||
ok = ReadIPDLParam(aReader, aActor, &mValues.Get(idx));
|
||||
}
|
||||
});
|
||||
return ok;
|
||||
}
|
||||
|
||||
template <typename Base, size_t Count>
|
||||
void FieldValues<Base, Count>::Write(IPC::Message* aMsg,
|
||||
void FieldValues<Base, Count>::Write(IPC::MessageWriter* aWriter,
|
||||
mozilla::ipc::IProtocol* aActor) const {
|
||||
// XXX The this-> qualification is necessary to work around a bug in older gcc
|
||||
// versions causing an ICE.
|
||||
EachIndex([&](auto idx) { WriteIPDLParam(aMsg, aActor, this->Get(idx)); });
|
||||
EachIndex([&](auto idx) { WriteIPDLParam(aWriter, aActor, this->Get(idx)); });
|
||||
}
|
||||
|
||||
template <typename Base, size_t Count>
|
||||
bool FieldValues<Base, Count>::Read(const IPC::Message* aMsg,
|
||||
PickleIterator* aIter,
|
||||
bool FieldValues<Base, Count>::Read(IPC::MessageReader* aReader,
|
||||
mozilla::ipc::IProtocol* aActor) {
|
||||
bool ok = true;
|
||||
EachIndex([&](auto idx) {
|
||||
if (ok) {
|
||||
// XXX The this-> qualification is necessary to work around a bug in older
|
||||
// gcc versions causing an ICE.
|
||||
ok = ReadIPDLParam(aMsg, aIter, aActor, &this->Get(idx));
|
||||
ok = ReadIPDLParam(aReader, aActor, &this->Get(idx));
|
||||
}
|
||||
});
|
||||
return ok;
|
||||
|
@ -577,17 +577,17 @@ NS_IMPL_CYCLE_COLLECTION_TRACE_WRAPPERCACHE(WindowContext)
|
||||
namespace ipc {
|
||||
|
||||
void IPDLParamTraits<dom::MaybeDiscarded<dom::WindowContext>>::Write(
|
||||
IPC::Message* aMsg, IProtocol* aActor,
|
||||
IPC::MessageWriter* aWriter, IProtocol* aActor,
|
||||
const dom::MaybeDiscarded<dom::WindowContext>& aParam) {
|
||||
uint64_t id = aParam.ContextId();
|
||||
WriteIPDLParam(aMsg, aActor, id);
|
||||
WriteIPDLParam(aWriter, aActor, id);
|
||||
}
|
||||
|
||||
bool IPDLParamTraits<dom::MaybeDiscarded<dom::WindowContext>>::Read(
|
||||
const IPC::Message* aMsg, PickleIterator* aIter, IProtocol* aActor,
|
||||
IPC::MessageReader* aReader, IProtocol* aActor,
|
||||
dom::MaybeDiscarded<dom::WindowContext>* aResult) {
|
||||
uint64_t id = 0;
|
||||
if (!ReadIPDLParam(aMsg, aIter, aActor, &id)) {
|
||||
if (!ReadIPDLParam(aReader, aActor, &id)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -602,24 +602,23 @@ bool IPDLParamTraits<dom::MaybeDiscarded<dom::WindowContext>>::Read(
|
||||
}
|
||||
|
||||
void IPDLParamTraits<dom::WindowContext::IPCInitializer>::Write(
|
||||
IPC::Message* aMessage, IProtocol* aActor,
|
||||
IPC::MessageWriter* aWriter, IProtocol* aActor,
|
||||
const dom::WindowContext::IPCInitializer& aInit) {
|
||||
// Write actor ID parameters.
|
||||
WriteIPDLParam(aMessage, aActor, aInit.mInnerWindowId);
|
||||
WriteIPDLParam(aMessage, aActor, aInit.mOuterWindowId);
|
||||
WriteIPDLParam(aMessage, aActor, aInit.mBrowsingContextId);
|
||||
WriteIPDLParam(aMessage, aActor, aInit.mFields);
|
||||
WriteIPDLParam(aWriter, aActor, aInit.mInnerWindowId);
|
||||
WriteIPDLParam(aWriter, aActor, aInit.mOuterWindowId);
|
||||
WriteIPDLParam(aWriter, aActor, aInit.mBrowsingContextId);
|
||||
WriteIPDLParam(aWriter, aActor, aInit.mFields);
|
||||
}
|
||||
|
||||
bool IPDLParamTraits<dom::WindowContext::IPCInitializer>::Read(
|
||||
const IPC::Message* aMessage, PickleIterator* aIterator, IProtocol* aActor,
|
||||
IPC::MessageReader* aReader, IProtocol* aActor,
|
||||
dom::WindowContext::IPCInitializer* aInit) {
|
||||
// Read actor ID parameters.
|
||||
return ReadIPDLParam(aMessage, aIterator, aActor, &aInit->mInnerWindowId) &&
|
||||
ReadIPDLParam(aMessage, aIterator, aActor, &aInit->mOuterWindowId) &&
|
||||
ReadIPDLParam(aMessage, aIterator, aActor,
|
||||
&aInit->mBrowsingContextId) &&
|
||||
ReadIPDLParam(aMessage, aIterator, aActor, &aInit->mFields);
|
||||
return ReadIPDLParam(aReader, aActor, &aInit->mInnerWindowId) &&
|
||||
ReadIPDLParam(aReader, aActor, &aInit->mOuterWindowId) &&
|
||||
ReadIPDLParam(aReader, aActor, &aInit->mBrowsingContextId) &&
|
||||
ReadIPDLParam(aReader, aActor, &aInit->mFields);
|
||||
}
|
||||
|
||||
template struct IPDLParamTraits<dom::WindowContext::BaseTransaction>;
|
||||
|
@ -353,20 +353,18 @@ extern template class syncedcontext::Transaction<WindowContext>;
|
||||
namespace ipc {
|
||||
template <>
|
||||
struct IPDLParamTraits<dom::MaybeDiscarded<dom::WindowContext>> {
|
||||
static void Write(IPC::Message* aMsg, IProtocol* aActor,
|
||||
static void Write(IPC::MessageWriter* aWriter, IProtocol* aActor,
|
||||
const dom::MaybeDiscarded<dom::WindowContext>& aParam);
|
||||
static bool Read(const IPC::Message* aMsg, PickleIterator* aIter,
|
||||
IProtocol* aActor,
|
||||
static bool Read(IPC::MessageReader* aReader, IProtocol* aActor,
|
||||
dom::MaybeDiscarded<dom::WindowContext>* aResult);
|
||||
};
|
||||
|
||||
template <>
|
||||
struct IPDLParamTraits<dom::WindowContext::IPCInitializer> {
|
||||
static void Write(IPC::Message* aMessage, IProtocol* aActor,
|
||||
static void Write(IPC::MessageWriter* aWriter, IProtocol* aActor,
|
||||
const dom::WindowContext::IPCInitializer& aInitializer);
|
||||
|
||||
static bool Read(const IPC::Message* aMessage, PickleIterator* aIterator,
|
||||
IProtocol* aActor,
|
||||
static bool Read(IPC::MessageReader* aReader, IProtocol* aActor,
|
||||
dom::WindowContext::IPCInitializer* aInitializer);
|
||||
};
|
||||
} // namespace ipc
|
||||
|
@ -1445,7 +1445,7 @@ void SessionHistoryEntry::SetInfo(SessionHistoryInfo* aInfo) {
|
||||
namespace ipc {
|
||||
|
||||
void IPDLParamTraits<dom::SessionHistoryInfo>::Write(
|
||||
IPC::Message* aMsg, IProtocol* aActor,
|
||||
IPC::MessageWriter* aWriter, IProtocol* aActor,
|
||||
const dom::SessionHistoryInfo& aParam) {
|
||||
Maybe<Tuple<uint32_t, dom::ClonedMessageData>> stateData;
|
||||
if (aParam.mStateData) {
|
||||
@ -1471,63 +1471,66 @@ void IPDLParamTraits<dom::SessionHistoryInfo>::Write(
|
||||
}
|
||||
}
|
||||
|
||||
WriteIPDLParam(aMsg, aActor, aParam.mURI);
|
||||
WriteIPDLParam(aMsg, aActor, aParam.mOriginalURI);
|
||||
WriteIPDLParam(aMsg, aActor, aParam.mResultPrincipalURI);
|
||||
WriteIPDLParam(aMsg, aActor, aParam.mReferrerInfo);
|
||||
WriteIPDLParam(aMsg, aActor, aParam.mTitle);
|
||||
WriteIPDLParam(aMsg, aActor, aParam.mName);
|
||||
WriteIPDLParam(aMsg, aActor, aParam.mPostData);
|
||||
WriteIPDLParam(aMsg, aActor, aParam.mLoadType);
|
||||
WriteIPDLParam(aMsg, aActor, aParam.mScrollPositionX);
|
||||
WriteIPDLParam(aMsg, aActor, aParam.mScrollPositionY);
|
||||
WriteIPDLParam(aMsg, aActor, stateData);
|
||||
WriteIPDLParam(aMsg, aActor, aParam.mSrcdocData);
|
||||
WriteIPDLParam(aMsg, aActor, aParam.mBaseURI);
|
||||
WriteIPDLParam(aMsg, aActor, aParam.mLoadReplace);
|
||||
WriteIPDLParam(aMsg, aActor, aParam.mURIWasModified);
|
||||
WriteIPDLParam(aMsg, aActor, aParam.mScrollRestorationIsManual);
|
||||
WriteIPDLParam(aMsg, aActor, aParam.mPersist);
|
||||
WriteIPDLParam(aMsg, aActor, aParam.mHasUserInteraction);
|
||||
WriteIPDLParam(aMsg, aActor, aParam.mHasUserActivation);
|
||||
WriteIPDLParam(aMsg, aActor, aParam.mSharedState.Get()->mId);
|
||||
WriteIPDLParam(aMsg, aActor, aParam.mSharedState.Get()->mTriggeringPrincipal);
|
||||
WriteIPDLParam(aMsg, aActor, aParam.mSharedState.Get()->mPrincipalToInherit);
|
||||
WriteIPDLParam(aMsg, aActor,
|
||||
WriteIPDLParam(aWriter, aActor, aParam.mURI);
|
||||
WriteIPDLParam(aWriter, aActor, aParam.mOriginalURI);
|
||||
WriteIPDLParam(aWriter, aActor, aParam.mResultPrincipalURI);
|
||||
WriteIPDLParam(aWriter, aActor, aParam.mReferrerInfo);
|
||||
WriteIPDLParam(aWriter, aActor, aParam.mTitle);
|
||||
WriteIPDLParam(aWriter, aActor, aParam.mName);
|
||||
WriteIPDLParam(aWriter, aActor, aParam.mPostData);
|
||||
WriteIPDLParam(aWriter, aActor, aParam.mLoadType);
|
||||
WriteIPDLParam(aWriter, aActor, aParam.mScrollPositionX);
|
||||
WriteIPDLParam(aWriter, aActor, aParam.mScrollPositionY);
|
||||
WriteIPDLParam(aWriter, aActor, stateData);
|
||||
WriteIPDLParam(aWriter, aActor, aParam.mSrcdocData);
|
||||
WriteIPDLParam(aWriter, aActor, aParam.mBaseURI);
|
||||
WriteIPDLParam(aWriter, aActor, aParam.mLoadReplace);
|
||||
WriteIPDLParam(aWriter, aActor, aParam.mURIWasModified);
|
||||
WriteIPDLParam(aWriter, aActor, aParam.mScrollRestorationIsManual);
|
||||
WriteIPDLParam(aWriter, aActor, aParam.mPersist);
|
||||
WriteIPDLParam(aWriter, aActor, aParam.mHasUserInteraction);
|
||||
WriteIPDLParam(aWriter, aActor, aParam.mHasUserActivation);
|
||||
WriteIPDLParam(aWriter, aActor, aParam.mSharedState.Get()->mId);
|
||||
WriteIPDLParam(aWriter, aActor,
|
||||
aParam.mSharedState.Get()->mTriggeringPrincipal);
|
||||
WriteIPDLParam(aWriter, aActor,
|
||||
aParam.mSharedState.Get()->mPrincipalToInherit);
|
||||
WriteIPDLParam(aWriter, aActor,
|
||||
aParam.mSharedState.Get()->mPartitionedPrincipalToInherit);
|
||||
WriteIPDLParam(aMsg, aActor, aParam.mSharedState.Get()->mCsp);
|
||||
WriteIPDLParam(aMsg, aActor, aParam.mSharedState.Get()->mContentType);
|
||||
WriteIPDLParam(aMsg, aActor, aParam.mSharedState.Get()->mLayoutHistoryState);
|
||||
WriteIPDLParam(aMsg, aActor, aParam.mSharedState.Get()->mCacheKey);
|
||||
WriteIPDLParam(aMsg, aActor, aParam.mSharedState.Get()->mIsFrameNavigation);
|
||||
WriteIPDLParam(aWriter, aActor, aParam.mSharedState.Get()->mCsp);
|
||||
WriteIPDLParam(aWriter, aActor, aParam.mSharedState.Get()->mContentType);
|
||||
WriteIPDLParam(aWriter, aActor,
|
||||
aParam.mSharedState.Get()->mLayoutHistoryState);
|
||||
WriteIPDLParam(aWriter, aActor, aParam.mSharedState.Get()->mCacheKey);
|
||||
WriteIPDLParam(aWriter, aActor,
|
||||
aParam.mSharedState.Get()->mIsFrameNavigation);
|
||||
}
|
||||
|
||||
bool IPDLParamTraits<dom::SessionHistoryInfo>::Read(
|
||||
const IPC::Message* aMsg, PickleIterator* aIter, IProtocol* aActor,
|
||||
IPC::MessageReader* aReader, IProtocol* aActor,
|
||||
dom::SessionHistoryInfo* aResult) {
|
||||
Maybe<Tuple<uint32_t, dom::ClonedMessageData>> stateData;
|
||||
uint64_t sharedId;
|
||||
if (!ReadIPDLParam(aMsg, aIter, aActor, &aResult->mURI) ||
|
||||
!ReadIPDLParam(aMsg, aIter, aActor, &aResult->mOriginalURI) ||
|
||||
!ReadIPDLParam(aMsg, aIter, aActor, &aResult->mResultPrincipalURI) ||
|
||||
!ReadIPDLParam(aMsg, aIter, aActor, &aResult->mReferrerInfo) ||
|
||||
!ReadIPDLParam(aMsg, aIter, aActor, &aResult->mTitle) ||
|
||||
!ReadIPDLParam(aMsg, aIter, aActor, &aResult->mName) ||
|
||||
!ReadIPDLParam(aMsg, aIter, aActor, &aResult->mPostData) ||
|
||||
!ReadIPDLParam(aMsg, aIter, aActor, &aResult->mLoadType) ||
|
||||
!ReadIPDLParam(aMsg, aIter, aActor, &aResult->mScrollPositionX) ||
|
||||
!ReadIPDLParam(aMsg, aIter, aActor, &aResult->mScrollPositionY) ||
|
||||
!ReadIPDLParam(aMsg, aIter, aActor, &stateData) ||
|
||||
!ReadIPDLParam(aMsg, aIter, aActor, &aResult->mSrcdocData) ||
|
||||
!ReadIPDLParam(aMsg, aIter, aActor, &aResult->mBaseURI) ||
|
||||
!ReadIPDLParam(aMsg, aIter, aActor, &aResult->mLoadReplace) ||
|
||||
!ReadIPDLParam(aMsg, aIter, aActor, &aResult->mURIWasModified) ||
|
||||
!ReadIPDLParam(aMsg, aIter, aActor,
|
||||
&aResult->mScrollRestorationIsManual) ||
|
||||
!ReadIPDLParam(aMsg, aIter, aActor, &aResult->mPersist) ||
|
||||
!ReadIPDLParam(aMsg, aIter, aActor, &aResult->mHasUserInteraction) ||
|
||||
!ReadIPDLParam(aMsg, aIter, aActor, &aResult->mHasUserActivation) ||
|
||||
!ReadIPDLParam(aMsg, aIter, aActor, &sharedId)) {
|
||||
if (!ReadIPDLParam(aReader, aActor, &aResult->mURI) ||
|
||||
!ReadIPDLParam(aReader, aActor, &aResult->mOriginalURI) ||
|
||||
!ReadIPDLParam(aReader, aActor, &aResult->mResultPrincipalURI) ||
|
||||
!ReadIPDLParam(aReader, aActor, &aResult->mReferrerInfo) ||
|
||||
!ReadIPDLParam(aReader, aActor, &aResult->mTitle) ||
|
||||
!ReadIPDLParam(aReader, aActor, &aResult->mName) ||
|
||||
!ReadIPDLParam(aReader, aActor, &aResult->mPostData) ||
|
||||
!ReadIPDLParam(aReader, aActor, &aResult->mLoadType) ||
|
||||
!ReadIPDLParam(aReader, aActor, &aResult->mScrollPositionX) ||
|
||||
!ReadIPDLParam(aReader, aActor, &aResult->mScrollPositionY) ||
|
||||
!ReadIPDLParam(aReader, aActor, &stateData) ||
|
||||
!ReadIPDLParam(aReader, aActor, &aResult->mSrcdocData) ||
|
||||
!ReadIPDLParam(aReader, aActor, &aResult->mBaseURI) ||
|
||||
!ReadIPDLParam(aReader, aActor, &aResult->mLoadReplace) ||
|
||||
!ReadIPDLParam(aReader, aActor, &aResult->mURIWasModified) ||
|
||||
!ReadIPDLParam(aReader, aActor, &aResult->mScrollRestorationIsManual) ||
|
||||
!ReadIPDLParam(aReader, aActor, &aResult->mPersist) ||
|
||||
!ReadIPDLParam(aReader, aActor, &aResult->mHasUserInteraction) ||
|
||||
!ReadIPDLParam(aReader, aActor, &aResult->mHasUserActivation) ||
|
||||
!ReadIPDLParam(aReader, aActor, &sharedId)) {
|
||||
aActor->FatalError("Error reading fields for SessionHistoryInfo");
|
||||
return false;
|
||||
}
|
||||
@ -1537,11 +1540,11 @@ bool IPDLParamTraits<dom::SessionHistoryInfo>::Read(
|
||||
nsCOMPtr<nsIPrincipal> partitionedPrincipalToInherit;
|
||||
nsCOMPtr<nsIContentSecurityPolicy> csp;
|
||||
nsCString contentType;
|
||||
if (!ReadIPDLParam(aMsg, aIter, aActor, &triggeringPrincipal) ||
|
||||
!ReadIPDLParam(aMsg, aIter, aActor, &principalToInherit) ||
|
||||
!ReadIPDLParam(aMsg, aIter, aActor, &partitionedPrincipalToInherit) ||
|
||||
!ReadIPDLParam(aMsg, aIter, aActor, &csp) ||
|
||||
!ReadIPDLParam(aMsg, aIter, aActor, &contentType)) {
|
||||
if (!ReadIPDLParam(aReader, aActor, &triggeringPrincipal) ||
|
||||
!ReadIPDLParam(aReader, aActor, &principalToInherit) ||
|
||||
!ReadIPDLParam(aReader, aActor, &partitionedPrincipalToInherit) ||
|
||||
!ReadIPDLParam(aReader, aActor, &csp) ||
|
||||
!ReadIPDLParam(aReader, aActor, &contentType)) {
|
||||
aActor->FatalError("Error reading fields for SessionHistoryInfo");
|
||||
return false;
|
||||
}
|
||||
@ -1588,11 +1591,11 @@ bool IPDLParamTraits<dom::SessionHistoryInfo>::Read(
|
||||
aResult->mSharedState.Get()->mContentType = contentType;
|
||||
}
|
||||
|
||||
if (!ReadIPDLParam(aMsg, aIter, aActor,
|
||||
if (!ReadIPDLParam(aReader, aActor,
|
||||
&aResult->mSharedState.Get()->mLayoutHistoryState) ||
|
||||
!ReadIPDLParam(aMsg, aIter, aActor,
|
||||
!ReadIPDLParam(aReader, aActor,
|
||||
&aResult->mSharedState.Get()->mCacheKey) ||
|
||||
!ReadIPDLParam(aMsg, aIter, aActor,
|
||||
!ReadIPDLParam(aReader, aActor,
|
||||
&aResult->mSharedState.Get()->mIsFrameNavigation)) {
|
||||
aActor->FatalError("Error reading fields for SessionHistoryInfo");
|
||||
return false;
|
||||
@ -1614,26 +1617,25 @@ bool IPDLParamTraits<dom::SessionHistoryInfo>::Read(
|
||||
}
|
||||
|
||||
void IPDLParamTraits<dom::LoadingSessionHistoryInfo>::Write(
|
||||
IPC::Message* aMsg, IProtocol* aActor,
|
||||
IPC::MessageWriter* aWriter, IProtocol* aActor,
|
||||
const dom::LoadingSessionHistoryInfo& aParam) {
|
||||
WriteIPDLParam(aMsg, aActor, aParam.mInfo);
|
||||
WriteIPDLParam(aMsg, aActor, aParam.mLoadId);
|
||||
WriteIPDLParam(aMsg, aActor, aParam.mLoadIsFromSessionHistory);
|
||||
WriteIPDLParam(aMsg, aActor, aParam.mOffset);
|
||||
WriteIPDLParam(aMsg, aActor, aParam.mLoadingCurrentEntry);
|
||||
WriteIPDLParam(aMsg, aActor, aParam.mForceMaybeResetName);
|
||||
WriteIPDLParam(aWriter, aActor, aParam.mInfo);
|
||||
WriteIPDLParam(aWriter, aActor, aParam.mLoadId);
|
||||
WriteIPDLParam(aWriter, aActor, aParam.mLoadIsFromSessionHistory);
|
||||
WriteIPDLParam(aWriter, aActor, aParam.mOffset);
|
||||
WriteIPDLParam(aWriter, aActor, aParam.mLoadingCurrentEntry);
|
||||
WriteIPDLParam(aWriter, aActor, aParam.mForceMaybeResetName);
|
||||
}
|
||||
|
||||
bool IPDLParamTraits<dom::LoadingSessionHistoryInfo>::Read(
|
||||
const IPC::Message* aMsg, PickleIterator* aIter, IProtocol* aActor,
|
||||
IPC::MessageReader* aReader, IProtocol* aActor,
|
||||
dom::LoadingSessionHistoryInfo* aResult) {
|
||||
if (!ReadIPDLParam(aMsg, aIter, aActor, &aResult->mInfo) ||
|
||||
!ReadIPDLParam(aMsg, aIter, aActor, &aResult->mLoadId) ||
|
||||
!ReadIPDLParam(aMsg, aIter, aActor,
|
||||
&aResult->mLoadIsFromSessionHistory) ||
|
||||
!ReadIPDLParam(aMsg, aIter, aActor, &aResult->mOffset) ||
|
||||
!ReadIPDLParam(aMsg, aIter, aActor, &aResult->mLoadingCurrentEntry) ||
|
||||
!ReadIPDLParam(aMsg, aIter, aActor, &aResult->mForceMaybeResetName)) {
|
||||
if (!ReadIPDLParam(aReader, aActor, &aResult->mInfo) ||
|
||||
!ReadIPDLParam(aReader, aActor, &aResult->mLoadId) ||
|
||||
!ReadIPDLParam(aReader, aActor, &aResult->mLoadIsFromSessionHistory) ||
|
||||
!ReadIPDLParam(aReader, aActor, &aResult->mOffset) ||
|
||||
!ReadIPDLParam(aReader, aActor, &aResult->mLoadingCurrentEntry) ||
|
||||
!ReadIPDLParam(aReader, aActor, &aResult->mForceMaybeResetName)) {
|
||||
aActor->FatalError("Error reading fields for LoadingSessionHistoryInfo");
|
||||
return false;
|
||||
}
|
||||
@ -1642,26 +1644,27 @@ bool IPDLParamTraits<dom::LoadingSessionHistoryInfo>::Read(
|
||||
}
|
||||
|
||||
void IPDLParamTraits<nsILayoutHistoryState*>::Write(
|
||||
IPC::Message* aMsg, IProtocol* aActor, nsILayoutHistoryState* aParam) {
|
||||
IPC::MessageWriter* aWriter, IProtocol* aActor,
|
||||
nsILayoutHistoryState* aParam) {
|
||||
if (aParam) {
|
||||
WriteIPDLParam(aMsg, aActor, true);
|
||||
WriteIPDLParam(aWriter, aActor, true);
|
||||
bool scrollPositionOnly = false;
|
||||
nsTArray<nsCString> keys;
|
||||
nsTArray<mozilla::PresState> states;
|
||||
aParam->GetContents(&scrollPositionOnly, keys, states);
|
||||
WriteIPDLParam(aMsg, aActor, scrollPositionOnly);
|
||||
WriteIPDLParam(aMsg, aActor, keys);
|
||||
WriteIPDLParam(aMsg, aActor, states);
|
||||
WriteIPDLParam(aWriter, aActor, scrollPositionOnly);
|
||||
WriteIPDLParam(aWriter, aActor, keys);
|
||||
WriteIPDLParam(aWriter, aActor, states);
|
||||
} else {
|
||||
WriteIPDLParam(aMsg, aActor, false);
|
||||
WriteIPDLParam(aWriter, aActor, false);
|
||||
}
|
||||
}
|
||||
|
||||
bool IPDLParamTraits<nsILayoutHistoryState*>::Read(
|
||||
const IPC::Message* aMsg, PickleIterator* aIter, IProtocol* aActor,
|
||||
IPC::MessageReader* aReader, IProtocol* aActor,
|
||||
RefPtr<nsILayoutHistoryState>* aResult) {
|
||||
bool hasLayoutHistoryState = false;
|
||||
if (!ReadIPDLParam(aMsg, aIter, aActor, &hasLayoutHistoryState)) {
|
||||
if (!ReadIPDLParam(aReader, aActor, &hasLayoutHistoryState)) {
|
||||
aActor->FatalError("Error reading fields for nsILayoutHistoryState");
|
||||
return false;
|
||||
}
|
||||
@ -1670,9 +1673,9 @@ bool IPDLParamTraits<nsILayoutHistoryState*>::Read(
|
||||
bool scrollPositionOnly = false;
|
||||
nsTArray<nsCString> keys;
|
||||
nsTArray<mozilla::PresState> states;
|
||||
if (!ReadIPDLParam(aMsg, aIter, aActor, &scrollPositionOnly) ||
|
||||
!ReadIPDLParam(aMsg, aIter, aActor, &keys) ||
|
||||
!ReadIPDLParam(aMsg, aIter, aActor, &states)) {
|
||||
if (!ReadIPDLParam(aReader, aActor, &scrollPositionOnly) ||
|
||||
!ReadIPDLParam(aReader, aActor, &keys) ||
|
||||
!ReadIPDLParam(aReader, aActor, &states)) {
|
||||
aActor->FatalError("Error reading fields for nsILayoutHistoryState");
|
||||
}
|
||||
|
||||
@ -1693,17 +1696,17 @@ bool IPDLParamTraits<nsILayoutHistoryState*>::Read(
|
||||
}
|
||||
|
||||
void IPDLParamTraits<mozilla::dom::Wireframe>::Write(
|
||||
IPC::Message* aMsg, IProtocol* aActor,
|
||||
IPC::MessageWriter* aWriter, IProtocol* aActor,
|
||||
const mozilla::dom::Wireframe& aParam) {
|
||||
WriteParam(aMsg, aParam.mCanvasBackground);
|
||||
WriteParam(aMsg, aParam.mRects);
|
||||
WriteParam(aWriter, aParam.mCanvasBackground);
|
||||
WriteParam(aWriter, aParam.mRects);
|
||||
}
|
||||
|
||||
bool IPDLParamTraits<mozilla::dom::Wireframe>::Read(
|
||||
const IPC::Message* aMsg, PickleIterator* aIter, IProtocol* aActor,
|
||||
IPC::MessageReader* aReader, IProtocol* aActor,
|
||||
mozilla::dom::Wireframe* aResult) {
|
||||
return ReadParam(aMsg, aIter, &aResult->mCanvasBackground) &&
|
||||
ReadParam(aMsg, aIter, &aResult->mRects);
|
||||
return ReadParam(aReader, &aResult->mCanvasBackground) &&
|
||||
ReadParam(aReader, &aResult->mRects);
|
||||
}
|
||||
|
||||
} // namespace ipc
|
||||
@ -1720,30 +1723,28 @@ struct ParamTraits<mozilla::dom::WireframeRectType>
|
||||
|
||||
template <>
|
||||
struct ParamTraits<mozilla::dom::WireframeTaggedRect> {
|
||||
static void Write(Message* aMsg,
|
||||
static void Write(MessageWriter* aWriter,
|
||||
const mozilla::dom::WireframeTaggedRect& aParam);
|
||||
static bool Read(const Message* aMsg, PickleIterator* aIter,
|
||||
static bool Read(MessageReader* aReader,
|
||||
mozilla::dom::WireframeTaggedRect* aResult);
|
||||
};
|
||||
|
||||
void ParamTraits<mozilla::dom::WireframeTaggedRect>::Write(
|
||||
Message* aMsg, const mozilla::dom::WireframeTaggedRect& aParam) {
|
||||
WriteParam(aMsg, aParam.mColor);
|
||||
WriteParam(aMsg, aParam.mType);
|
||||
WriteParam(aMsg, aParam.mX);
|
||||
WriteParam(aMsg, aParam.mY);
|
||||
WriteParam(aMsg, aParam.mWidth);
|
||||
WriteParam(aMsg, aParam.mHeight);
|
||||
MessageWriter* aWriter, const mozilla::dom::WireframeTaggedRect& aParam) {
|
||||
WriteParam(aWriter, aParam.mColor);
|
||||
WriteParam(aWriter, aParam.mType);
|
||||
WriteParam(aWriter, aParam.mX);
|
||||
WriteParam(aWriter, aParam.mY);
|
||||
WriteParam(aWriter, aParam.mWidth);
|
||||
WriteParam(aWriter, aParam.mHeight);
|
||||
}
|
||||
|
||||
bool ParamTraits<mozilla::dom::WireframeTaggedRect>::Read(
|
||||
const IPC::Message* aMsg, PickleIterator* aIter,
|
||||
mozilla::dom::WireframeTaggedRect* aResult) {
|
||||
return ReadParam(aMsg, aIter, &aResult->mColor) &&
|
||||
ReadParam(aMsg, aIter, &aResult->mType) &&
|
||||
ReadParam(aMsg, aIter, &aResult->mX) &&
|
||||
ReadParam(aMsg, aIter, &aResult->mY) &&
|
||||
ReadParam(aMsg, aIter, &aResult->mWidth) &&
|
||||
ReadParam(aMsg, aIter, &aResult->mHeight);
|
||||
IPC::MessageReader* aReader, mozilla::dom::WireframeTaggedRect* aResult) {
|
||||
return ReadParam(aReader, &aResult->mColor) &&
|
||||
ReadParam(aReader, &aResult->mType) &&
|
||||
ReadParam(aReader, &aResult->mX) && ReadParam(aReader, &aResult->mY) &&
|
||||
ReadParam(aReader, &aResult->mWidth) &&
|
||||
ReadParam(aReader, &aResult->mHeight);
|
||||
}
|
||||
} // namespace IPC
|
||||
|
@ -431,37 +431,37 @@ class IProtocol;
|
||||
// Allow sending SessionHistoryInfo objects over IPC.
|
||||
template <>
|
||||
struct IPDLParamTraits<dom::SessionHistoryInfo> {
|
||||
static void Write(IPC::Message* aMsg, IProtocol* aActor,
|
||||
static void Write(IPC::MessageWriter* aWriter, IProtocol* aActor,
|
||||
const dom::SessionHistoryInfo& aParam);
|
||||
static bool Read(const IPC::Message* aMsg, PickleIterator* aIter,
|
||||
IProtocol* aActor, dom::SessionHistoryInfo* aResult);
|
||||
static bool Read(IPC::MessageReader* aReader, IProtocol* aActor,
|
||||
dom::SessionHistoryInfo* aResult);
|
||||
};
|
||||
|
||||
// Allow sending LoadingSessionHistoryInfo objects over IPC.
|
||||
template <>
|
||||
struct IPDLParamTraits<dom::LoadingSessionHistoryInfo> {
|
||||
static void Write(IPC::Message* aMsg, IProtocol* aActor,
|
||||
static void Write(IPC::MessageWriter* aWriter, IProtocol* aActor,
|
||||
const dom::LoadingSessionHistoryInfo& aParam);
|
||||
static bool Read(const IPC::Message* aMsg, PickleIterator* aIter,
|
||||
IProtocol* aActor, dom::LoadingSessionHistoryInfo* aResult);
|
||||
static bool Read(IPC::MessageReader* aReader, IProtocol* aActor,
|
||||
dom::LoadingSessionHistoryInfo* aResult);
|
||||
};
|
||||
|
||||
// Allow sending nsILayoutHistoryState objects over IPC.
|
||||
template <>
|
||||
struct IPDLParamTraits<nsILayoutHistoryState*> {
|
||||
static void Write(IPC::Message* aMsg, IProtocol* aActor,
|
||||
static void Write(IPC::MessageWriter* aWriter, IProtocol* aActor,
|
||||
nsILayoutHistoryState* aParam);
|
||||
static bool Read(const IPC::Message* aMsg, PickleIterator* aIter,
|
||||
IProtocol* aActor, RefPtr<nsILayoutHistoryState>* aResult);
|
||||
static bool Read(IPC::MessageReader* aReader, IProtocol* aActor,
|
||||
RefPtr<nsILayoutHistoryState>* aResult);
|
||||
};
|
||||
|
||||
// Allow sending dom::Wireframe objects over IPC.
|
||||
template <>
|
||||
struct IPDLParamTraits<mozilla::dom::Wireframe> {
|
||||
static void Write(IPC::Message* aMsg, IProtocol* aActor,
|
||||
static void Write(IPC::MessageWriter* aWriter, IProtocol* aActor,
|
||||
const mozilla::dom::Wireframe& aParam);
|
||||
static bool Read(const IPC::Message* aMsg, PickleIterator* aIter,
|
||||
IProtocol* aActor, mozilla::dom::Wireframe* aResult);
|
||||
static bool Read(IPC::MessageReader* aReader, IProtocol* aActor,
|
||||
mozilla::dom::Wireframe* aResult);
|
||||
};
|
||||
|
||||
} // namespace ipc
|
||||
|
@ -589,61 +589,61 @@ nsDOMNavigationTiming::nsDOMNavigationTiming(nsDocShell* aDocShell,
|
||||
|
||||
/* static */
|
||||
void mozilla::ipc::IPDLParamTraits<nsDOMNavigationTiming*>::Write(
|
||||
IPC::Message* aMsg, IProtocol* aActor, nsDOMNavigationTiming* aParam) {
|
||||
IPC::MessageWriter* aWriter, IProtocol* aActor,
|
||||
nsDOMNavigationTiming* aParam) {
|
||||
RefPtr<nsIURI> unloadedURI = aParam->mUnloadedURI.get();
|
||||
RefPtr<nsIURI> loadedURI = aParam->mLoadedURI.get();
|
||||
WriteIPDLParam(aMsg, aActor, unloadedURI ? Some(unloadedURI) : Nothing());
|
||||
WriteIPDLParam(aMsg, aActor, loadedURI ? Some(loadedURI) : Nothing());
|
||||
WriteIPDLParam(aMsg, aActor, uint32_t(aParam->mNavigationType));
|
||||
WriteIPDLParam(aMsg, aActor, aParam->mNavigationStartHighRes);
|
||||
WriteIPDLParam(aMsg, aActor, aParam->mNavigationStart);
|
||||
WriteIPDLParam(aMsg, aActor, aParam->mNonBlankPaint);
|
||||
WriteIPDLParam(aMsg, aActor, aParam->mContentfulComposite);
|
||||
WriteIPDLParam(aMsg, aActor, aParam->mDOMContentFlushed);
|
||||
WriteIPDLParam(aMsg, aActor, aParam->mBeforeUnloadStart);
|
||||
WriteIPDLParam(aMsg, aActor, aParam->mUnloadStart);
|
||||
WriteIPDLParam(aMsg, aActor, aParam->mUnloadEnd);
|
||||
WriteIPDLParam(aMsg, aActor, aParam->mLoadEventStart);
|
||||
WriteIPDLParam(aMsg, aActor, aParam->mLoadEventEnd);
|
||||
WriteIPDLParam(aMsg, aActor, aParam->mDOMLoading);
|
||||
WriteIPDLParam(aMsg, aActor, aParam->mDOMInteractive);
|
||||
WriteIPDLParam(aMsg, aActor, aParam->mDOMContentLoadedEventStart);
|
||||
WriteIPDLParam(aMsg, aActor, aParam->mDOMContentLoadedEventEnd);
|
||||
WriteIPDLParam(aMsg, aActor, aParam->mDOMComplete);
|
||||
WriteIPDLParam(aMsg, aActor, aParam->mTTFI);
|
||||
WriteIPDLParam(aMsg, aActor,
|
||||
WriteIPDLParam(aWriter, aActor, unloadedURI ? Some(unloadedURI) : Nothing());
|
||||
WriteIPDLParam(aWriter, aActor, loadedURI ? Some(loadedURI) : Nothing());
|
||||
WriteIPDLParam(aWriter, aActor, uint32_t(aParam->mNavigationType));
|
||||
WriteIPDLParam(aWriter, aActor, aParam->mNavigationStartHighRes);
|
||||
WriteIPDLParam(aWriter, aActor, aParam->mNavigationStart);
|
||||
WriteIPDLParam(aWriter, aActor, aParam->mNonBlankPaint);
|
||||
WriteIPDLParam(aWriter, aActor, aParam->mContentfulComposite);
|
||||
WriteIPDLParam(aWriter, aActor, aParam->mDOMContentFlushed);
|
||||
WriteIPDLParam(aWriter, aActor, aParam->mBeforeUnloadStart);
|
||||
WriteIPDLParam(aWriter, aActor, aParam->mUnloadStart);
|
||||
WriteIPDLParam(aWriter, aActor, aParam->mUnloadEnd);
|
||||
WriteIPDLParam(aWriter, aActor, aParam->mLoadEventStart);
|
||||
WriteIPDLParam(aWriter, aActor, aParam->mLoadEventEnd);
|
||||
WriteIPDLParam(aWriter, aActor, aParam->mDOMLoading);
|
||||
WriteIPDLParam(aWriter, aActor, aParam->mDOMInteractive);
|
||||
WriteIPDLParam(aWriter, aActor, aParam->mDOMContentLoadedEventStart);
|
||||
WriteIPDLParam(aWriter, aActor, aParam->mDOMContentLoadedEventEnd);
|
||||
WriteIPDLParam(aWriter, aActor, aParam->mDOMComplete);
|
||||
WriteIPDLParam(aWriter, aActor, aParam->mTTFI);
|
||||
WriteIPDLParam(aWriter, aActor,
|
||||
aParam->mDocShellHasBeenActiveSinceNavigationStart);
|
||||
}
|
||||
|
||||
/* static */
|
||||
bool mozilla::ipc::IPDLParamTraits<nsDOMNavigationTiming*>::Read(
|
||||
const IPC::Message* aMsg, PickleIterator* aIter, IProtocol* aActor,
|
||||
IPC::MessageReader* aReader, IProtocol* aActor,
|
||||
RefPtr<nsDOMNavigationTiming>* aResult) {
|
||||
auto timing = MakeRefPtr<nsDOMNavigationTiming>(nullptr);
|
||||
uint32_t type;
|
||||
Maybe<RefPtr<nsIURI>> unloadedURI;
|
||||
Maybe<RefPtr<nsIURI>> loadedURI;
|
||||
if (!ReadIPDLParam(aMsg, aIter, aActor, &unloadedURI) ||
|
||||
!ReadIPDLParam(aMsg, aIter, aActor, &loadedURI) ||
|
||||
!ReadIPDLParam(aMsg, aIter, aActor, &type) ||
|
||||
!ReadIPDLParam(aMsg, aIter, aActor, &timing->mNavigationStartHighRes) ||
|
||||
!ReadIPDLParam(aMsg, aIter, aActor, &timing->mNavigationStart) ||
|
||||
!ReadIPDLParam(aMsg, aIter, aActor, &timing->mNonBlankPaint) ||
|
||||
!ReadIPDLParam(aMsg, aIter, aActor, &timing->mContentfulComposite) ||
|
||||
!ReadIPDLParam(aMsg, aIter, aActor, &timing->mDOMContentFlushed) ||
|
||||
!ReadIPDLParam(aMsg, aIter, aActor, &timing->mBeforeUnloadStart) ||
|
||||
!ReadIPDLParam(aMsg, aIter, aActor, &timing->mUnloadStart) ||
|
||||
!ReadIPDLParam(aMsg, aIter, aActor, &timing->mUnloadEnd) ||
|
||||
!ReadIPDLParam(aMsg, aIter, aActor, &timing->mLoadEventStart) ||
|
||||
!ReadIPDLParam(aMsg, aIter, aActor, &timing->mLoadEventEnd) ||
|
||||
!ReadIPDLParam(aMsg, aIter, aActor, &timing->mDOMLoading) ||
|
||||
!ReadIPDLParam(aMsg, aIter, aActor, &timing->mDOMInteractive) ||
|
||||
!ReadIPDLParam(aMsg, aIter, aActor,
|
||||
&timing->mDOMContentLoadedEventStart) ||
|
||||
!ReadIPDLParam(aMsg, aIter, aActor, &timing->mDOMContentLoadedEventEnd) ||
|
||||
!ReadIPDLParam(aMsg, aIter, aActor, &timing->mDOMComplete) ||
|
||||
!ReadIPDLParam(aMsg, aIter, aActor, &timing->mTTFI) ||
|
||||
!ReadIPDLParam(aMsg, aIter, aActor,
|
||||
if (!ReadIPDLParam(aReader, aActor, &unloadedURI) ||
|
||||
!ReadIPDLParam(aReader, aActor, &loadedURI) ||
|
||||
!ReadIPDLParam(aReader, aActor, &type) ||
|
||||
!ReadIPDLParam(aReader, aActor, &timing->mNavigationStartHighRes) ||
|
||||
!ReadIPDLParam(aReader, aActor, &timing->mNavigationStart) ||
|
||||
!ReadIPDLParam(aReader, aActor, &timing->mNonBlankPaint) ||
|
||||
!ReadIPDLParam(aReader, aActor, &timing->mContentfulComposite) ||
|
||||
!ReadIPDLParam(aReader, aActor, &timing->mDOMContentFlushed) ||
|
||||
!ReadIPDLParam(aReader, aActor, &timing->mBeforeUnloadStart) ||
|
||||
!ReadIPDLParam(aReader, aActor, &timing->mUnloadStart) ||
|
||||
!ReadIPDLParam(aReader, aActor, &timing->mUnloadEnd) ||
|
||||
!ReadIPDLParam(aReader, aActor, &timing->mLoadEventStart) ||
|
||||
!ReadIPDLParam(aReader, aActor, &timing->mLoadEventEnd) ||
|
||||
!ReadIPDLParam(aReader, aActor, &timing->mDOMLoading) ||
|
||||
!ReadIPDLParam(aReader, aActor, &timing->mDOMInteractive) ||
|
||||
!ReadIPDLParam(aReader, aActor, &timing->mDOMContentLoadedEventStart) ||
|
||||
!ReadIPDLParam(aReader, aActor, &timing->mDOMContentLoadedEventEnd) ||
|
||||
!ReadIPDLParam(aReader, aActor, &timing->mDOMComplete) ||
|
||||
!ReadIPDLParam(aReader, aActor, &timing->mTTFI) ||
|
||||
!ReadIPDLParam(aReader, aActor,
|
||||
&timing->mDocShellHasBeenActiveSinceNavigationStart)) {
|
||||
return false;
|
||||
}
|
||||
|
@ -261,10 +261,10 @@ namespace mozilla {
|
||||
namespace ipc {
|
||||
template <>
|
||||
struct IPDLParamTraits<nsDOMNavigationTiming*> {
|
||||
static void Write(IPC::Message* aMsg, IProtocol* aActor,
|
||||
static void Write(IPC::MessageWriter* aWriter, IProtocol* aActor,
|
||||
nsDOMNavigationTiming* aParam);
|
||||
static bool Read(const IPC::Message* aMsg, PickleIterator* aIter,
|
||||
IProtocol* aActor, RefPtr<nsDOMNavigationTiming>* aResult);
|
||||
static bool Read(IPC::MessageReader* aReader, IProtocol* aActor,
|
||||
RefPtr<nsDOMNavigationTiming>* aResult);
|
||||
};
|
||||
|
||||
} // namespace ipc
|
||||
|
@ -251,23 +251,24 @@ nsTArray<nsCString>& TErrorResult<CleanupPolicy>::CreateErrorMessageHelper(
|
||||
}
|
||||
|
||||
template <typename CleanupPolicy>
|
||||
void TErrorResult<CleanupPolicy>::SerializeMessage(IPC::Message* aMsg) const {
|
||||
void TErrorResult<CleanupPolicy>::SerializeMessage(
|
||||
IPC::MessageWriter* aWriter) const {
|
||||
using namespace IPC;
|
||||
AssertInOwningThread();
|
||||
MOZ_ASSERT(mUnionState == HasMessage);
|
||||
MOZ_ASSERT(mExtra.mMessage);
|
||||
WriteParam(aMsg, mExtra.mMessage->mArgs);
|
||||
WriteParam(aMsg, mExtra.mMessage->mErrorNumber);
|
||||
WriteParam(aWriter, mExtra.mMessage->mArgs);
|
||||
WriteParam(aWriter, mExtra.mMessage->mErrorNumber);
|
||||
}
|
||||
|
||||
template <typename CleanupPolicy>
|
||||
bool TErrorResult<CleanupPolicy>::DeserializeMessage(const IPC::Message* aMsg,
|
||||
PickleIterator* aIter) {
|
||||
bool TErrorResult<CleanupPolicy>::DeserializeMessage(
|
||||
IPC::MessageReader* aReader) {
|
||||
using namespace IPC;
|
||||
AssertInOwningThread();
|
||||
auto readMessage = MakeUnique<Message>();
|
||||
if (!ReadParam(aMsg, aIter, &readMessage->mArgs) ||
|
||||
!ReadParam(aMsg, aIter, &readMessage->mErrorNumber)) {
|
||||
if (!ReadParam(aReader, &readMessage->mArgs) ||
|
||||
!ReadParam(aReader, &readMessage->mErrorNumber)) {
|
||||
return false;
|
||||
}
|
||||
if (!readMessage->HasCorrectNumberOfArguments()) {
|
||||
@ -392,23 +393,23 @@ struct TErrorResult<CleanupPolicy>::DOMExceptionInfo {
|
||||
|
||||
template <typename CleanupPolicy>
|
||||
void TErrorResult<CleanupPolicy>::SerializeDOMExceptionInfo(
|
||||
IPC::Message* aMsg) const {
|
||||
IPC::MessageWriter* aWriter) const {
|
||||
using namespace IPC;
|
||||
AssertInOwningThread();
|
||||
MOZ_ASSERT(mUnionState == HasDOMExceptionInfo);
|
||||
MOZ_ASSERT(mExtra.mDOMExceptionInfo);
|
||||
WriteParam(aMsg, mExtra.mDOMExceptionInfo->mMessage);
|
||||
WriteParam(aMsg, mExtra.mDOMExceptionInfo->mRv);
|
||||
WriteParam(aWriter, mExtra.mDOMExceptionInfo->mMessage);
|
||||
WriteParam(aWriter, mExtra.mDOMExceptionInfo->mRv);
|
||||
}
|
||||
|
||||
template <typename CleanupPolicy>
|
||||
bool TErrorResult<CleanupPolicy>::DeserializeDOMExceptionInfo(
|
||||
const IPC::Message* aMsg, PickleIterator* aIter) {
|
||||
IPC::MessageReader* aReader) {
|
||||
using namespace IPC;
|
||||
AssertInOwningThread();
|
||||
nsCString message;
|
||||
nsresult rv;
|
||||
if (!ReadParam(aMsg, aIter, &message) || !ReadParam(aMsg, aIter, &rv)) {
|
||||
if (!ReadParam(aReader, &message) || !ReadParam(aReader, &rv)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -26,7 +26,7 @@ template <>
|
||||
struct ParamTraits<mozilla::ErrorResult> {
|
||||
typedef mozilla::ErrorResult paramType;
|
||||
|
||||
static void Write(Message* aMsg, const paramType& aParam) {
|
||||
static void Write(MessageWriter* aWriter, const paramType& aParam) {
|
||||
// It should be the case that mMightHaveUnreportedJSException can only be
|
||||
// true when we're expecting a JS exception. We cannot send such messages
|
||||
// over the IPC channel since there is no sane way of transferring the JS
|
||||
@ -42,43 +42,42 @@ struct ParamTraits<mozilla::ErrorResult> {
|
||||
"Cannot encode an ErrorResult representing a Javascript exception");
|
||||
}
|
||||
|
||||
WriteParam(aMsg, aParam.mResult);
|
||||
WriteParam(aMsg, aParam.IsErrorWithMessage());
|
||||
WriteParam(aMsg, aParam.IsDOMException());
|
||||
WriteParam(aWriter, aParam.mResult);
|
||||
WriteParam(aWriter, aParam.IsErrorWithMessage());
|
||||
WriteParam(aWriter, aParam.IsDOMException());
|
||||
if (aParam.IsErrorWithMessage()) {
|
||||
aParam.SerializeMessage(aMsg);
|
||||
aParam.SerializeMessage(aWriter);
|
||||
} else if (aParam.IsDOMException()) {
|
||||
aParam.SerializeDOMExceptionInfo(aMsg);
|
||||
aParam.SerializeDOMExceptionInfo(aWriter);
|
||||
}
|
||||
}
|
||||
|
||||
static void Write(Message* aMsg, paramType&& aParam) {
|
||||
Write(aMsg, static_cast<const paramType&>(aParam));
|
||||
static void Write(MessageWriter* aWriter, paramType&& aParam) {
|
||||
Write(aWriter, static_cast<const paramType&>(aParam));
|
||||
aParam.SuppressException();
|
||||
}
|
||||
|
||||
static bool Read(const Message* aMsg, PickleIterator* aIter,
|
||||
paramType* aResult) {
|
||||
static bool Read(MessageReader* aReader, paramType* aResult) {
|
||||
paramType readValue;
|
||||
if (!ReadParam(aMsg, aIter, &readValue.mResult)) {
|
||||
if (!ReadParam(aReader, &readValue.mResult)) {
|
||||
return false;
|
||||
}
|
||||
bool hasMessage = false;
|
||||
if (!ReadParam(aMsg, aIter, &hasMessage)) {
|
||||
if (!ReadParam(aReader, &hasMessage)) {
|
||||
return false;
|
||||
}
|
||||
bool hasDOMExceptionInfo = false;
|
||||
if (!ReadParam(aMsg, aIter, &hasDOMExceptionInfo)) {
|
||||
if (!ReadParam(aReader, &hasDOMExceptionInfo)) {
|
||||
return false;
|
||||
}
|
||||
if (hasMessage && hasDOMExceptionInfo) {
|
||||
// Shouldn't have both!
|
||||
return false;
|
||||
}
|
||||
if (hasMessage && !readValue.DeserializeMessage(aMsg, aIter)) {
|
||||
if (hasMessage && !readValue.DeserializeMessage(aReader)) {
|
||||
return false;
|
||||
} else if (hasDOMExceptionInfo &&
|
||||
!readValue.DeserializeDOMExceptionInfo(aMsg, aIter)) {
|
||||
!readValue.DeserializeDOMExceptionInfo(aReader)) {
|
||||
return false;
|
||||
}
|
||||
*aResult = std::move(readValue);
|
||||
@ -90,16 +89,15 @@ template <>
|
||||
struct ParamTraits<mozilla::CopyableErrorResult> {
|
||||
typedef mozilla::CopyableErrorResult paramType;
|
||||
|
||||
static void Write(Message* aMsg, const paramType& aParam) {
|
||||
ParamTraits<mozilla::ErrorResult>::Write(aMsg, aParam);
|
||||
static void Write(MessageWriter* aWriter, const paramType& aParam) {
|
||||
ParamTraits<mozilla::ErrorResult>::Write(aWriter, aParam);
|
||||
}
|
||||
|
||||
static bool Read(const Message* aMsg, PickleIterator* aIter,
|
||||
paramType* aResult) {
|
||||
static bool Read(MessageReader* aReader, paramType* aResult) {
|
||||
// We can't cast *aResult to ErrorResult&, so cheat and just cast
|
||||
// to ErrorResult*.
|
||||
return ParamTraits<mozilla::ErrorResult>::Read(
|
||||
aMsg, aIter, reinterpret_cast<mozilla::ErrorResult*>(aResult));
|
||||
aReader, reinterpret_cast<mozilla::ErrorResult*>(aResult));
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -476,12 +476,11 @@ class TErrorResult {
|
||||
|
||||
friend struct IPC::ParamTraits<TErrorResult>;
|
||||
friend struct IPC::ParamTraits<ErrorResult>;
|
||||
void SerializeMessage(IPC::Message* aMsg) const;
|
||||
bool DeserializeMessage(const IPC::Message* aMsg, PickleIterator* aIter);
|
||||
void SerializeMessage(IPC::MessageWriter* aWriter) const;
|
||||
bool DeserializeMessage(IPC::MessageReader* aReader);
|
||||
|
||||
void SerializeDOMExceptionInfo(IPC::Message* aMsg) const;
|
||||
bool DeserializeDOMExceptionInfo(const IPC::Message* aMsg,
|
||||
PickleIterator* aIter);
|
||||
void SerializeDOMExceptionInfo(IPC::MessageWriter* aWriter) const;
|
||||
bool DeserializeDOMExceptionInfo(IPC::MessageReader* aReader);
|
||||
|
||||
// Helper method that creates a new Message for this TErrorResult,
|
||||
// and returns the arguments array from that Message.
|
||||
|
@ -115,15 +115,15 @@ template <>
|
||||
struct IPDLParamTraits<mozilla::webgl::FrontBufferSnapshotIpc> final {
|
||||
using T = mozilla::webgl::FrontBufferSnapshotIpc;
|
||||
|
||||
static void Write(IPC::Message* const msg, IProtocol* actor, T& in) {
|
||||
WriteParam(msg, in.surfSize);
|
||||
WriteIPDLParam(msg, actor, std::move(in.shmem));
|
||||
static void Write(IPC::MessageWriter* const writer, IProtocol* actor, T& in) {
|
||||
WriteParam(writer, in.surfSize);
|
||||
WriteIPDLParam(writer, actor, std::move(in.shmem));
|
||||
}
|
||||
|
||||
static bool Read(const IPC::Message* const msg, PickleIterator* const itr,
|
||||
IProtocol* actor, T* const out) {
|
||||
return ReadParam(msg, itr, &out->surfSize) &&
|
||||
ReadIPDLParam(msg, itr, actor, &out->shmem);
|
||||
static bool Read(IPC::MessageReader* const reader, IProtocol* actor,
|
||||
T* const out) {
|
||||
return ReadParam(reader, &out->surfSize) &&
|
||||
ReadIPDLParam(reader, actor, &out->shmem);
|
||||
}
|
||||
};
|
||||
|
||||
@ -133,17 +133,17 @@ template <>
|
||||
struct IPDLParamTraits<mozilla::webgl::ReadPixelsResultIpc> final {
|
||||
using T = mozilla::webgl::ReadPixelsResultIpc;
|
||||
|
||||
static void Write(IPC::Message* const msg, IProtocol* actor, T& in) {
|
||||
WriteParam(msg, in.subrect);
|
||||
WriteParam(msg, in.byteStride);
|
||||
WriteIPDLParam(msg, actor, std::move(in.shmem));
|
||||
static void Write(IPC::MessageWriter* const writer, IProtocol* actor, T& in) {
|
||||
WriteParam(writer, in.subrect);
|
||||
WriteParam(writer, in.byteStride);
|
||||
WriteIPDLParam(writer, actor, std::move(in.shmem));
|
||||
}
|
||||
|
||||
static bool Read(const IPC::Message* const msg, PickleIterator* const itr,
|
||||
IProtocol* actor, T* const out) {
|
||||
return ReadParam(msg, itr, &out->subrect) &&
|
||||
ReadParam(msg, itr, &out->byteStride) &&
|
||||
ReadIPDLParam(msg, itr, actor, &out->shmem);
|
||||
static bool Read(IPC::MessageReader* const reader, IProtocol* actor,
|
||||
T* const out) {
|
||||
return ReadParam(reader, &out->subrect) &&
|
||||
ReadParam(reader, &out->byteStride) &&
|
||||
ReadIPDLParam(reader, actor, &out->shmem);
|
||||
}
|
||||
};
|
||||
|
||||
@ -153,29 +153,30 @@ template <>
|
||||
struct IPDLParamTraits<mozilla::webgl::TexUnpackBlobDesc> final {
|
||||
using T = mozilla::webgl::TexUnpackBlobDesc;
|
||||
|
||||
static void Write(IPC::Message* const msg, IProtocol* actor, T&& in) {
|
||||
WriteParam(msg, in.imageTarget);
|
||||
WriteParam(msg, in.size);
|
||||
WriteParam(msg, in.srcAlphaType);
|
||||
static void Write(IPC::MessageWriter* const writer, IProtocol* actor,
|
||||
T&& in) {
|
||||
WriteParam(writer, in.imageTarget);
|
||||
WriteParam(writer, in.size);
|
||||
WriteParam(writer, in.srcAlphaType);
|
||||
MOZ_RELEASE_ASSERT(!in.cpuData);
|
||||
MOZ_RELEASE_ASSERT(!in.pboOffset);
|
||||
WriteParam(msg, in.structuredSrcSize);
|
||||
WriteParam(writer, in.structuredSrcSize);
|
||||
MOZ_RELEASE_ASSERT(!in.image);
|
||||
WriteIPDLParam(msg, actor, std::move(in.sd));
|
||||
WriteIPDLParam(writer, actor, std::move(in.sd));
|
||||
MOZ_RELEASE_ASSERT(!in.dataSurf);
|
||||
WriteParam(msg, in.unpacking);
|
||||
WriteParam(msg, in.applyUnpackTransforms);
|
||||
WriteParam(writer, in.unpacking);
|
||||
WriteParam(writer, in.applyUnpackTransforms);
|
||||
}
|
||||
|
||||
static bool Read(const IPC::Message* const msg, PickleIterator* const itr,
|
||||
IProtocol* actor, T* const out) {
|
||||
return ReadParam(msg, itr, &out->imageTarget) &&
|
||||
ReadParam(msg, itr, &out->size) &&
|
||||
ReadParam(msg, itr, &out->srcAlphaType) &&
|
||||
ReadParam(msg, itr, &out->structuredSrcSize) &&
|
||||
ReadIPDLParam(msg, itr, actor, &out->sd) &&
|
||||
ReadParam(msg, itr, &out->unpacking) &&
|
||||
ReadParam(msg, itr, &out->applyUnpackTransforms);
|
||||
static bool Read(IPC::MessageReader* const reader, IProtocol* actor,
|
||||
T* const out) {
|
||||
return ReadParam(reader, &out->imageTarget) &&
|
||||
ReadParam(reader, &out->size) &&
|
||||
ReadParam(reader, &out->srcAlphaType) &&
|
||||
ReadParam(reader, &out->structuredSrcSize) &&
|
||||
ReadIPDLParam(reader, actor, &out->sd) &&
|
||||
ReadParam(reader, &out->unpacking) &&
|
||||
ReadParam(reader, &out->applyUnpackTransforms);
|
||||
}
|
||||
};
|
||||
|
||||
@ -216,14 +217,13 @@ bool ValidateParam(const T& val) {
|
||||
|
||||
template <typename T>
|
||||
struct ValidatedPlainOldDataSerializer : public PlainOldDataSerializer<T> {
|
||||
static void Write(Message* const msg, const T& in) {
|
||||
static void Write(MessageWriter* const writer, const T& in) {
|
||||
MOZ_ASSERT(ValidateParam(in));
|
||||
PlainOldDataSerializer<T>::Write(msg, in);
|
||||
PlainOldDataSerializer<T>::Write(writer, in);
|
||||
}
|
||||
|
||||
static bool Read(const Message* const msg, PickleIterator* const itr,
|
||||
T* const out) {
|
||||
if (!PlainOldDataSerializer<T>::Read(msg, itr, out)) return false;
|
||||
static bool Read(MessageReader* const reader, T* const out) {
|
||||
if (!PlainOldDataSerializer<T>::Read(reader, out)) return false;
|
||||
return ValidateParam(*out);
|
||||
}
|
||||
|
||||
@ -276,19 +276,17 @@ template <>
|
||||
struct ParamTraits<mozilla::webgl::InitContextResult> final {
|
||||
using T = mozilla::webgl::InitContextResult;
|
||||
|
||||
static void Write(Message* const msg, const T& in) {
|
||||
WriteParam(msg, in.error);
|
||||
WriteParam(msg, in.options);
|
||||
WriteParam(msg, in.limits);
|
||||
WriteParam(msg, in.uploadableSdTypes);
|
||||
static void Write(MessageWriter* const writer, const T& in) {
|
||||
WriteParam(writer, in.error);
|
||||
WriteParam(writer, in.options);
|
||||
WriteParam(writer, in.limits);
|
||||
WriteParam(writer, in.uploadableSdTypes);
|
||||
}
|
||||
|
||||
static bool Read(const Message* const msg, PickleIterator* const itr,
|
||||
T* const out) {
|
||||
return ReadParam(msg, itr, &out->error) &&
|
||||
ReadParam(msg, itr, &out->options) &&
|
||||
ReadParam(msg, itr, &out->limits) &&
|
||||
ReadParam(msg, itr, &out->uploadableSdTypes);
|
||||
static bool Read(MessageReader* const reader, T* const out) {
|
||||
return ReadParam(reader, &out->error) && ReadParam(reader, &out->options) &&
|
||||
ReadParam(reader, &out->limits) &&
|
||||
ReadParam(reader, &out->uploadableSdTypes);
|
||||
}
|
||||
};
|
||||
|
||||
@ -313,18 +311,17 @@ template <>
|
||||
struct ParamTraits<mozilla::webgl::ReadPixelsDesc> final {
|
||||
using T = mozilla::webgl::ReadPixelsDesc;
|
||||
|
||||
static void Write(Message* const msg, const T& in) {
|
||||
WriteParam(msg, in.srcOffset);
|
||||
WriteParam(msg, in.size);
|
||||
WriteParam(msg, in.pi);
|
||||
WriteParam(msg, in.packState);
|
||||
static void Write(MessageWriter* const writer, const T& in) {
|
||||
WriteParam(writer, in.srcOffset);
|
||||
WriteParam(writer, in.size);
|
||||
WriteParam(writer, in.pi);
|
||||
WriteParam(writer, in.packState);
|
||||
}
|
||||
|
||||
static bool Read(const Message* const msg, PickleIterator* const itr,
|
||||
T* const out) {
|
||||
return ReadParam(msg, itr, &out->srcOffset) &&
|
||||
ReadParam(msg, itr, &out->size) && ReadParam(msg, itr, &out->pi) &&
|
||||
ReadParam(msg, itr, &out->packState);
|
||||
static bool Read(MessageReader* const reader, T* const out) {
|
||||
return ReadParam(reader, &out->srcOffset) &&
|
||||
ReadParam(reader, &out->size) && ReadParam(reader, &out->pi) &&
|
||||
ReadParam(reader, &out->packState);
|
||||
}
|
||||
};
|
||||
|
||||
@ -334,14 +331,13 @@ template <>
|
||||
struct ParamTraits<mozilla::webgl::PackingInfo> final {
|
||||
using T = mozilla::webgl::PackingInfo;
|
||||
|
||||
static void Write(Message* const msg, const T& in) {
|
||||
WriteParam(msg, in.format);
|
||||
WriteParam(msg, in.type);
|
||||
static void Write(MessageWriter* const writer, const T& in) {
|
||||
WriteParam(writer, in.format);
|
||||
WriteParam(writer, in.type);
|
||||
}
|
||||
|
||||
static bool Read(const Message* const msg, PickleIterator* const itr,
|
||||
T* const out) {
|
||||
return ReadParam(msg, itr, &out->format) && ReadParam(msg, itr, &out->type);
|
||||
static bool Read(MessageReader* const reader, T* const out) {
|
||||
return ReadParam(reader, &out->format) && ReadParam(reader, &out->type);
|
||||
}
|
||||
};
|
||||
|
||||
@ -351,19 +347,17 @@ template <>
|
||||
struct ParamTraits<mozilla::webgl::CompileResult> final {
|
||||
using T = mozilla::webgl::CompileResult;
|
||||
|
||||
static void Write(Message* const msg, const T& in) {
|
||||
WriteParam(msg, in.pending);
|
||||
WriteParam(msg, in.log);
|
||||
WriteParam(msg, in.translatedSource);
|
||||
WriteParam(msg, in.success);
|
||||
static void Write(MessageWriter* const writer, const T& in) {
|
||||
WriteParam(writer, in.pending);
|
||||
WriteParam(writer, in.log);
|
||||
WriteParam(writer, in.translatedSource);
|
||||
WriteParam(writer, in.success);
|
||||
}
|
||||
|
||||
static bool Read(const Message* const msg, PickleIterator* const itr,
|
||||
T* const out) {
|
||||
return ReadParam(msg, itr, &out->pending) &&
|
||||
ReadParam(msg, itr, &out->log) &&
|
||||
ReadParam(msg, itr, &out->translatedSource) &&
|
||||
ReadParam(msg, itr, &out->success);
|
||||
static bool Read(MessageReader* const reader, T* const out) {
|
||||
return ReadParam(reader, &out->pending) && ReadParam(reader, &out->log) &&
|
||||
ReadParam(reader, &out->translatedSource) &&
|
||||
ReadParam(reader, &out->success);
|
||||
}
|
||||
};
|
||||
|
||||
@ -373,21 +367,19 @@ template <>
|
||||
struct ParamTraits<mozilla::webgl::LinkResult> final {
|
||||
using T = mozilla::webgl::LinkResult;
|
||||
|
||||
static void Write(Message* const msg, const T& in) {
|
||||
WriteParam(msg, in.pending);
|
||||
WriteParam(msg, in.log);
|
||||
WriteParam(msg, in.success);
|
||||
WriteParam(msg, in.active);
|
||||
WriteParam(msg, in.tfBufferMode);
|
||||
static void Write(MessageWriter* const writer, const T& in) {
|
||||
WriteParam(writer, in.pending);
|
||||
WriteParam(writer, in.log);
|
||||
WriteParam(writer, in.success);
|
||||
WriteParam(writer, in.active);
|
||||
WriteParam(writer, in.tfBufferMode);
|
||||
}
|
||||
|
||||
static bool Read(const Message* const msg, PickleIterator* const itr,
|
||||
T* const out) {
|
||||
return ReadParam(msg, itr, &out->pending) &&
|
||||
ReadParam(msg, itr, &out->log) &&
|
||||
ReadParam(msg, itr, &out->success) &&
|
||||
ReadParam(msg, itr, &out->active) &&
|
||||
ReadParam(msg, itr, &out->tfBufferMode);
|
||||
static bool Read(MessageReader* const reader, T* const out) {
|
||||
return ReadParam(reader, &out->pending) && ReadParam(reader, &out->log) &&
|
||||
ReadParam(reader, &out->success) &&
|
||||
ReadParam(reader, &out->active) &&
|
||||
ReadParam(reader, &out->tfBufferMode);
|
||||
}
|
||||
};
|
||||
|
||||
@ -397,19 +389,18 @@ template <>
|
||||
struct ParamTraits<mozilla::webgl::LinkActiveInfo> final {
|
||||
using T = mozilla::webgl::LinkActiveInfo;
|
||||
|
||||
static void Write(Message* const msg, const T& in) {
|
||||
WriteParam(msg, in.activeAttribs);
|
||||
WriteParam(msg, in.activeUniforms);
|
||||
WriteParam(msg, in.activeUniformBlocks);
|
||||
WriteParam(msg, in.activeTfVaryings);
|
||||
static void Write(MessageWriter* const writer, const T& in) {
|
||||
WriteParam(writer, in.activeAttribs);
|
||||
WriteParam(writer, in.activeUniforms);
|
||||
WriteParam(writer, in.activeUniformBlocks);
|
||||
WriteParam(writer, in.activeTfVaryings);
|
||||
}
|
||||
|
||||
static bool Read(const Message* const msg, PickleIterator* const itr,
|
||||
T* const out) {
|
||||
return ReadParam(msg, itr, &out->activeAttribs) &&
|
||||
ReadParam(msg, itr, &out->activeUniforms) &&
|
||||
ReadParam(msg, itr, &out->activeUniformBlocks) &&
|
||||
ReadParam(msg, itr, &out->activeTfVaryings);
|
||||
static bool Read(MessageReader* const reader, T* const out) {
|
||||
return ReadParam(reader, &out->activeAttribs) &&
|
||||
ReadParam(reader, &out->activeUniforms) &&
|
||||
ReadParam(reader, &out->activeUniformBlocks) &&
|
||||
ReadParam(reader, &out->activeTfVaryings);
|
||||
}
|
||||
};
|
||||
|
||||
@ -419,17 +410,15 @@ template <>
|
||||
struct ParamTraits<mozilla::webgl::ActiveInfo> final {
|
||||
using T = mozilla::webgl::ActiveInfo;
|
||||
|
||||
static void Write(Message* const msg, const T& in) {
|
||||
WriteParam(msg, in.elemType);
|
||||
WriteParam(msg, in.elemCount);
|
||||
WriteParam(msg, in.name);
|
||||
static void Write(MessageWriter* const writer, const T& in) {
|
||||
WriteParam(writer, in.elemType);
|
||||
WriteParam(writer, in.elemCount);
|
||||
WriteParam(writer, in.name);
|
||||
}
|
||||
|
||||
static bool Read(const Message* const msg, PickleIterator* const itr,
|
||||
T* const out) {
|
||||
return ReadParam(msg, itr, &out->elemType) &&
|
||||
ReadParam(msg, itr, &out->elemCount) &&
|
||||
ReadParam(msg, itr, &out->name);
|
||||
static bool Read(MessageReader* const reader, T* const out) {
|
||||
return ReadParam(reader, &out->elemType) &&
|
||||
ReadParam(reader, &out->elemCount) && ReadParam(reader, &out->name);
|
||||
}
|
||||
};
|
||||
|
||||
@ -439,17 +428,16 @@ template <>
|
||||
struct ParamTraits<mozilla::webgl::ActiveAttribInfo> final {
|
||||
using T = mozilla::webgl::ActiveAttribInfo;
|
||||
|
||||
static void Write(Message* const msg, const T& in) {
|
||||
WriteParam(msg, static_cast<const mozilla::webgl::ActiveInfo&>(in));
|
||||
WriteParam(msg, in.location);
|
||||
WriteParam(msg, in.baseType);
|
||||
static void Write(MessageWriter* const writer, const T& in) {
|
||||
WriteParam(writer, static_cast<const mozilla::webgl::ActiveInfo&>(in));
|
||||
WriteParam(writer, in.location);
|
||||
WriteParam(writer, in.baseType);
|
||||
}
|
||||
|
||||
static bool Read(const Message* const msg, PickleIterator* const itr,
|
||||
T* const out) {
|
||||
return ReadParam(msg, itr, static_cast<mozilla::webgl::ActiveInfo*>(out)) &&
|
||||
ReadParam(msg, itr, &out->location) &&
|
||||
ReadParam(msg, itr, &out->baseType);
|
||||
static bool Read(MessageReader* const reader, T* const out) {
|
||||
return ReadParam(reader, static_cast<mozilla::webgl::ActiveInfo*>(out)) &&
|
||||
ReadParam(reader, &out->location) &&
|
||||
ReadParam(reader, &out->baseType);
|
||||
}
|
||||
};
|
||||
|
||||
@ -459,25 +447,24 @@ template <>
|
||||
struct ParamTraits<mozilla::webgl::ActiveUniformInfo> final {
|
||||
using T = mozilla::webgl::ActiveUniformInfo;
|
||||
|
||||
static void Write(Message* const msg, const T& in) {
|
||||
WriteParam(msg, static_cast<const mozilla::webgl::ActiveInfo&>(in));
|
||||
WriteParam(msg, in.locByIndex);
|
||||
WriteParam(msg, in.block_index);
|
||||
WriteParam(msg, in.block_offset);
|
||||
WriteParam(msg, in.block_arrayStride);
|
||||
WriteParam(msg, in.block_matrixStride);
|
||||
WriteParam(msg, in.block_isRowMajor);
|
||||
static void Write(MessageWriter* const writer, const T& in) {
|
||||
WriteParam(writer, static_cast<const mozilla::webgl::ActiveInfo&>(in));
|
||||
WriteParam(writer, in.locByIndex);
|
||||
WriteParam(writer, in.block_index);
|
||||
WriteParam(writer, in.block_offset);
|
||||
WriteParam(writer, in.block_arrayStride);
|
||||
WriteParam(writer, in.block_matrixStride);
|
||||
WriteParam(writer, in.block_isRowMajor);
|
||||
}
|
||||
|
||||
static bool Read(const Message* const msg, PickleIterator* const itr,
|
||||
T* const out) {
|
||||
return ReadParam(msg, itr, static_cast<mozilla::webgl::ActiveInfo*>(out)) &&
|
||||
ReadParam(msg, itr, &out->locByIndex) &&
|
||||
ReadParam(msg, itr, &out->block_index) &&
|
||||
ReadParam(msg, itr, &out->block_offset) &&
|
||||
ReadParam(msg, itr, &out->block_arrayStride) &&
|
||||
ReadParam(msg, itr, &out->block_matrixStride) &&
|
||||
ReadParam(msg, itr, &out->block_isRowMajor);
|
||||
static bool Read(MessageReader* const reader, T* const out) {
|
||||
return ReadParam(reader, static_cast<mozilla::webgl::ActiveInfo*>(out)) &&
|
||||
ReadParam(reader, &out->locByIndex) &&
|
||||
ReadParam(reader, &out->block_index) &&
|
||||
ReadParam(reader, &out->block_offset) &&
|
||||
ReadParam(reader, &out->block_arrayStride) &&
|
||||
ReadParam(reader, &out->block_matrixStride) &&
|
||||
ReadParam(reader, &out->block_isRowMajor);
|
||||
}
|
||||
};
|
||||
|
||||
@ -487,21 +474,19 @@ template <>
|
||||
struct ParamTraits<mozilla::webgl::ActiveUniformBlockInfo> final {
|
||||
using T = mozilla::webgl::ActiveUniformBlockInfo;
|
||||
|
||||
static void Write(Message* const msg, const T& in) {
|
||||
WriteParam(msg, in.name);
|
||||
WriteParam(msg, in.dataSize);
|
||||
WriteParam(msg, in.activeUniformIndices);
|
||||
WriteParam(msg, in.referencedByVertexShader);
|
||||
WriteParam(msg, in.referencedByFragmentShader);
|
||||
static void Write(MessageWriter* const writer, const T& in) {
|
||||
WriteParam(writer, in.name);
|
||||
WriteParam(writer, in.dataSize);
|
||||
WriteParam(writer, in.activeUniformIndices);
|
||||
WriteParam(writer, in.referencedByVertexShader);
|
||||
WriteParam(writer, in.referencedByFragmentShader);
|
||||
}
|
||||
|
||||
static bool Read(const Message* const msg, PickleIterator* const itr,
|
||||
T* const out) {
|
||||
return ReadParam(msg, itr, &out->name) &&
|
||||
ReadParam(msg, itr, &out->dataSize) &&
|
||||
ReadParam(msg, itr, &out->activeUniformIndices) &&
|
||||
ReadParam(msg, itr, &out->referencedByVertexShader) &&
|
||||
ReadParam(msg, itr, &out->referencedByFragmentShader);
|
||||
static bool Read(MessageReader* const reader, T* const out) {
|
||||
return ReadParam(reader, &out->name) && ReadParam(reader, &out->dataSize) &&
|
||||
ReadParam(reader, &out->activeUniformIndices) &&
|
||||
ReadParam(reader, &out->referencedByVertexShader) &&
|
||||
ReadParam(reader, &out->referencedByFragmentShader);
|
||||
}
|
||||
};
|
||||
|
||||
@ -511,17 +496,16 @@ template <>
|
||||
struct ParamTraits<mozilla::webgl::ShaderPrecisionFormat> final {
|
||||
using T = mozilla::webgl::ShaderPrecisionFormat;
|
||||
|
||||
static void Write(Message* const msg, const T& in) {
|
||||
WriteParam(msg, in.rangeMin);
|
||||
WriteParam(msg, in.rangeMax);
|
||||
WriteParam(msg, in.precision);
|
||||
static void Write(MessageWriter* const writer, const T& in) {
|
||||
WriteParam(writer, in.rangeMin);
|
||||
WriteParam(writer, in.rangeMax);
|
||||
WriteParam(writer, in.precision);
|
||||
}
|
||||
|
||||
static bool Read(const Message* const msg, PickleIterator* const itr,
|
||||
T* const out) {
|
||||
return ReadParam(msg, itr, &out->rangeMin) &&
|
||||
ReadParam(msg, itr, &out->rangeMax) &&
|
||||
ReadParam(msg, itr, &out->precision);
|
||||
static bool Read(MessageReader* const reader, T* const out) {
|
||||
return ReadParam(reader, &out->rangeMin) &&
|
||||
ReadParam(reader, &out->rangeMax) &&
|
||||
ReadParam(reader, &out->precision);
|
||||
}
|
||||
};
|
||||
|
||||
@ -534,16 +518,15 @@ struct ParamTraits<U[N]> final {
|
||||
|
||||
static_assert(std::is_trivial<U>::value);
|
||||
|
||||
static void Write(Message* const msg, const T& in) {
|
||||
msg->WriteBytes(in, kByteSize);
|
||||
static void Write(MessageWriter* const writer, const T& in) {
|
||||
writer->WriteBytes(in, kByteSize);
|
||||
}
|
||||
|
||||
static bool Read(const Message* const msg, PickleIterator* const itr,
|
||||
T* const out) {
|
||||
if (!msg->HasBytesAvailable(itr, kByteSize)) {
|
||||
static bool Read(MessageReader* const reader, T* const out) {
|
||||
if (!reader->HasBytesAvailable(kByteSize)) {
|
||||
return false;
|
||||
}
|
||||
return msg->ReadBytesInto(itr, *out, kByteSize);
|
||||
return reader->ReadBytesInto(*out, kByteSize);
|
||||
}
|
||||
};
|
||||
|
||||
@ -553,15 +536,14 @@ template <>
|
||||
struct ParamTraits<mozilla::webgl::GetUniformData> final {
|
||||
using T = mozilla::webgl::GetUniformData;
|
||||
|
||||
static void Write(Message* const msg, const T& in) {
|
||||
ParamTraits<decltype(in.data)>::Write(msg, in.data);
|
||||
WriteParam(msg, in.type);
|
||||
static void Write(MessageWriter* const writer, const T& in) {
|
||||
ParamTraits<decltype(in.data)>::Write(writer, in.data);
|
||||
WriteParam(writer, in.type);
|
||||
}
|
||||
|
||||
static bool Read(const Message* const msg, PickleIterator* const itr,
|
||||
T* const out) {
|
||||
return ParamTraits<decltype(out->data)>::Read(msg, itr, &out->data) &&
|
||||
ReadParam(msg, itr, &out->type);
|
||||
static bool Read(MessageReader* const reader, T* const out) {
|
||||
return ParamTraits<decltype(out->data)>::Read(reader, &out->data) &&
|
||||
ReadParam(reader, &out->type);
|
||||
}
|
||||
};
|
||||
|
||||
@ -571,14 +553,13 @@ template <typename U>
|
||||
struct ParamTraits<mozilla::avec2<U>> final {
|
||||
using T = mozilla::avec2<U>;
|
||||
|
||||
static void Write(Message* const msg, const T& in) {
|
||||
WriteParam(msg, in.x);
|
||||
WriteParam(msg, in.y);
|
||||
static void Write(MessageWriter* const writer, const T& in) {
|
||||
WriteParam(writer, in.x);
|
||||
WriteParam(writer, in.y);
|
||||
}
|
||||
|
||||
static bool Read(const Message* const msg, PickleIterator* const itr,
|
||||
T* const out) {
|
||||
return ReadParam(msg, itr, &out->x) && ReadParam(msg, itr, &out->y);
|
||||
static bool Read(MessageReader* const reader, T* const out) {
|
||||
return ReadParam(reader, &out->x) && ReadParam(reader, &out->y);
|
||||
}
|
||||
};
|
||||
|
||||
@ -588,16 +569,15 @@ template <typename U>
|
||||
struct ParamTraits<mozilla::avec3<U>> final {
|
||||
using T = mozilla::avec3<U>;
|
||||
|
||||
static void Write(Message* const msg, const T& in) {
|
||||
WriteParam(msg, in.x);
|
||||
WriteParam(msg, in.y);
|
||||
WriteParam(msg, in.z);
|
||||
static void Write(MessageWriter* const writer, const T& in) {
|
||||
WriteParam(writer, in.x);
|
||||
WriteParam(writer, in.y);
|
||||
WriteParam(writer, in.z);
|
||||
}
|
||||
|
||||
static bool Read(const Message* const msg, PickleIterator* const itr,
|
||||
T* const out) {
|
||||
return ReadParam(msg, itr, &out->x) && ReadParam(msg, itr, &out->y) &&
|
||||
ReadParam(msg, itr, &out->z);
|
||||
static bool Read(MessageReader* const reader, T* const out) {
|
||||
return ReadParam(reader, &out->x) && ReadParam(reader, &out->y) &&
|
||||
ReadParam(reader, &out->z);
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -780,38 +780,39 @@ double Event::TimeStamp() {
|
||||
workerPrivate->CrossOriginIsolated());
|
||||
}
|
||||
|
||||
void Event::Serialize(IPC::Message* aMsg, bool aSerializeInterfaceType) {
|
||||
void Event::Serialize(IPC::MessageWriter* aWriter,
|
||||
bool aSerializeInterfaceType) {
|
||||
if (aSerializeInterfaceType) {
|
||||
IPC::WriteParam(aMsg, u"event"_ns);
|
||||
IPC::WriteParam(aWriter, u"event"_ns);
|
||||
}
|
||||
|
||||
nsString type;
|
||||
GetType(type);
|
||||
IPC::WriteParam(aMsg, type);
|
||||
IPC::WriteParam(aWriter, type);
|
||||
|
||||
IPC::WriteParam(aMsg, Bubbles());
|
||||
IPC::WriteParam(aMsg, Cancelable());
|
||||
IPC::WriteParam(aMsg, IsTrusted());
|
||||
IPC::WriteParam(aMsg, Composed());
|
||||
IPC::WriteParam(aWriter, Bubbles());
|
||||
IPC::WriteParam(aWriter, Cancelable());
|
||||
IPC::WriteParam(aWriter, IsTrusted());
|
||||
IPC::WriteParam(aWriter, Composed());
|
||||
|
||||
// No timestamp serialization for now!
|
||||
}
|
||||
|
||||
bool Event::Deserialize(const IPC::Message* aMsg, PickleIterator* aIter) {
|
||||
bool Event::Deserialize(IPC::MessageReader* aReader) {
|
||||
nsString type;
|
||||
NS_ENSURE_TRUE(IPC::ReadParam(aMsg, aIter, &type), false);
|
||||
NS_ENSURE_TRUE(IPC::ReadParam(aReader, &type), false);
|
||||
|
||||
bool bubbles = false;
|
||||
NS_ENSURE_TRUE(IPC::ReadParam(aMsg, aIter, &bubbles), false);
|
||||
NS_ENSURE_TRUE(IPC::ReadParam(aReader, &bubbles), false);
|
||||
|
||||
bool cancelable = false;
|
||||
NS_ENSURE_TRUE(IPC::ReadParam(aMsg, aIter, &cancelable), false);
|
||||
NS_ENSURE_TRUE(IPC::ReadParam(aReader, &cancelable), false);
|
||||
|
||||
bool trusted = false;
|
||||
NS_ENSURE_TRUE(IPC::ReadParam(aMsg, aIter, &trusted), false);
|
||||
NS_ENSURE_TRUE(IPC::ReadParam(aReader, &trusted), false);
|
||||
|
||||
bool composed = false;
|
||||
NS_ENSURE_TRUE(IPC::ReadParam(aMsg, aIter, &composed), false);
|
||||
NS_ENSURE_TRUE(IPC::ReadParam(aReader, &composed), false);
|
||||
|
||||
InitEvent(type, bubbles, cancelable);
|
||||
SetTrusted(trusted);
|
||||
|
@ -144,8 +144,9 @@ class Event : public nsISupports, public nsWrapperCache {
|
||||
const WidgetEvent* WidgetEventPtr() const {
|
||||
return const_cast<Event*>(this)->WidgetEventPtr();
|
||||
}
|
||||
virtual void Serialize(IPC::Message* aMsg, bool aSerializeInterfaceType);
|
||||
virtual bool Deserialize(const IPC::Message* aMsg, PickleIterator* aIter);
|
||||
virtual void Serialize(IPC::MessageWriter* aWriter,
|
||||
bool aSerializeInterfaceType);
|
||||
virtual bool Deserialize(IPC::MessageReader* aReader);
|
||||
void SetOwner(EventTarget* aOwner);
|
||||
void StopCrossProcessForwarding();
|
||||
void SetTrusted(bool aTrusted);
|
||||
|
@ -79,31 +79,30 @@ already_AddRefed<PaintRequestList> NotifyPaintEvent::PaintRequests(
|
||||
return requests.forget();
|
||||
}
|
||||
|
||||
void NotifyPaintEvent::Serialize(IPC::Message* aMsg,
|
||||
void NotifyPaintEvent::Serialize(IPC::MessageWriter* aWriter,
|
||||
bool aSerializeInterfaceType) {
|
||||
if (aSerializeInterfaceType) {
|
||||
IPC::WriteParam(aMsg, u"notifypaintevent"_ns);
|
||||
IPC::WriteParam(aWriter, u"notifypaintevent"_ns);
|
||||
}
|
||||
|
||||
Event::Serialize(aMsg, false);
|
||||
Event::Serialize(aWriter, false);
|
||||
|
||||
uint32_t length = mInvalidateRequests.Length();
|
||||
IPC::WriteParam(aMsg, length);
|
||||
IPC::WriteParam(aWriter, length);
|
||||
for (uint32_t i = 0; i < length; ++i) {
|
||||
IPC::WriteParam(aMsg, mInvalidateRequests[i]);
|
||||
IPC::WriteParam(aWriter, mInvalidateRequests[i]);
|
||||
}
|
||||
}
|
||||
|
||||
bool NotifyPaintEvent::Deserialize(const IPC::Message* aMsg,
|
||||
PickleIterator* aIter) {
|
||||
NS_ENSURE_TRUE(Event::Deserialize(aMsg, aIter), false);
|
||||
bool NotifyPaintEvent::Deserialize(IPC::MessageReader* aReader) {
|
||||
NS_ENSURE_TRUE(Event::Deserialize(aReader), false);
|
||||
|
||||
uint32_t length = 0;
|
||||
NS_ENSURE_TRUE(IPC::ReadParam(aMsg, aIter, &length), false);
|
||||
NS_ENSURE_TRUE(IPC::ReadParam(aReader, &length), false);
|
||||
mInvalidateRequests.SetCapacity(length);
|
||||
for (uint32_t i = 0; i < length; ++i) {
|
||||
nsRect req;
|
||||
NS_ENSURE_TRUE(IPC::ReadParam(aMsg, aIter, &req), false);
|
||||
NS_ENSURE_TRUE(IPC::ReadParam(aReader, &req), false);
|
||||
mInvalidateRequests.AppendElement(req);
|
||||
}
|
||||
|
||||
|
@ -30,8 +30,9 @@ class NotifyPaintEvent : public Event {
|
||||
|
||||
NS_INLINE_DECL_REFCOUNTING_INHERITED(NotifyPaintEvent, Event)
|
||||
|
||||
void Serialize(IPC::Message* aMsg, bool aSerializeInterfaceType) override;
|
||||
bool Deserialize(const IPC::Message* aMsg, PickleIterator* aIter) override;
|
||||
void Serialize(IPC::MessageWriter* aWriter,
|
||||
bool aSerializeInterfaceType) override;
|
||||
bool Deserialize(IPC::MessageReader* aReader) override;
|
||||
|
||||
virtual JSObject* WrapObjectInternal(
|
||||
JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override {
|
||||
|
@ -38,29 +38,28 @@ void ScrollAreaEvent::InitScrollAreaEvent(const nsAString& aEventType,
|
||||
mClientArea->SetRect(aX, aY, aWidth, aHeight);
|
||||
}
|
||||
|
||||
void ScrollAreaEvent::Serialize(IPC::Message* aMsg,
|
||||
void ScrollAreaEvent::Serialize(IPC::MessageWriter* aWriter,
|
||||
bool aSerializeInterfaceType) {
|
||||
if (aSerializeInterfaceType) {
|
||||
IPC::WriteParam(aMsg, u"scrollareaevent"_ns);
|
||||
IPC::WriteParam(aWriter, u"scrollareaevent"_ns);
|
||||
}
|
||||
|
||||
Event::Serialize(aMsg, false);
|
||||
Event::Serialize(aWriter, false);
|
||||
|
||||
IPC::WriteParam(aMsg, X());
|
||||
IPC::WriteParam(aMsg, Y());
|
||||
IPC::WriteParam(aMsg, Width());
|
||||
IPC::WriteParam(aMsg, Height());
|
||||
IPC::WriteParam(aWriter, X());
|
||||
IPC::WriteParam(aWriter, Y());
|
||||
IPC::WriteParam(aWriter, Width());
|
||||
IPC::WriteParam(aWriter, Height());
|
||||
}
|
||||
|
||||
bool ScrollAreaEvent::Deserialize(const IPC::Message* aMsg,
|
||||
PickleIterator* aIter) {
|
||||
NS_ENSURE_TRUE(Event::Deserialize(aMsg, aIter), false);
|
||||
bool ScrollAreaEvent::Deserialize(IPC::MessageReader* aReader) {
|
||||
NS_ENSURE_TRUE(Event::Deserialize(aReader), false);
|
||||
|
||||
float x, y, width, height;
|
||||
NS_ENSURE_TRUE(IPC::ReadParam(aMsg, aIter, &x), false);
|
||||
NS_ENSURE_TRUE(IPC::ReadParam(aMsg, aIter, &y), false);
|
||||
NS_ENSURE_TRUE(IPC::ReadParam(aMsg, aIter, &width), false);
|
||||
NS_ENSURE_TRUE(IPC::ReadParam(aMsg, aIter, &height), false);
|
||||
NS_ENSURE_TRUE(IPC::ReadParam(aReader, &x), false);
|
||||
NS_ENSURE_TRUE(IPC::ReadParam(aReader, &y), false);
|
||||
NS_ENSURE_TRUE(IPC::ReadParam(aReader, &width), false);
|
||||
NS_ENSURE_TRUE(IPC::ReadParam(aReader, &height), false);
|
||||
mClientArea->SetRect(x, y, width, height);
|
||||
|
||||
return true;
|
||||
|
@ -24,8 +24,9 @@ class ScrollAreaEvent : public UIEvent {
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(ScrollAreaEvent, UIEvent)
|
||||
|
||||
void Serialize(IPC::Message* aMsg, bool aSerializeInterfaceType) override;
|
||||
bool Deserialize(const IPC::Message* aMsg, PickleIterator* aIter) override;
|
||||
void Serialize(IPC::MessageWriter* aWriter,
|
||||
bool aSerializeInterfaceType) override;
|
||||
bool Deserialize(IPC::MessageReader* aReader) override;
|
||||
|
||||
virtual JSObject* WrapObjectInternal(
|
||||
JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override {
|
||||
|
@ -207,19 +207,20 @@ void UIEvent::DuplicatePrivateData() {
|
||||
mEvent->mRefPoint = RoundedToInt(screenPoint * scale);
|
||||
}
|
||||
|
||||
void UIEvent::Serialize(IPC::Message* aMsg, bool aSerializeInterfaceType) {
|
||||
void UIEvent::Serialize(IPC::MessageWriter* aWriter,
|
||||
bool aSerializeInterfaceType) {
|
||||
if (aSerializeInterfaceType) {
|
||||
IPC::WriteParam(aMsg, u"uievent"_ns);
|
||||
IPC::WriteParam(aWriter, u"uievent"_ns);
|
||||
}
|
||||
|
||||
Event::Serialize(aMsg, false);
|
||||
Event::Serialize(aWriter, false);
|
||||
|
||||
IPC::WriteParam(aMsg, Detail());
|
||||
IPC::WriteParam(aWriter, Detail());
|
||||
}
|
||||
|
||||
bool UIEvent::Deserialize(const IPC::Message* aMsg, PickleIterator* aIter) {
|
||||
NS_ENSURE_TRUE(Event::Deserialize(aMsg, aIter), false);
|
||||
NS_ENSURE_TRUE(IPC::ReadParam(aMsg, aIter, &mDetail), false);
|
||||
bool UIEvent::Deserialize(IPC::MessageReader* aReader) {
|
||||
NS_ENSURE_TRUE(Event::Deserialize(aReader), false);
|
||||
NS_ENSURE_TRUE(IPC::ReadParam(aReader, &mDetail), false);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -31,8 +31,9 @@ class UIEvent : public Event {
|
||||
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(UIEvent, Event)
|
||||
|
||||
void DuplicatePrivateData() override;
|
||||
void Serialize(IPC::Message* aMsg, bool aSerializeInterfaceType) override;
|
||||
bool Deserialize(const IPC::Message* aMsg, PickleIterator* aIter) override;
|
||||
void Serialize(IPC::MessageWriter* aWriter,
|
||||
bool aSerializeInterfaceType) override;
|
||||
bool Deserialize(IPC::MessageReader* aReader) override;
|
||||
|
||||
static already_AddRefed<UIEvent> Constructor(const GlobalObject& aGlobal,
|
||||
const nsAString& aType,
|
||||
|
@ -195,32 +195,33 @@ nsresult SerializeUntyped(BlobImpl* aBlobImpl, IProtocol* aActor,
|
||||
|
||||
namespace ipc {
|
||||
void IPDLParamTraits<mozilla::dom::BlobImpl*>::Write(
|
||||
IPC::Message* aMsg, IProtocol* aActor, mozilla::dom::BlobImpl* aParam) {
|
||||
IPC::MessageWriter* aWriter, IProtocol* aActor,
|
||||
mozilla::dom::BlobImpl* aParam) {
|
||||
nsresult rv;
|
||||
mozilla::dom::IPCBlob ipcblob;
|
||||
if (aParam) {
|
||||
rv = mozilla::dom::IPCBlobUtils::SerializeUntyped(aParam, aActor, ipcblob);
|
||||
}
|
||||
if (!aParam || NS_WARN_IF(NS_FAILED(rv))) {
|
||||
WriteIPDLParam(aMsg, aActor, false);
|
||||
WriteIPDLParam(aWriter, aActor, false);
|
||||
} else {
|
||||
WriteIPDLParam(aMsg, aActor, true);
|
||||
WriteIPDLParam(aMsg, aActor, ipcblob);
|
||||
WriteIPDLParam(aWriter, aActor, true);
|
||||
WriteIPDLParam(aWriter, aActor, ipcblob);
|
||||
}
|
||||
}
|
||||
|
||||
bool IPDLParamTraits<mozilla::dom::BlobImpl*>::Read(
|
||||
const IPC::Message* aMsg, PickleIterator* aIter, IProtocol* aActor,
|
||||
IPC::MessageReader* aReader, IProtocol* aActor,
|
||||
RefPtr<mozilla::dom::BlobImpl>* aResult) {
|
||||
*aResult = nullptr;
|
||||
|
||||
bool notnull = false;
|
||||
if (!ReadIPDLParam(aMsg, aIter, aActor, ¬null)) {
|
||||
if (!ReadIPDLParam(aReader, aActor, ¬null)) {
|
||||
return false;
|
||||
}
|
||||
if (notnull) {
|
||||
mozilla::dom::IPCBlob ipcblob;
|
||||
if (!ReadIPDLParam(aMsg, aIter, aActor, &ipcblob)) {
|
||||
if (!ReadIPDLParam(aReader, aActor, &ipcblob)) {
|
||||
return false;
|
||||
}
|
||||
*aResult = mozilla::dom::IPCBlobUtils::Deserialize(ipcblob);
|
||||
|
@ -285,10 +285,10 @@ namespace ipc {
|
||||
// __always make sure to handle null!__
|
||||
template <>
|
||||
struct IPDLParamTraits<mozilla::dom::BlobImpl*> {
|
||||
static void Write(IPC::Message* aMsg, IProtocol* aActor,
|
||||
static void Write(IPC::MessageWriter* aWriter, IProtocol* aActor,
|
||||
mozilla::dom::BlobImpl* aParam);
|
||||
static bool Read(const IPC::Message* aMsg, PickleIterator* aIter,
|
||||
IProtocol* aActor, RefPtr<mozilla::dom::BlobImpl>* aResult);
|
||||
static bool Read(IPC::MessageReader* aReader, IProtocol* aActor,
|
||||
RefPtr<mozilla::dom::BlobImpl>* aResult);
|
||||
};
|
||||
} // namespace ipc
|
||||
} // namespace mozilla
|
||||
|
@ -47,55 +47,54 @@ template <>
|
||||
struct ParamTraits<mozilla::dom::GamepadPoseState> {
|
||||
typedef mozilla::dom::GamepadPoseState paramType;
|
||||
|
||||
static void Write(Message* aMsg, const paramType& aParam) {
|
||||
WriteParam(aMsg, aParam.flags);
|
||||
WriteParam(aMsg, aParam.orientation[0]);
|
||||
WriteParam(aMsg, aParam.orientation[1]);
|
||||
WriteParam(aMsg, aParam.orientation[2]);
|
||||
WriteParam(aMsg, aParam.orientation[3]);
|
||||
WriteParam(aMsg, aParam.position[0]);
|
||||
WriteParam(aMsg, aParam.position[1]);
|
||||
WriteParam(aMsg, aParam.position[2]);
|
||||
WriteParam(aMsg, aParam.angularVelocity[0]);
|
||||
WriteParam(aMsg, aParam.angularVelocity[1]);
|
||||
WriteParam(aMsg, aParam.angularVelocity[2]);
|
||||
WriteParam(aMsg, aParam.angularAcceleration[0]);
|
||||
WriteParam(aMsg, aParam.angularAcceleration[1]);
|
||||
WriteParam(aMsg, aParam.angularAcceleration[2]);
|
||||
WriteParam(aMsg, aParam.linearVelocity[0]);
|
||||
WriteParam(aMsg, aParam.linearVelocity[1]);
|
||||
WriteParam(aMsg, aParam.linearVelocity[2]);
|
||||
WriteParam(aMsg, aParam.linearAcceleration[0]);
|
||||
WriteParam(aMsg, aParam.linearAcceleration[1]);
|
||||
WriteParam(aMsg, aParam.linearAcceleration[2]);
|
||||
WriteParam(aMsg, aParam.isPositionValid);
|
||||
WriteParam(aMsg, aParam.isOrientationValid);
|
||||
static void Write(MessageWriter* aWriter, const paramType& aParam) {
|
||||
WriteParam(aWriter, aParam.flags);
|
||||
WriteParam(aWriter, aParam.orientation[0]);
|
||||
WriteParam(aWriter, aParam.orientation[1]);
|
||||
WriteParam(aWriter, aParam.orientation[2]);
|
||||
WriteParam(aWriter, aParam.orientation[3]);
|
||||
WriteParam(aWriter, aParam.position[0]);
|
||||
WriteParam(aWriter, aParam.position[1]);
|
||||
WriteParam(aWriter, aParam.position[2]);
|
||||
WriteParam(aWriter, aParam.angularVelocity[0]);
|
||||
WriteParam(aWriter, aParam.angularVelocity[1]);
|
||||
WriteParam(aWriter, aParam.angularVelocity[2]);
|
||||
WriteParam(aWriter, aParam.angularAcceleration[0]);
|
||||
WriteParam(aWriter, aParam.angularAcceleration[1]);
|
||||
WriteParam(aWriter, aParam.angularAcceleration[2]);
|
||||
WriteParam(aWriter, aParam.linearVelocity[0]);
|
||||
WriteParam(aWriter, aParam.linearVelocity[1]);
|
||||
WriteParam(aWriter, aParam.linearVelocity[2]);
|
||||
WriteParam(aWriter, aParam.linearAcceleration[0]);
|
||||
WriteParam(aWriter, aParam.linearAcceleration[1]);
|
||||
WriteParam(aWriter, aParam.linearAcceleration[2]);
|
||||
WriteParam(aWriter, aParam.isPositionValid);
|
||||
WriteParam(aWriter, aParam.isOrientationValid);
|
||||
}
|
||||
|
||||
static bool Read(const Message* aMsg, PickleIterator* aIter,
|
||||
paramType* aResult) {
|
||||
if (!ReadParam(aMsg, aIter, &(aResult->flags)) ||
|
||||
!ReadParam(aMsg, aIter, &(aResult->orientation[0])) ||
|
||||
!ReadParam(aMsg, aIter, &(aResult->orientation[1])) ||
|
||||
!ReadParam(aMsg, aIter, &(aResult->orientation[2])) ||
|
||||
!ReadParam(aMsg, aIter, &(aResult->orientation[3])) ||
|
||||
!ReadParam(aMsg, aIter, &(aResult->position[0])) ||
|
||||
!ReadParam(aMsg, aIter, &(aResult->position[1])) ||
|
||||
!ReadParam(aMsg, aIter, &(aResult->position[2])) ||
|
||||
!ReadParam(aMsg, aIter, &(aResult->angularVelocity[0])) ||
|
||||
!ReadParam(aMsg, aIter, &(aResult->angularVelocity[1])) ||
|
||||
!ReadParam(aMsg, aIter, &(aResult->angularVelocity[2])) ||
|
||||
!ReadParam(aMsg, aIter, &(aResult->angularAcceleration[0])) ||
|
||||
!ReadParam(aMsg, aIter, &(aResult->angularAcceleration[1])) ||
|
||||
!ReadParam(aMsg, aIter, &(aResult->angularAcceleration[2])) ||
|
||||
!ReadParam(aMsg, aIter, &(aResult->linearVelocity[0])) ||
|
||||
!ReadParam(aMsg, aIter, &(aResult->linearVelocity[1])) ||
|
||||
!ReadParam(aMsg, aIter, &(aResult->linearVelocity[2])) ||
|
||||
!ReadParam(aMsg, aIter, &(aResult->linearAcceleration[0])) ||
|
||||
!ReadParam(aMsg, aIter, &(aResult->linearAcceleration[1])) ||
|
||||
!ReadParam(aMsg, aIter, &(aResult->linearAcceleration[2])) ||
|
||||
!ReadParam(aMsg, aIter, &(aResult->isPositionValid)) ||
|
||||
!ReadParam(aMsg, aIter, &(aResult->isOrientationValid))) {
|
||||
static bool Read(MessageReader* aReader, paramType* aResult) {
|
||||
if (!ReadParam(aReader, &(aResult->flags)) ||
|
||||
!ReadParam(aReader, &(aResult->orientation[0])) ||
|
||||
!ReadParam(aReader, &(aResult->orientation[1])) ||
|
||||
!ReadParam(aReader, &(aResult->orientation[2])) ||
|
||||
!ReadParam(aReader, &(aResult->orientation[3])) ||
|
||||
!ReadParam(aReader, &(aResult->position[0])) ||
|
||||
!ReadParam(aReader, &(aResult->position[1])) ||
|
||||
!ReadParam(aReader, &(aResult->position[2])) ||
|
||||
!ReadParam(aReader, &(aResult->angularVelocity[0])) ||
|
||||
!ReadParam(aReader, &(aResult->angularVelocity[1])) ||
|
||||
!ReadParam(aReader, &(aResult->angularVelocity[2])) ||
|
||||
!ReadParam(aReader, &(aResult->angularAcceleration[0])) ||
|
||||
!ReadParam(aReader, &(aResult->angularAcceleration[1])) ||
|
||||
!ReadParam(aReader, &(aResult->angularAcceleration[2])) ||
|
||||
!ReadParam(aReader, &(aResult->linearVelocity[0])) ||
|
||||
!ReadParam(aReader, &(aResult->linearVelocity[1])) ||
|
||||
!ReadParam(aReader, &(aResult->linearVelocity[2])) ||
|
||||
!ReadParam(aReader, &(aResult->linearAcceleration[0])) ||
|
||||
!ReadParam(aReader, &(aResult->linearAcceleration[1])) ||
|
||||
!ReadParam(aReader, &(aResult->linearAcceleration[2])) ||
|
||||
!ReadParam(aReader, &(aResult->isPositionValid)) ||
|
||||
!ReadParam(aReader, &(aResult->isOrientationValid))) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
@ -106,25 +105,24 @@ template <>
|
||||
struct ParamTraits<mozilla::dom::GamepadTouchState> {
|
||||
typedef mozilla::dom::GamepadTouchState paramType;
|
||||
|
||||
static void Write(Message* aMsg, const paramType& aParam) {
|
||||
WriteParam(aMsg, aParam.touchId);
|
||||
WriteParam(aMsg, aParam.surfaceId);
|
||||
WriteParam(aMsg, aParam.position[0]);
|
||||
WriteParam(aMsg, aParam.position[1]);
|
||||
WriteParam(aMsg, aParam.surfaceDimensions[0]);
|
||||
WriteParam(aMsg, aParam.surfaceDimensions[1]);
|
||||
WriteParam(aMsg, aParam.isSurfaceDimensionsValid);
|
||||
static void Write(MessageWriter* aWriter, const paramType& aParam) {
|
||||
WriteParam(aWriter, aParam.touchId);
|
||||
WriteParam(aWriter, aParam.surfaceId);
|
||||
WriteParam(aWriter, aParam.position[0]);
|
||||
WriteParam(aWriter, aParam.position[1]);
|
||||
WriteParam(aWriter, aParam.surfaceDimensions[0]);
|
||||
WriteParam(aWriter, aParam.surfaceDimensions[1]);
|
||||
WriteParam(aWriter, aParam.isSurfaceDimensionsValid);
|
||||
}
|
||||
|
||||
static bool Read(const Message* aMsg, PickleIterator* aIter,
|
||||
paramType* aResult) {
|
||||
if (!ReadParam(aMsg, aIter, &(aResult->touchId)) ||
|
||||
!ReadParam(aMsg, aIter, &(aResult->surfaceId)) ||
|
||||
!ReadParam(aMsg, aIter, &(aResult->position[0])) ||
|
||||
!ReadParam(aMsg, aIter, &(aResult->position[1])) ||
|
||||
!ReadParam(aMsg, aIter, &(aResult->surfaceDimensions[0])) ||
|
||||
!ReadParam(aMsg, aIter, &(aResult->surfaceDimensions[1])) ||
|
||||
!ReadParam(aMsg, aIter, &(aResult->isSurfaceDimensionsValid))) {
|
||||
static bool Read(MessageReader* aReader, paramType* aResult) {
|
||||
if (!ReadParam(aReader, &(aResult->touchId)) ||
|
||||
!ReadParam(aReader, &(aResult->surfaceId)) ||
|
||||
!ReadParam(aReader, &(aResult->position[0])) ||
|
||||
!ReadParam(aReader, &(aResult->position[1])) ||
|
||||
!ReadParam(aReader, &(aResult->surfaceDimensions[0])) ||
|
||||
!ReadParam(aReader, &(aResult->surfaceDimensions[1])) ||
|
||||
!ReadParam(aReader, &(aResult->isSurfaceDimensionsValid))) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
@ -141,14 +139,13 @@ struct ParamTraits<mozilla::dom::GamepadHandleKind>
|
||||
template <>
|
||||
struct ParamTraits<mozilla::dom::GamepadHandle> {
|
||||
typedef mozilla::dom::GamepadHandle paramType;
|
||||
static void Write(Message* aMsg, const paramType& aParam) {
|
||||
WriteParam(aMsg, aParam.mValue);
|
||||
WriteParam(aMsg, aParam.mKind);
|
||||
static void Write(MessageWriter* aWriter, const paramType& aParam) {
|
||||
WriteParam(aWriter, aParam.mValue);
|
||||
WriteParam(aWriter, aParam.mKind);
|
||||
}
|
||||
static bool Read(const Message* aMsg, PickleIterator* aIter,
|
||||
paramType* aParam) {
|
||||
return ReadParam(aMsg, aIter, &aParam->mValue) &&
|
||||
ReadParam(aMsg, aIter, &aParam->mKind);
|
||||
static bool Read(MessageReader* aReader, paramType* aParam) {
|
||||
return ReadParam(aReader, &aParam->mValue) &&
|
||||
ReadParam(aReader, &aParam->mKind);
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -16,42 +16,42 @@ namespace IPC {
|
||||
template <>
|
||||
struct ParamTraits<nsIDOMGeoPositionCoords*> {
|
||||
// Function to serialize a geoposition
|
||||
static void Write(Message* aMsg, nsIDOMGeoPositionCoords* aParam) {
|
||||
static void Write(MessageWriter* aWriter, nsIDOMGeoPositionCoords* aParam) {
|
||||
bool isNull = !aParam;
|
||||
WriteParam(aMsg, isNull);
|
||||
WriteParam(aWriter, isNull);
|
||||
// If it is a null object, then we are done
|
||||
if (isNull) return;
|
||||
|
||||
double coordData;
|
||||
|
||||
aParam->GetLatitude(&coordData);
|
||||
WriteParam(aMsg, coordData);
|
||||
WriteParam(aWriter, coordData);
|
||||
|
||||
aParam->GetLongitude(&coordData);
|
||||
WriteParam(aMsg, coordData);
|
||||
WriteParam(aWriter, coordData);
|
||||
|
||||
aParam->GetAltitude(&coordData);
|
||||
WriteParam(aMsg, coordData);
|
||||
WriteParam(aWriter, coordData);
|
||||
|
||||
aParam->GetAccuracy(&coordData);
|
||||
WriteParam(aMsg, coordData);
|
||||
WriteParam(aWriter, coordData);
|
||||
|
||||
aParam->GetAltitudeAccuracy(&coordData);
|
||||
WriteParam(aMsg, coordData);
|
||||
WriteParam(aWriter, coordData);
|
||||
|
||||
aParam->GetHeading(&coordData);
|
||||
WriteParam(aMsg, coordData);
|
||||
WriteParam(aWriter, coordData);
|
||||
|
||||
aParam->GetSpeed(&coordData);
|
||||
WriteParam(aMsg, coordData);
|
||||
WriteParam(aWriter, coordData);
|
||||
}
|
||||
|
||||
// Function to de-serialize a geoposition
|
||||
static bool Read(const Message* aMsg, PickleIterator* aIter,
|
||||
static bool Read(MessageReader* aReader,
|
||||
RefPtr<nsIDOMGeoPositionCoords>* aResult) {
|
||||
// Check if it is the null pointer we have transfered
|
||||
bool isNull;
|
||||
if (!ReadParam(aMsg, aIter, &isNull)) return false;
|
||||
if (!ReadParam(aReader, &isNull)) return false;
|
||||
|
||||
if (isNull) {
|
||||
*aResult = nullptr;
|
||||
@ -67,12 +67,10 @@ struct ParamTraits<nsIDOMGeoPositionCoords*> {
|
||||
double speed;
|
||||
|
||||
// It's not important to us where it fails, but rather if it fails
|
||||
if (!(ReadParam(aMsg, aIter, &latitude) &&
|
||||
ReadParam(aMsg, aIter, &longitude) &&
|
||||
ReadParam(aMsg, aIter, &altitude) &&
|
||||
ReadParam(aMsg, aIter, &accuracy) &&
|
||||
ReadParam(aMsg, aIter, &altitudeAccuracy) &&
|
||||
ReadParam(aMsg, aIter, &heading) && ReadParam(aMsg, aIter, &speed)))
|
||||
if (!(ReadParam(aReader, &latitude) && ReadParam(aReader, &longitude) &&
|
||||
ReadParam(aReader, &altitude) && ReadParam(aReader, &accuracy) &&
|
||||
ReadParam(aReader, &altitudeAccuracy) &&
|
||||
ReadParam(aReader, &heading) && ReadParam(aReader, &speed)))
|
||||
return false;
|
||||
|
||||
// We now have all the data
|
||||
@ -91,27 +89,26 @@ struct ParamTraits<nsIDOMGeoPositionCoords*> {
|
||||
template <>
|
||||
struct ParamTraits<nsIDOMGeoPosition*> {
|
||||
// Function to serialize a geoposition
|
||||
static void Write(Message* aMsg, nsIDOMGeoPosition* aParam) {
|
||||
static void Write(MessageWriter* aWriter, nsIDOMGeoPosition* aParam) {
|
||||
bool isNull = !aParam;
|
||||
WriteParam(aMsg, isNull);
|
||||
WriteParam(aWriter, isNull);
|
||||
// If it is a null object, then we are done
|
||||
if (isNull) return;
|
||||
|
||||
EpochTimeStamp timeStamp;
|
||||
aParam->GetTimestamp(&timeStamp);
|
||||
WriteParam(aMsg, timeStamp);
|
||||
WriteParam(aWriter, timeStamp);
|
||||
|
||||
nsCOMPtr<nsIDOMGeoPositionCoords> coords;
|
||||
aParam->GetCoords(getter_AddRefs(coords));
|
||||
WriteParam(aMsg, coords);
|
||||
WriteParam(aWriter, coords);
|
||||
}
|
||||
|
||||
// Function to de-serialize a geoposition
|
||||
static bool Read(const Message* aMsg, PickleIterator* aIter,
|
||||
RefPtr<nsIDOMGeoPosition>* aResult) {
|
||||
static bool Read(MessageReader* aReader, RefPtr<nsIDOMGeoPosition>* aResult) {
|
||||
// Check if it is the null pointer we have transfered
|
||||
bool isNull;
|
||||
if (!ReadParam(aMsg, aIter, &isNull)) return false;
|
||||
if (!ReadParam(aReader, &isNull)) return false;
|
||||
|
||||
if (isNull) {
|
||||
*aResult = nullptr;
|
||||
@ -122,8 +119,7 @@ struct ParamTraits<nsIDOMGeoPosition*> {
|
||||
RefPtr<nsIDOMGeoPositionCoords> coords;
|
||||
|
||||
// It's not important to us where it fails, but rather if it fails
|
||||
if (!ReadParam(aMsg, aIter, &timeStamp) ||
|
||||
!ReadParam(aMsg, aIter, &coords)) {
|
||||
if (!ReadParam(aReader, &timeStamp) || !ReadParam(aReader, &coords)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -28,13 +28,12 @@ template <>
|
||||
struct ParamTraits<mozilla::dom::indexedDB::Key> {
|
||||
typedef mozilla::dom::indexedDB::Key paramType;
|
||||
|
||||
static void Write(Message* aMsg, const paramType& aParam) {
|
||||
WriteParam(aMsg, aParam.mBuffer);
|
||||
static void Write(MessageWriter* aWriter, const paramType& aParam) {
|
||||
WriteParam(aWriter, aParam.mBuffer);
|
||||
}
|
||||
|
||||
static bool Read(const Message* aMsg, PickleIterator* aIter,
|
||||
paramType* aResult) {
|
||||
return ReadParam(aMsg, aIter, &aResult->mBuffer);
|
||||
static bool Read(MessageReader* aReader, paramType* aResult) {
|
||||
return ReadParam(aReader, &aResult->mBuffer);
|
||||
}
|
||||
|
||||
static void Log(const paramType& aParam, std::wstring* aLog) {
|
||||
@ -53,15 +52,14 @@ template <>
|
||||
struct ParamTraits<mozilla::dom::indexedDB::KeyPath> {
|
||||
typedef mozilla::dom::indexedDB::KeyPath paramType;
|
||||
|
||||
static void Write(Message* aMsg, const paramType& aParam) {
|
||||
WriteParam(aMsg, aParam.mType);
|
||||
WriteParam(aMsg, aParam.mStrings);
|
||||
static void Write(MessageWriter* aWriter, const paramType& aParam) {
|
||||
WriteParam(aWriter, aParam.mType);
|
||||
WriteParam(aWriter, aParam.mStrings);
|
||||
}
|
||||
|
||||
static bool Read(const Message* aMsg, PickleIterator* aIter,
|
||||
paramType* aResult) {
|
||||
return ReadParam(aMsg, aIter, &aResult->mType) &&
|
||||
ReadParam(aMsg, aIter, &aResult->mStrings);
|
||||
static bool Read(MessageReader* aReader, paramType* aResult) {
|
||||
return ReadParam(aReader, &aResult->mType) &&
|
||||
ReadParam(aReader, &aResult->mStrings);
|
||||
}
|
||||
|
||||
static void Log(const paramType& aParam, std::wstring* aLog) {
|
||||
|
@ -14,23 +14,22 @@ namespace IPC {
|
||||
using namespace mozilla::ipc;
|
||||
|
||||
void ParamTraits<nsIContentSecurityPolicy*>::Write(
|
||||
Message* aMsg, nsIContentSecurityPolicy* aParam) {
|
||||
MessageWriter* aWriter, nsIContentSecurityPolicy* aParam) {
|
||||
bool isNull = !aParam;
|
||||
WriteParam(aMsg, isNull);
|
||||
WriteParam(aWriter, isNull);
|
||||
if (isNull) {
|
||||
return;
|
||||
}
|
||||
|
||||
CSPInfo csp;
|
||||
mozilla::Unused << NS_WARN_IF(NS_FAILED(CSPToCSPInfo(aParam, &csp)));
|
||||
IPDLParamTraits<CSPInfo>::Write(aMsg, nullptr, csp);
|
||||
IPDLParamTraits<CSPInfo>::Write(aWriter, nullptr, csp);
|
||||
}
|
||||
|
||||
bool ParamTraits<nsIContentSecurityPolicy*>::Read(
|
||||
const Message* aMsg, PickleIterator* aIter,
|
||||
RefPtr<nsIContentSecurityPolicy>* aResult) {
|
||||
MessageReader* aReader, RefPtr<nsIContentSecurityPolicy>* aResult) {
|
||||
bool isNull;
|
||||
if (!ReadParam(aMsg, aIter, &isNull)) {
|
||||
if (!ReadParam(aReader, &isNull)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -40,7 +39,7 @@ bool ParamTraits<nsIContentSecurityPolicy*>::Read(
|
||||
}
|
||||
|
||||
CSPInfo csp;
|
||||
if (!IPDLParamTraits<CSPInfo>::Read(aMsg, aIter, nullptr, &csp)) {
|
||||
if (!IPDLParamTraits<CSPInfo>::Read(aReader, nullptr, &csp)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -15,8 +15,8 @@ namespace IPC {
|
||||
|
||||
template <>
|
||||
struct ParamTraits<nsIContentSecurityPolicy*> {
|
||||
static void Write(Message* aMsg, nsIContentSecurityPolicy* aParam);
|
||||
static bool Read(const Message* aMsg, PickleIterator* aIter,
|
||||
static void Write(MessageWriter* aWriter, nsIContentSecurityPolicy* aParam);
|
||||
static bool Read(MessageReader* aReader,
|
||||
RefPtr<nsIContentSecurityPolicy>* aResult);
|
||||
};
|
||||
|
||||
|
@ -11,18 +11,18 @@
|
||||
|
||||
namespace mozilla::ipc {
|
||||
|
||||
void IPDLParamTraits<nsDocShellLoadState*>::Write(IPC::Message* aMsg,
|
||||
void IPDLParamTraits<nsDocShellLoadState*>::Write(IPC::MessageWriter* aWriter,
|
||||
IProtocol* aActor,
|
||||
nsDocShellLoadState* aParam) {
|
||||
MOZ_RELEASE_ASSERT(aParam);
|
||||
WriteIPDLParam(aMsg, aActor, aParam->Serialize());
|
||||
WriteIPDLParam(aWriter, aActor, aParam->Serialize());
|
||||
}
|
||||
|
||||
bool IPDLParamTraits<nsDocShellLoadState*>::Read(
|
||||
const IPC::Message* aMsg, PickleIterator* aIter, IProtocol* aActor,
|
||||
IPC::MessageReader* aReader, IProtocol* aActor,
|
||||
RefPtr<nsDocShellLoadState>* aResult) {
|
||||
dom::DocShellLoadStateInit loadState;
|
||||
if (!ReadIPDLParam(aMsg, aIter, aActor, &loadState)) {
|
||||
if (!ReadIPDLParam(aReader, aActor, &loadState)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -18,10 +18,10 @@ namespace ipc {
|
||||
|
||||
template <>
|
||||
struct IPDLParamTraits<nsDocShellLoadState*> {
|
||||
static void Write(IPC::Message* aMsg, IProtocol* aActor,
|
||||
static void Write(IPC::MessageWriter* aWriter, IProtocol* aActor,
|
||||
nsDocShellLoadState* aParam);
|
||||
static bool Read(const IPC::Message* aMsg, PickleIterator* aIter,
|
||||
IProtocol* aActor, RefPtr<nsDocShellLoadState>* aResult);
|
||||
static bool Read(IPC::MessageReader* aReader, IProtocol* aActor,
|
||||
RefPtr<nsDocShellLoadState>* aResult);
|
||||
};
|
||||
|
||||
} // namespace ipc
|
||||
|
@ -52,13 +52,12 @@ template <typename T>
|
||||
struct ParamTraits<mozilla::dom::IdType<T>> {
|
||||
using paramType = mozilla::dom::IdType<T>;
|
||||
|
||||
static void Write(Message* aMsg, const paramType& aParam) {
|
||||
WriteParam(aMsg, aParam.mId);
|
||||
static void Write(MessageWriter* aWriter, const paramType& aParam) {
|
||||
WriteParam(aWriter, aParam.mId);
|
||||
}
|
||||
|
||||
static bool Read(const Message* aMsg, PickleIterator* aIter,
|
||||
paramType* aResult) {
|
||||
return ReadParam(aMsg, aIter, &aResult->mId);
|
||||
static bool Read(MessageReader* aReader, paramType* aResult) {
|
||||
return ReadParam(aReader, &aResult->mId);
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -12,7 +12,7 @@
|
||||
|
||||
namespace mozilla::ipc {
|
||||
|
||||
void IPDLParamTraits<nsIPrincipal*>::Write(IPC::Message* aMsg,
|
||||
void IPDLParamTraits<nsIPrincipal*>::Write(IPC::MessageWriter* aWriter,
|
||||
IProtocol* aActor,
|
||||
nsIPrincipal* aParam) {
|
||||
MOZ_DIAGNOSTIC_ASSERT(NS_IsMainThread());
|
||||
@ -24,15 +24,14 @@ void IPDLParamTraits<nsIPrincipal*>::Write(IPC::Message* aMsg,
|
||||
MOZ_RELEASE_ASSERT(NS_SUCCEEDED(rv));
|
||||
}
|
||||
|
||||
WriteIPDLParam(aMsg, aActor, info);
|
||||
WriteIPDLParam(aWriter, aActor, info);
|
||||
}
|
||||
|
||||
bool IPDLParamTraits<nsIPrincipal*>::Read(const IPC::Message* aMsg,
|
||||
PickleIterator* aIter,
|
||||
bool IPDLParamTraits<nsIPrincipal*>::Read(IPC::MessageReader* aReader,
|
||||
IProtocol* aActor,
|
||||
RefPtr<nsIPrincipal>* aResult) {
|
||||
Maybe<PrincipalInfo> info;
|
||||
if (!ReadIPDLParam(aMsg, aIter, aActor, &info)) {
|
||||
if (!ReadIPDLParam(aReader, aActor, &info)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -40,16 +40,16 @@ namespace ipc {
|
||||
|
||||
template <>
|
||||
struct IPDLParamTraits<nsIPrincipal*> {
|
||||
static void Write(IPC::Message* aMsg, IProtocol* aActor,
|
||||
static void Write(IPC::MessageWriter* aWriter, IProtocol* aActor,
|
||||
nsIPrincipal* aParam);
|
||||
static bool Read(const IPC::Message* aMsg, PickleIterator* aIter,
|
||||
IProtocol* aActor, RefPtr<nsIPrincipal>* aResult);
|
||||
static bool Read(IPC::MessageReader* aReader, IProtocol* aActor,
|
||||
RefPtr<nsIPrincipal>* aResult);
|
||||
|
||||
// Overload to support deserializing nsCOMPtr<nsIPrincipal> directly.
|
||||
static bool Read(const IPC::Message* aMsg, PickleIterator* aIter,
|
||||
IProtocol* aActor, nsCOMPtr<nsIPrincipal>* aResult) {
|
||||
static bool Read(IPC::MessageReader* aReader, IProtocol* aActor,
|
||||
nsCOMPtr<nsIPrincipal>* aResult) {
|
||||
RefPtr<nsIPrincipal> result;
|
||||
if (!Read(aMsg, aIter, aActor, &result)) {
|
||||
if (!Read(aReader, aActor, &result)) {
|
||||
return false;
|
||||
}
|
||||
*aResult = std::move(result);
|
||||
@ -60,13 +60,13 @@ struct IPDLParamTraits<nsIPrincipal*> {
|
||||
template <>
|
||||
struct IPDLParamTraits<IPC::Principal> {
|
||||
typedef IPC::Principal paramType;
|
||||
static void Write(IPC::Message* aMsg, IProtocol* aActor,
|
||||
static void Write(IPC::MessageWriter* aWriter, IProtocol* aActor,
|
||||
const paramType& aParam) {
|
||||
WriteIPDLParam(aMsg, aActor, aParam.mPrincipal);
|
||||
WriteIPDLParam(aWriter, aActor, aParam.mPrincipal);
|
||||
}
|
||||
static bool Read(const IPC::Message* aMsg, PickleIterator* aIter,
|
||||
IProtocol* aActor, paramType* aResult) {
|
||||
return ReadIPDLParam(aMsg, aIter, aActor, &aResult->mPrincipal);
|
||||
static bool Read(IPC::MessageReader* aReader, IProtocol* aActor,
|
||||
paramType* aResult) {
|
||||
return ReadIPDLParam(aReader, aActor, &aResult->mPrincipal);
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -20,7 +20,8 @@ using namespace mozilla::dom;
|
||||
|
||||
namespace mozilla::ipc {
|
||||
|
||||
void IPDLParamTraits<nsIVariant*>::Write(Message* aMsg, IProtocol* aActor,
|
||||
void IPDLParamTraits<nsIVariant*>::Write(MessageWriter* aWriter,
|
||||
IProtocol* aActor,
|
||||
nsIVariant* aParam) {
|
||||
IDPLVariant variant;
|
||||
|
||||
@ -130,15 +131,14 @@ void IPDLParamTraits<nsIVariant*>::Write(Message* aMsg, IProtocol* aActor,
|
||||
MOZ_CRASH("Non handled variant type, patch welcome");
|
||||
break;
|
||||
}
|
||||
WriteIPDLParam(aMsg, aActor, variant);
|
||||
WriteIPDLParam(aWriter, aActor, variant);
|
||||
}
|
||||
|
||||
bool IPDLParamTraits<nsIVariant*>::Read(const Message* aMsg,
|
||||
PickleIterator* aIter,
|
||||
bool IPDLParamTraits<nsIVariant*>::Read(MessageReader* aReader,
|
||||
IProtocol* aActor,
|
||||
RefPtr<nsIVariant>* aResult) {
|
||||
IDPLVariant value;
|
||||
if (!ReadIPDLParam(aMsg, aIter, aActor, &value)) {
|
||||
if (!ReadIPDLParam(aReader, aActor, &value)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -219,7 +219,8 @@ bool IPDLParamTraits<nsIVariant*>::Read(const Message* aMsg,
|
||||
return true;
|
||||
}
|
||||
|
||||
void IPDLParamTraits<nsIPropertyBag2*>::Write(Message* aMsg, IProtocol* aActor,
|
||||
void IPDLParamTraits<nsIPropertyBag2*>::Write(MessageWriter* aWriter,
|
||||
IProtocol* aActor,
|
||||
nsIPropertyBag2* aParam) {
|
||||
// We send a nsIPropertyBag as an array of IPDLProperty
|
||||
nsTArray<IPDLProperty> bag;
|
||||
@ -235,15 +236,14 @@ void IPDLParamTraits<nsIPropertyBag2*>::Write(Message* aMsg, IProtocol* aActor,
|
||||
bag.AppendElement(IPDLProperty{name, value});
|
||||
}
|
||||
}
|
||||
WriteIPDLParam(aMsg, aActor, bag);
|
||||
WriteIPDLParam(aWriter, aActor, bag);
|
||||
}
|
||||
|
||||
bool IPDLParamTraits<nsIPropertyBag2*>::Read(const Message* aMsg,
|
||||
PickleIterator* aIter,
|
||||
bool IPDLParamTraits<nsIPropertyBag2*>::Read(MessageReader* aReader,
|
||||
IProtocol* aActor,
|
||||
RefPtr<nsIPropertyBag2>* aResult) {
|
||||
nsTArray<IPDLProperty> bag;
|
||||
if (!ReadIPDLParam(aMsg, aIter, aActor, &bag)) {
|
||||
if (!ReadIPDLParam(aReader, aActor, &bag)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -20,17 +20,18 @@ namespace ipc {
|
||||
*/
|
||||
template <>
|
||||
struct IPDLParamTraits<nsIVariant*> {
|
||||
static void Write(IPC::Message* aMsg, IProtocol* aActor, nsIVariant* aParam);
|
||||
static bool Read(const IPC::Message* aMsg, PickleIterator* aIter,
|
||||
IProtocol* aActor, RefPtr<nsIVariant>* aResult);
|
||||
static void Write(IPC::MessageWriter* aWriter, IProtocol* aActor,
|
||||
nsIVariant* aParam);
|
||||
static bool Read(IPC::MessageReader* aReader, IProtocol* aActor,
|
||||
RefPtr<nsIVariant>* aResult);
|
||||
};
|
||||
|
||||
template <>
|
||||
struct IPDLParamTraits<nsIPropertyBag2*> {
|
||||
static void Write(IPC::Message* aMsg, IProtocol* aActor,
|
||||
static void Write(IPC::MessageWriter* aWriter, IProtocol* aActor,
|
||||
nsIPropertyBag2* aParam);
|
||||
static bool Read(const IPC::Message* aMsg, PickleIterator* aIter,
|
||||
IProtocol* aActor, RefPtr<nsIPropertyBag2>* aResult);
|
||||
static bool Read(IPC::MessageReader* aReader, IProtocol* aActor,
|
||||
RefPtr<nsIPropertyBag2>* aResult);
|
||||
};
|
||||
|
||||
} // namespace ipc
|
||||
|
@ -12,10 +12,10 @@
|
||||
|
||||
namespace IPC {
|
||||
|
||||
void ParamTraits<nsIReferrerInfo*>::Write(Message* aMsg,
|
||||
void ParamTraits<nsIReferrerInfo*>::Write(MessageWriter* aWriter,
|
||||
nsIReferrerInfo* aParam) {
|
||||
bool isNull = !aParam;
|
||||
WriteParam(aMsg, isNull);
|
||||
WriteParam(aWriter, isNull);
|
||||
if (isNull) {
|
||||
return;
|
||||
}
|
||||
@ -25,14 +25,13 @@ void ParamTraits<nsIReferrerInfo*>::Write(Message* aMsg,
|
||||
MOZ_CRASH("Unable to serialize referrer info.");
|
||||
return;
|
||||
}
|
||||
WriteParam(aMsg, infoString);
|
||||
WriteParam(aWriter, infoString);
|
||||
}
|
||||
|
||||
bool ParamTraits<nsIReferrerInfo*>::Read(const Message* aMsg,
|
||||
PickleIterator* aIter,
|
||||
bool ParamTraits<nsIReferrerInfo*>::Read(MessageReader* aReader,
|
||||
RefPtr<nsIReferrerInfo>* aResult) {
|
||||
bool isNull;
|
||||
if (!ReadParam(aMsg, aIter, &isNull)) {
|
||||
if (!ReadParam(aReader, &isNull)) {
|
||||
return false;
|
||||
}
|
||||
if (isNull) {
|
||||
@ -40,7 +39,7 @@ bool ParamTraits<nsIReferrerInfo*>::Read(const Message* aMsg,
|
||||
return true;
|
||||
}
|
||||
nsAutoCString infoString;
|
||||
if (!ReadParam(aMsg, aIter, &infoString)) {
|
||||
if (!ReadParam(aReader, &infoString)) {
|
||||
return false;
|
||||
}
|
||||
nsCOMPtr<nsISupports> iSupports;
|
||||
|
@ -15,9 +15,8 @@ namespace IPC {
|
||||
|
||||
template <>
|
||||
struct ParamTraits<nsIReferrerInfo*> {
|
||||
static void Write(Message* aMsg, nsIReferrerInfo* aParam);
|
||||
static bool Read(const Message* aMsg, PickleIterator* aIter,
|
||||
RefPtr<nsIReferrerInfo>* aResult);
|
||||
static void Write(MessageWriter* aWriter, nsIReferrerInfo* aParam);
|
||||
static bool Read(MessageReader* aReader, RefPtr<nsIReferrerInfo>* aResult);
|
||||
};
|
||||
|
||||
} // namespace IPC
|
||||
|
@ -379,15 +379,14 @@ void StructuredCloneData::StealFromClonedMessageDataForBackgroundChild(
|
||||
UnpackClonedMessageData<StealMemory, Child>(aClonedData, *this);
|
||||
}
|
||||
|
||||
void StructuredCloneData::WriteIPCParams(IPC::Message* aMsg) const {
|
||||
WriteParam(aMsg, Data());
|
||||
void StructuredCloneData::WriteIPCParams(IPC::MessageWriter* aWriter) const {
|
||||
WriteParam(aWriter, Data());
|
||||
}
|
||||
|
||||
bool StructuredCloneData::ReadIPCParams(const IPC::Message* aMsg,
|
||||
PickleIterator* aIter) {
|
||||
bool StructuredCloneData::ReadIPCParams(IPC::MessageReader* aReader) {
|
||||
MOZ_ASSERT(!mInitialized);
|
||||
JSStructuredCloneData data(JS::StructuredCloneScope::DifferentProcess);
|
||||
if (!ReadParam(aMsg, aIter, &data)) {
|
||||
if (!ReadParam(aReader, &data)) {
|
||||
return false;
|
||||
}
|
||||
mSharedData = new SharedJSAllocatedData(std::move(data));
|
||||
|
@ -280,8 +280,8 @@ class StructuredCloneData : public StructuredCloneHolder {
|
||||
}
|
||||
|
||||
// For IPC serialization
|
||||
void WriteIPCParams(IPC::Message* aMessage) const;
|
||||
bool ReadIPCParams(const IPC::Message* aMessage, PickleIterator* aIter);
|
||||
void WriteIPCParams(IPC::MessageWriter* aWriter) const;
|
||||
bool ReadIPCParams(IPC::MessageReader* aReader);
|
||||
|
||||
protected:
|
||||
already_AddRefed<SharedJSAllocatedData> TakeSharedData();
|
||||
|
@ -12,11 +12,10 @@
|
||||
|
||||
namespace mozilla::dom {
|
||||
|
||||
bool ReadRemoteEvent(const IPC::Message* aMsg, PickleIterator* aIter,
|
||||
RemoteDOMEvent* aResult) {
|
||||
bool ReadRemoteEvent(IPC::MessageReader* aReader, RemoteDOMEvent* aResult) {
|
||||
aResult->mEvent = nullptr;
|
||||
nsString type;
|
||||
NS_ENSURE_TRUE(ReadParam(aMsg, aIter, &type), false);
|
||||
NS_ENSURE_TRUE(ReadParam(aReader, &type), false);
|
||||
|
||||
aResult->mEvent =
|
||||
EventDispatcher::CreateEvent(nullptr, nullptr, nullptr, type);
|
||||
@ -24,7 +23,7 @@ bool ReadRemoteEvent(const IPC::Message* aMsg, PickleIterator* aIter,
|
||||
// In a controlled environment, we should always have a valid event.
|
||||
bool ret = false;
|
||||
if (aResult->mEvent) {
|
||||
ret = aResult->mEvent->Deserialize(aMsg, aIter);
|
||||
ret = aResult->mEvent->Deserialize(aReader);
|
||||
}
|
||||
MOZ_ASSERT_UNLESS_FUZZING(ret);
|
||||
|
||||
|
@ -20,7 +20,7 @@
|
||||
|
||||
namespace mozilla::dom {
|
||||
|
||||
bool ReadRemoteEvent(const IPC::Message* aMsg, PickleIterator* aIter,
|
||||
bool ReadRemoteEvent(IPC::MessageReader* aReader,
|
||||
mozilla::dom::RemoteDOMEvent* aResult);
|
||||
|
||||
} // namespace mozilla::dom
|
||||
@ -31,13 +31,12 @@ template <>
|
||||
struct ParamTraits<mozilla::dom::RemoteDOMEvent> {
|
||||
typedef mozilla::dom::RemoteDOMEvent paramType;
|
||||
|
||||
static void Write(Message* aMsg, const paramType& aParam) {
|
||||
aParam.mEvent->Serialize(aMsg, true);
|
||||
static void Write(MessageWriter* aWriter, const paramType& aParam) {
|
||||
aParam.mEvent->Serialize(aWriter, true);
|
||||
}
|
||||
|
||||
static bool Read(const Message* aMsg, PickleIterator* aIter,
|
||||
paramType* aResult) {
|
||||
return mozilla::dom::ReadRemoteEvent(aMsg, aIter, aResult);
|
||||
static bool Read(MessageReader* aReader, paramType* aResult) {
|
||||
return mozilla::dom::ReadRemoteEvent(aReader, aResult);
|
||||
}
|
||||
|
||||
static void Log(const paramType& aParam, std::wstring* aLog) {}
|
||||
@ -65,19 +64,18 @@ template <>
|
||||
struct ParamTraits<mozilla::dom::EffectsInfo> {
|
||||
typedef mozilla::dom::EffectsInfo paramType;
|
||||
|
||||
static void Write(Message* aMsg, const paramType& aParam) {
|
||||
WriteParam(aMsg, aParam.mVisibleRect);
|
||||
WriteParam(aMsg, aParam.mScaleX);
|
||||
WriteParam(aMsg, aParam.mScaleY);
|
||||
WriteParam(aMsg, aParam.mTransformToAncestorScale);
|
||||
static void Write(MessageWriter* aWriter, const paramType& aParam) {
|
||||
WriteParam(aWriter, aParam.mVisibleRect);
|
||||
WriteParam(aWriter, aParam.mScaleX);
|
||||
WriteParam(aWriter, aParam.mScaleY);
|
||||
WriteParam(aWriter, aParam.mTransformToAncestorScale);
|
||||
}
|
||||
|
||||
static bool Read(const Message* aMsg, PickleIterator* aIter,
|
||||
paramType* aResult) {
|
||||
return ReadParam(aMsg, aIter, &aResult->mVisibleRect) &&
|
||||
ReadParam(aMsg, aIter, &aResult->mScaleX) &&
|
||||
ReadParam(aMsg, aIter, &aResult->mScaleY) &&
|
||||
ReadParam(aMsg, aIter, &aResult->mTransformToAncestorScale);
|
||||
static bool Read(MessageReader* aReader, paramType* aResult) {
|
||||
return ReadParam(aReader, &aResult->mVisibleRect) &&
|
||||
ReadParam(aReader, &aResult->mScaleX) &&
|
||||
ReadParam(aReader, &aResult->mScaleY) &&
|
||||
ReadParam(aReader, &aResult->mTransformToAncestorScale);
|
||||
}
|
||||
};
|
||||
|
||||
@ -96,25 +94,24 @@ template <>
|
||||
struct ParamTraits<mozilla::ScrollAxis> {
|
||||
typedef mozilla::ScrollAxis paramType;
|
||||
|
||||
static void Write(Message* aMsg, const paramType& aParam) {
|
||||
WriteParam(aMsg, aParam.mWhereToScroll);
|
||||
WriteParam(aMsg, aParam.mWhenToScroll);
|
||||
WriteParam(aMsg, aParam.mOnlyIfPerceivedScrollableDirection);
|
||||
static void Write(MessageWriter* aWriter, const paramType& aParam) {
|
||||
WriteParam(aWriter, aParam.mWhereToScroll);
|
||||
WriteParam(aWriter, aParam.mWhenToScroll);
|
||||
WriteParam(aWriter, aParam.mOnlyIfPerceivedScrollableDirection);
|
||||
}
|
||||
|
||||
static bool Read(const Message* aMsg, PickleIterator* aIter,
|
||||
paramType* aResult) {
|
||||
if (!ReadParam(aMsg, aIter, &aResult->mWhereToScroll)) {
|
||||
static bool Read(MessageReader* aReader, paramType* aResult) {
|
||||
if (!ReadParam(aReader, &aResult->mWhereToScroll)) {
|
||||
return false;
|
||||
}
|
||||
if (!ReadParam(aMsg, aIter, &aResult->mWhenToScroll)) {
|
||||
if (!ReadParam(aReader, &aResult->mWhenToScroll)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// We can't set mOnlyIfPerceivedScrollableDirection directly since it's
|
||||
// a bitfield.
|
||||
bool value;
|
||||
if (!ReadParam(aMsg, aIter, &value)) {
|
||||
if (!ReadParam(aReader, &value)) {
|
||||
return false;
|
||||
}
|
||||
aResult->mOnlyIfPerceivedScrollableDirection = value;
|
||||
|
@ -42,19 +42,18 @@ template <>
|
||||
struct ParamTraits<mozilla::dom::LSValue> {
|
||||
typedef mozilla::dom::LSValue paramType;
|
||||
|
||||
static void Write(Message* aMsg, const paramType& aParam) {
|
||||
WriteParam(aMsg, aParam.mBuffer);
|
||||
WriteParam(aMsg, aParam.mUTF16Length);
|
||||
WriteParam(aMsg, aParam.mConversionType);
|
||||
WriteParam(aMsg, aParam.mCompressionType);
|
||||
static void Write(MessageWriter* aWriter, const paramType& aParam) {
|
||||
WriteParam(aWriter, aParam.mBuffer);
|
||||
WriteParam(aWriter, aParam.mUTF16Length);
|
||||
WriteParam(aWriter, aParam.mConversionType);
|
||||
WriteParam(aWriter, aParam.mCompressionType);
|
||||
}
|
||||
|
||||
static bool Read(const Message* aMsg, PickleIterator* aIter,
|
||||
paramType* aResult) {
|
||||
return ReadParam(aMsg, aIter, &aResult->mBuffer) &&
|
||||
ReadParam(aMsg, aIter, &aResult->mUTF16Length) &&
|
||||
ReadParam(aMsg, aIter, &aResult->mConversionType) &&
|
||||
ReadParam(aMsg, aIter, &aResult->mCompressionType);
|
||||
static bool Read(MessageReader* aReader, paramType* aResult) {
|
||||
return ReadParam(aReader, &aResult->mBuffer) &&
|
||||
ReadParam(aReader, &aResult->mUTF16Length) &&
|
||||
ReadParam(aReader, &aResult->mConversionType) &&
|
||||
ReadParam(aReader, &aResult->mCompressionType);
|
||||
}
|
||||
|
||||
static void Log(const paramType& aParam, std::wstring* aLog) {
|
||||
|
@ -65,25 +65,24 @@ template <>
|
||||
struct ParamTraits<GMPSimulcastStream> {
|
||||
typedef GMPSimulcastStream paramType;
|
||||
|
||||
static void Write(Message* aMsg, const paramType& aParam) {
|
||||
WriteParam(aMsg, aParam.mWidth);
|
||||
WriteParam(aMsg, aParam.mHeight);
|
||||
WriteParam(aMsg, aParam.mNumberOfTemporalLayers);
|
||||
WriteParam(aMsg, aParam.mMaxBitrate);
|
||||
WriteParam(aMsg, aParam.mTargetBitrate);
|
||||
WriteParam(aMsg, aParam.mMinBitrate);
|
||||
WriteParam(aMsg, aParam.mQPMax);
|
||||
static void Write(MessageWriter* aWriter, const paramType& aParam) {
|
||||
WriteParam(aWriter, aParam.mWidth);
|
||||
WriteParam(aWriter, aParam.mHeight);
|
||||
WriteParam(aWriter, aParam.mNumberOfTemporalLayers);
|
||||
WriteParam(aWriter, aParam.mMaxBitrate);
|
||||
WriteParam(aWriter, aParam.mTargetBitrate);
|
||||
WriteParam(aWriter, aParam.mMinBitrate);
|
||||
WriteParam(aWriter, aParam.mQPMax);
|
||||
}
|
||||
|
||||
static bool Read(const Message* aMsg, PickleIterator* aIter,
|
||||
paramType* aResult) {
|
||||
if (ReadParam(aMsg, aIter, &(aResult->mWidth)) &&
|
||||
ReadParam(aMsg, aIter, &(aResult->mHeight)) &&
|
||||
ReadParam(aMsg, aIter, &(aResult->mNumberOfTemporalLayers)) &&
|
||||
ReadParam(aMsg, aIter, &(aResult->mMaxBitrate)) &&
|
||||
ReadParam(aMsg, aIter, &(aResult->mTargetBitrate)) &&
|
||||
ReadParam(aMsg, aIter, &(aResult->mMinBitrate)) &&
|
||||
ReadParam(aMsg, aIter, &(aResult->mQPMax))) {
|
||||
static bool Read(MessageReader* aReader, paramType* aResult) {
|
||||
if (ReadParam(aReader, &(aResult->mWidth)) &&
|
||||
ReadParam(aReader, &(aResult->mHeight)) &&
|
||||
ReadParam(aReader, &(aResult->mNumberOfTemporalLayers)) &&
|
||||
ReadParam(aReader, &(aResult->mMaxBitrate)) &&
|
||||
ReadParam(aReader, &(aResult->mTargetBitrate)) &&
|
||||
ReadParam(aReader, &(aResult->mMinBitrate)) &&
|
||||
ReadParam(aReader, &(aResult->mQPMax))) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@ -101,41 +100,40 @@ template <>
|
||||
struct ParamTraits<GMPVideoCodec> {
|
||||
typedef GMPVideoCodec paramType;
|
||||
|
||||
static void Write(Message* aMsg, const paramType& aParam) {
|
||||
WriteParam(aMsg, aParam.mGMPApiVersion);
|
||||
WriteParam(aMsg, aParam.mCodecType);
|
||||
WriteParam(aMsg, static_cast<const nsCString&>(
|
||||
nsDependentCString(aParam.mPLName)));
|
||||
WriteParam(aMsg, aParam.mPLType);
|
||||
WriteParam(aMsg, aParam.mWidth);
|
||||
WriteParam(aMsg, aParam.mHeight);
|
||||
WriteParam(aMsg, aParam.mStartBitrate);
|
||||
WriteParam(aMsg, aParam.mMaxBitrate);
|
||||
WriteParam(aMsg, aParam.mMinBitrate);
|
||||
WriteParam(aMsg, aParam.mMaxFramerate);
|
||||
WriteParam(aMsg, aParam.mFrameDroppingOn);
|
||||
WriteParam(aMsg, aParam.mKeyFrameInterval);
|
||||
WriteParam(aMsg, aParam.mQPMax);
|
||||
WriteParam(aMsg, aParam.mNumberOfSimulcastStreams);
|
||||
static void Write(MessageWriter* aWriter, const paramType& aParam) {
|
||||
WriteParam(aWriter, aParam.mGMPApiVersion);
|
||||
WriteParam(aWriter, aParam.mCodecType);
|
||||
WriteParam(aWriter, static_cast<const nsCString&>(
|
||||
nsDependentCString(aParam.mPLName)));
|
||||
WriteParam(aWriter, aParam.mPLType);
|
||||
WriteParam(aWriter, aParam.mWidth);
|
||||
WriteParam(aWriter, aParam.mHeight);
|
||||
WriteParam(aWriter, aParam.mStartBitrate);
|
||||
WriteParam(aWriter, aParam.mMaxBitrate);
|
||||
WriteParam(aWriter, aParam.mMinBitrate);
|
||||
WriteParam(aWriter, aParam.mMaxFramerate);
|
||||
WriteParam(aWriter, aParam.mFrameDroppingOn);
|
||||
WriteParam(aWriter, aParam.mKeyFrameInterval);
|
||||
WriteParam(aWriter, aParam.mQPMax);
|
||||
WriteParam(aWriter, aParam.mNumberOfSimulcastStreams);
|
||||
for (uint32_t i = 0; i < aParam.mNumberOfSimulcastStreams; i++) {
|
||||
WriteParam(aMsg, aParam.mSimulcastStream[i]);
|
||||
WriteParam(aWriter, aParam.mSimulcastStream[i]);
|
||||
}
|
||||
WriteParam(aMsg, aParam.mMode);
|
||||
WriteParam(aWriter, aParam.mMode);
|
||||
}
|
||||
|
||||
static bool Read(const Message* aMsg, PickleIterator* aIter,
|
||||
paramType* aResult) {
|
||||
static bool Read(MessageReader* aReader, paramType* aResult) {
|
||||
// NOTE: make sure this matches any versions supported
|
||||
if (!ReadParam(aMsg, aIter, &(aResult->mGMPApiVersion)) ||
|
||||
if (!ReadParam(aReader, &(aResult->mGMPApiVersion)) ||
|
||||
aResult->mGMPApiVersion != kGMPVersion33) {
|
||||
return false;
|
||||
}
|
||||
if (!ReadParam(aMsg, aIter, &(aResult->mCodecType))) {
|
||||
if (!ReadParam(aReader, &(aResult->mCodecType))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
nsAutoCString plName;
|
||||
if (!ReadParam(aMsg, aIter, &plName) ||
|
||||
if (!ReadParam(aReader, &plName) ||
|
||||
plName.Length() > kGMPPayloadNameSize - 1) {
|
||||
return false;
|
||||
}
|
||||
@ -143,20 +141,20 @@ struct ParamTraits<GMPVideoCodec> {
|
||||
memset(aResult->mPLName + plName.Length(), 0,
|
||||
kGMPPayloadNameSize - plName.Length());
|
||||
|
||||
if (!ReadParam(aMsg, aIter, &(aResult->mPLType)) ||
|
||||
!ReadParam(aMsg, aIter, &(aResult->mWidth)) ||
|
||||
!ReadParam(aMsg, aIter, &(aResult->mHeight)) ||
|
||||
!ReadParam(aMsg, aIter, &(aResult->mStartBitrate)) ||
|
||||
!ReadParam(aMsg, aIter, &(aResult->mMaxBitrate)) ||
|
||||
!ReadParam(aMsg, aIter, &(aResult->mMinBitrate)) ||
|
||||
!ReadParam(aMsg, aIter, &(aResult->mMaxFramerate)) ||
|
||||
!ReadParam(aMsg, aIter, &(aResult->mFrameDroppingOn)) ||
|
||||
!ReadParam(aMsg, aIter, &(aResult->mKeyFrameInterval))) {
|
||||
if (!ReadParam(aReader, &(aResult->mPLType)) ||
|
||||
!ReadParam(aReader, &(aResult->mWidth)) ||
|
||||
!ReadParam(aReader, &(aResult->mHeight)) ||
|
||||
!ReadParam(aReader, &(aResult->mStartBitrate)) ||
|
||||
!ReadParam(aReader, &(aResult->mMaxBitrate)) ||
|
||||
!ReadParam(aReader, &(aResult->mMinBitrate)) ||
|
||||
!ReadParam(aReader, &(aResult->mMaxFramerate)) ||
|
||||
!ReadParam(aReader, &(aResult->mFrameDroppingOn)) ||
|
||||
!ReadParam(aReader, &(aResult->mKeyFrameInterval))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!ReadParam(aMsg, aIter, &(aResult->mQPMax)) ||
|
||||
!ReadParam(aMsg, aIter, &(aResult->mNumberOfSimulcastStreams))) {
|
||||
if (!ReadParam(aReader, &(aResult->mQPMax)) ||
|
||||
!ReadParam(aReader, &(aResult->mNumberOfSimulcastStreams))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -165,12 +163,12 @@ struct ParamTraits<GMPVideoCodec> {
|
||||
}
|
||||
|
||||
for (uint32_t i = 0; i < aResult->mNumberOfSimulcastStreams; i++) {
|
||||
if (!ReadParam(aMsg, aIter, &(aResult->mSimulcastStream[i]))) {
|
||||
if (!ReadParam(aReader, &(aResult->mSimulcastStream[i]))) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (!ReadParam(aMsg, aIter, &(aResult->mMode))) {
|
||||
if (!ReadParam(aReader, &(aResult->mMode))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -19,40 +19,39 @@ template <>
|
||||
struct ParamTraits<mozilla::VideoInfo> {
|
||||
typedef mozilla::VideoInfo paramType;
|
||||
|
||||
static void Write(Message* aMsg, const paramType& aParam) {
|
||||
static void Write(MessageWriter* aWriter, const paramType& aParam) {
|
||||
// TrackInfo
|
||||
WriteParam(aMsg, aParam.mMimeType);
|
||||
WriteParam(aWriter, aParam.mMimeType);
|
||||
|
||||
// VideoInfo
|
||||
WriteParam(aMsg, aParam.mDisplay);
|
||||
WriteParam(aMsg, aParam.mStereoMode);
|
||||
WriteParam(aMsg, aParam.mImage);
|
||||
WriteParam(aMsg, aParam.mImageRect);
|
||||
WriteParam(aMsg, *aParam.mCodecSpecificConfig);
|
||||
WriteParam(aMsg, *aParam.mExtraData);
|
||||
WriteParam(aMsg, aParam.mRotation);
|
||||
WriteParam(aMsg, aParam.mColorDepth);
|
||||
WriteParam(aMsg, aParam.mColorSpace);
|
||||
WriteParam(aMsg, aParam.mColorRange);
|
||||
WriteParam(aMsg, aParam.HasAlpha());
|
||||
WriteParam(aWriter, aParam.mDisplay);
|
||||
WriteParam(aWriter, aParam.mStereoMode);
|
||||
WriteParam(aWriter, aParam.mImage);
|
||||
WriteParam(aWriter, aParam.mImageRect);
|
||||
WriteParam(aWriter, *aParam.mCodecSpecificConfig);
|
||||
WriteParam(aWriter, *aParam.mExtraData);
|
||||
WriteParam(aWriter, aParam.mRotation);
|
||||
WriteParam(aWriter, aParam.mColorDepth);
|
||||
WriteParam(aWriter, aParam.mColorSpace);
|
||||
WriteParam(aWriter, aParam.mColorRange);
|
||||
WriteParam(aWriter, aParam.HasAlpha());
|
||||
}
|
||||
|
||||
static bool Read(const Message* aMsg, PickleIterator* aIter,
|
||||
paramType* aResult) {
|
||||
static bool Read(MessageReader* aReader, paramType* aResult) {
|
||||
mozilla::gfx::IntRect imageRect;
|
||||
bool alphaPresent;
|
||||
if (ReadParam(aMsg, aIter, &aResult->mMimeType) &&
|
||||
ReadParam(aMsg, aIter, &aResult->mDisplay) &&
|
||||
ReadParam(aMsg, aIter, &aResult->mStereoMode) &&
|
||||
ReadParam(aMsg, aIter, &aResult->mImage) &&
|
||||
ReadParam(aMsg, aIter, &aResult->mImageRect) &&
|
||||
ReadParam(aMsg, aIter, aResult->mCodecSpecificConfig.get()) &&
|
||||
ReadParam(aMsg, aIter, aResult->mExtraData.get()) &&
|
||||
ReadParam(aMsg, aIter, &aResult->mRotation) &&
|
||||
ReadParam(aMsg, aIter, &aResult->mColorDepth) &&
|
||||
ReadParam(aMsg, aIter, &aResult->mColorSpace) &&
|
||||
ReadParam(aMsg, aIter, &aResult->mColorRange) &&
|
||||
ReadParam(aMsg, aIter, &alphaPresent)) {
|
||||
if (ReadParam(aReader, &aResult->mMimeType) &&
|
||||
ReadParam(aReader, &aResult->mDisplay) &&
|
||||
ReadParam(aReader, &aResult->mStereoMode) &&
|
||||
ReadParam(aReader, &aResult->mImage) &&
|
||||
ReadParam(aReader, &aResult->mImageRect) &&
|
||||
ReadParam(aReader, aResult->mCodecSpecificConfig.get()) &&
|
||||
ReadParam(aReader, aResult->mExtraData.get()) &&
|
||||
ReadParam(aReader, &aResult->mRotation) &&
|
||||
ReadParam(aReader, &aResult->mColorDepth) &&
|
||||
ReadParam(aReader, &aResult->mColorSpace) &&
|
||||
ReadParam(aReader, &aResult->mColorRange) &&
|
||||
ReadParam(aReader, &alphaPresent)) {
|
||||
aResult->SetAlpha(alphaPresent);
|
||||
return true;
|
||||
}
|
||||
@ -83,32 +82,31 @@ template <>
|
||||
struct ParamTraits<mozilla::AudioInfo> {
|
||||
typedef mozilla::AudioInfo paramType;
|
||||
|
||||
static void Write(Message* aMsg, const paramType& aParam) {
|
||||
static void Write(MessageWriter* aWriter, const paramType& aParam) {
|
||||
// TrackInfo
|
||||
WriteParam(aMsg, aParam.mMimeType);
|
||||
WriteParam(aWriter, aParam.mMimeType);
|
||||
|
||||
// AudioInfo
|
||||
WriteParam(aMsg, aParam.mRate);
|
||||
WriteParam(aMsg, aParam.mChannels);
|
||||
WriteParam(aMsg, aParam.mChannelMap);
|
||||
WriteParam(aMsg, aParam.mBitDepth);
|
||||
WriteParam(aMsg, aParam.mProfile);
|
||||
WriteParam(aMsg, aParam.mExtendedProfile);
|
||||
WriteParam(aMsg, *aParam.mCodecSpecificConfig);
|
||||
WriteParam(aMsg, *aParam.mExtraData);
|
||||
WriteParam(aWriter, aParam.mRate);
|
||||
WriteParam(aWriter, aParam.mChannels);
|
||||
WriteParam(aWriter, aParam.mChannelMap);
|
||||
WriteParam(aWriter, aParam.mBitDepth);
|
||||
WriteParam(aWriter, aParam.mProfile);
|
||||
WriteParam(aWriter, aParam.mExtendedProfile);
|
||||
WriteParam(aWriter, *aParam.mCodecSpecificConfig);
|
||||
WriteParam(aWriter, *aParam.mExtraData);
|
||||
}
|
||||
|
||||
static bool Read(const Message* aMsg, PickleIterator* aIter,
|
||||
paramType* aResult) {
|
||||
if (ReadParam(aMsg, aIter, &aResult->mMimeType) &&
|
||||
ReadParam(aMsg, aIter, &aResult->mRate) &&
|
||||
ReadParam(aMsg, aIter, &aResult->mChannels) &&
|
||||
ReadParam(aMsg, aIter, &aResult->mChannelMap) &&
|
||||
ReadParam(aMsg, aIter, &aResult->mBitDepth) &&
|
||||
ReadParam(aMsg, aIter, &aResult->mProfile) &&
|
||||
ReadParam(aMsg, aIter, &aResult->mExtendedProfile) &&
|
||||
ReadParam(aMsg, aIter, aResult->mCodecSpecificConfig.get()) &&
|
||||
ReadParam(aMsg, aIter, aResult->mExtraData.get())) {
|
||||
static bool Read(MessageReader* aReader, paramType* aResult) {
|
||||
if (ReadParam(aReader, &aResult->mMimeType) &&
|
||||
ReadParam(aReader, &aResult->mRate) &&
|
||||
ReadParam(aReader, &aResult->mChannels) &&
|
||||
ReadParam(aReader, &aResult->mChannelMap) &&
|
||||
ReadParam(aReader, &aResult->mBitDepth) &&
|
||||
ReadParam(aReader, &aResult->mProfile) &&
|
||||
ReadParam(aReader, &aResult->mExtendedProfile) &&
|
||||
ReadParam(aReader, aResult->mCodecSpecificConfig.get()) &&
|
||||
ReadParam(aReader, aResult->mExtraData.get())) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@ -127,16 +125,15 @@ template <>
|
||||
struct ParamTraits<mozilla::media::TimeUnit> {
|
||||
typedef mozilla::media::TimeUnit paramType;
|
||||
|
||||
static void Write(Message* aMsg, const paramType& aParam) {
|
||||
WriteParam(aMsg, aParam.IsValid());
|
||||
WriteParam(aMsg, aParam.IsValid() ? aParam.ToMicroseconds() : 0);
|
||||
static void Write(MessageWriter* aWriter, const paramType& aParam) {
|
||||
WriteParam(aWriter, aParam.IsValid());
|
||||
WriteParam(aWriter, aParam.IsValid() ? aParam.ToMicroseconds() : 0);
|
||||
}
|
||||
|
||||
static bool Read(const Message* aMsg, PickleIterator* aIter,
|
||||
paramType* aResult) {
|
||||
static bool Read(MessageReader* aReader, paramType* aResult) {
|
||||
bool valid;
|
||||
int64_t value;
|
||||
if (ReadParam(aMsg, aIter, &valid) && ReadParam(aMsg, aIter, &value)) {
|
||||
if (ReadParam(aReader, &valid) && ReadParam(aReader, &value)) {
|
||||
if (!valid) {
|
||||
*aResult = mozilla::media::TimeUnit::Invalid();
|
||||
} else {
|
||||
@ -152,17 +149,16 @@ template <>
|
||||
struct ParamTraits<mozilla::media::TimeInterval> {
|
||||
typedef mozilla::media::TimeInterval paramType;
|
||||
|
||||
static void Write(Message* aMsg, const paramType& aParam) {
|
||||
WriteParam(aMsg, aParam.mStart);
|
||||
WriteParam(aMsg, aParam.mEnd);
|
||||
WriteParam(aMsg, aParam.mFuzz);
|
||||
static void Write(MessageWriter* aWriter, const paramType& aParam) {
|
||||
WriteParam(aWriter, aParam.mStart);
|
||||
WriteParam(aWriter, aParam.mEnd);
|
||||
WriteParam(aWriter, aParam.mFuzz);
|
||||
}
|
||||
|
||||
static bool Read(const Message* aMsg, PickleIterator* aIter,
|
||||
paramType* aResult) {
|
||||
if (ReadParam(aMsg, aIter, &aResult->mStart) &&
|
||||
ReadParam(aMsg, aIter, &aResult->mEnd) &&
|
||||
ReadParam(aMsg, aIter, &aResult->mFuzz)) {
|
||||
static bool Read(MessageReader* aReader, paramType* aResult) {
|
||||
if (ReadParam(aReader, &aResult->mStart) &&
|
||||
ReadParam(aReader, &aResult->mEnd) &&
|
||||
ReadParam(aReader, &aResult->mFuzz)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@ -173,16 +169,15 @@ template <>
|
||||
struct ParamTraits<mozilla::MediaResult> {
|
||||
typedef mozilla::MediaResult paramType;
|
||||
|
||||
static void Write(Message* aMsg, const paramType& aParam) {
|
||||
WriteParam(aMsg, aParam.Code());
|
||||
WriteParam(aMsg, aParam.Message());
|
||||
static void Write(MessageWriter* aWriter, const paramType& aParam) {
|
||||
WriteParam(aWriter, aParam.Code());
|
||||
WriteParam(aWriter, aParam.Message());
|
||||
}
|
||||
|
||||
static bool Read(const Message* aMsg, PickleIterator* aIter,
|
||||
paramType* aResult) {
|
||||
static bool Read(MessageReader* aReader, paramType* aResult) {
|
||||
nsresult result;
|
||||
nsCString message;
|
||||
if (ReadParam(aMsg, aIter, &result) && ReadParam(aMsg, aIter, &message)) {
|
||||
if (ReadParam(aReader, &result) && ReadParam(aReader, &message)) {
|
||||
*aResult = paramType(result, std::move(message));
|
||||
return true;
|
||||
}
|
||||
@ -194,19 +189,18 @@ template <>
|
||||
struct ParamTraits<mozilla::DecoderDoctorDiagnostics> {
|
||||
typedef mozilla::DecoderDoctorDiagnostics paramType;
|
||||
|
||||
static void Write(Message* aMsg, const paramType& aParam) {
|
||||
WriteParam(aMsg, aParam.mDiagnosticsType);
|
||||
WriteParam(aMsg, aParam.mFormat);
|
||||
WriteParam(aMsg, aParam.mFlags);
|
||||
WriteParam(aMsg, aParam.mEvent);
|
||||
static void Write(MessageWriter* aWriter, const paramType& aParam) {
|
||||
WriteParam(aWriter, aParam.mDiagnosticsType);
|
||||
WriteParam(aWriter, aParam.mFormat);
|
||||
WriteParam(aWriter, aParam.mFlags);
|
||||
WriteParam(aWriter, aParam.mEvent);
|
||||
}
|
||||
|
||||
static bool Read(const Message* aMsg, PickleIterator* aIter,
|
||||
paramType* aResult) {
|
||||
if (ReadParam(aMsg, aIter, &aResult->mDiagnosticsType) &&
|
||||
ReadParam(aMsg, aIter, &aResult->mFormat) &&
|
||||
ReadParam(aMsg, aIter, &aResult->mFlags) &&
|
||||
ReadParam(aMsg, aIter, &aResult->mEvent)) {
|
||||
static bool Read(MessageReader* aReader, paramType* aResult) {
|
||||
if (ReadParam(aReader, &aResult->mDiagnosticsType) &&
|
||||
ReadParam(aReader, &aResult->mFormat) &&
|
||||
ReadParam(aReader, &aResult->mFlags) &&
|
||||
ReadParam(aReader, &aResult->mEvent)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@ -225,17 +219,15 @@ template <>
|
||||
struct ParamTraits<mozilla::DecoderDoctorEvent> {
|
||||
typedef mozilla::DecoderDoctorEvent paramType;
|
||||
|
||||
static void Write(Message* aMsg, const paramType& aParam) {
|
||||
static void Write(MessageWriter* aWriter, const paramType& aParam) {
|
||||
int domain = aParam.mDomain;
|
||||
WriteParam(aMsg, domain);
|
||||
WriteParam(aMsg, aParam.mResult);
|
||||
WriteParam(aWriter, domain);
|
||||
WriteParam(aWriter, aParam.mResult);
|
||||
}
|
||||
|
||||
static bool Read(const Message* aMsg, PickleIterator* aIter,
|
||||
paramType* aResult) {
|
||||
static bool Read(MessageReader* aReader, paramType* aResult) {
|
||||
int domain = 0;
|
||||
if (ReadParam(aMsg, aIter, &domain) &&
|
||||
ReadParam(aMsg, aIter, &aResult->mResult)) {
|
||||
if (ReadParam(aReader, &domain) && ReadParam(aReader, &aResult->mResult)) {
|
||||
aResult->mDomain = paramType::Domain(domain);
|
||||
return true;
|
||||
}
|
||||
|
@ -138,21 +138,22 @@ RemoteImageHolder::~RemoteImageHolder() {
|
||||
}
|
||||
|
||||
/* static */ void ipc::IPDLParamTraits<RemoteImageHolder>::Write(
|
||||
IPC::Message* aMsg, ipc::IProtocol* aActor, RemoteImageHolder&& aParam) {
|
||||
WriteIPDLParam(aMsg, aActor, aParam.mSource);
|
||||
WriteIPDLParam(aMsg, aActor, aParam.mSize);
|
||||
WriteIPDLParam(aMsg, aActor, aParam.mSD);
|
||||
IPC::MessageWriter* aWriter, ipc::IProtocol* aActor,
|
||||
RemoteImageHolder&& aParam) {
|
||||
WriteIPDLParam(aWriter, aActor, aParam.mSource);
|
||||
WriteIPDLParam(aWriter, aActor, aParam.mSize);
|
||||
WriteIPDLParam(aWriter, aActor, aParam.mSD);
|
||||
// Empty this holder.
|
||||
aParam.mSD = Nothing();
|
||||
aParam.mManager = nullptr;
|
||||
}
|
||||
|
||||
/* static */ bool ipc::IPDLParamTraits<RemoteImageHolder>::Read(
|
||||
const IPC::Message* aMsg, PickleIterator* aIter, ipc::IProtocol* aActor,
|
||||
IPC::MessageReader* aReader, ipc::IProtocol* aActor,
|
||||
RemoteImageHolder* aResult) {
|
||||
if (!ReadIPDLParam(aMsg, aIter, aActor, &aResult->mSource) ||
|
||||
!ReadIPDLParam(aMsg, aIter, aActor, &aResult->mSize) ||
|
||||
!ReadIPDLParam(aMsg, aIter, aActor, &aResult->mSD)) {
|
||||
if (!ReadIPDLParam(aReader, aActor, &aResult->mSource) ||
|
||||
!ReadIPDLParam(aReader, aActor, &aResult->mSize) ||
|
||||
!ReadIPDLParam(aReader, aActor, &aResult->mSD)) {
|
||||
return false;
|
||||
}
|
||||
if (!aResult->IsEmpty()) {
|
||||
|
@ -53,10 +53,10 @@ class RemoteImageHolder final {
|
||||
|
||||
template <>
|
||||
struct ipc::IPDLParamTraits<RemoteImageHolder> {
|
||||
static void Write(IPC::Message* aMsg, IProtocol* aActor,
|
||||
static void Write(IPC::MessageWriter* aWriter, IProtocol* aActor,
|
||||
RemoteImageHolder&& aParam);
|
||||
static bool Read(const IPC::Message* aMsg, PickleIterator* aIter,
|
||||
IProtocol* aActor, RemoteImageHolder* aResult);
|
||||
static bool Read(IPC::MessageReader* aReader, IProtocol* aActor,
|
||||
RemoteImageHolder* aResult);
|
||||
};
|
||||
|
||||
} // namespace mozilla
|
||||
|
@ -107,26 +107,26 @@ already_AddRefed<MediaByteBuffer> RemoteArrayOfByteBuffer::MediaByteBufferAt(
|
||||
}
|
||||
|
||||
/*static */ void ipc::IPDLParamTraits<RemoteArrayOfByteBuffer>::Write(
|
||||
IPC::Message* aMsg, ipc::IProtocol* aActor,
|
||||
IPC::MessageWriter* aWriter, ipc::IProtocol* aActor,
|
||||
const RemoteArrayOfByteBuffer& aVar) {
|
||||
WriteIPDLParam(aMsg, aActor, aVar.mIsValid);
|
||||
WriteIPDLParam(aWriter, aActor, aVar.mIsValid);
|
||||
// We need the following gymnastic as the Shmem transfered over IPC will be
|
||||
// revoked. We must create a temporary one instead so that it can be recycled
|
||||
// later back into the original ShmemPool.
|
||||
if (aVar.mBuffers) {
|
||||
WriteIPDLParam(aMsg, aActor, Some(ipc::Shmem(*aVar.mBuffers)));
|
||||
WriteIPDLParam(aWriter, aActor, Some(ipc::Shmem(*aVar.mBuffers)));
|
||||
} else {
|
||||
WriteIPDLParam(aMsg, aActor, Maybe<ipc::Shmem>());
|
||||
WriteIPDLParam(aWriter, aActor, Maybe<ipc::Shmem>());
|
||||
}
|
||||
WriteIPDLParam(aMsg, aActor, aVar.mOffsets);
|
||||
WriteIPDLParam(aWriter, aActor, aVar.mOffsets);
|
||||
}
|
||||
|
||||
/* static */ bool ipc::IPDLParamTraits<RemoteArrayOfByteBuffer>::Read(
|
||||
const IPC::Message* aMsg, PickleIterator* aIter,
|
||||
mozilla::ipc::IProtocol* aActor, RemoteArrayOfByteBuffer* aVar) {
|
||||
return ReadIPDLParam(aMsg, aIter, aActor, &aVar->mIsValid) &&
|
||||
ReadIPDLParam(aMsg, aIter, aActor, &aVar->mBuffers) &&
|
||||
ReadIPDLParam(aMsg, aIter, aActor, &aVar->mOffsets);
|
||||
IPC::MessageReader* aReader, mozilla::ipc::IProtocol* aActor,
|
||||
RemoteArrayOfByteBuffer* aVar) {
|
||||
return ReadIPDLParam(aReader, aActor, &aVar->mIsValid) &&
|
||||
ReadIPDLParam(aReader, aActor, &aVar->mBuffers) &&
|
||||
ReadIPDLParam(aReader, aActor, &aVar->mOffsets);
|
||||
}
|
||||
|
||||
bool ArrayOfRemoteMediaRawData::Fill(
|
||||
@ -211,22 +211,22 @@ already_AddRefed<MediaRawData> ArrayOfRemoteMediaRawData::ElementAt(
|
||||
}
|
||||
|
||||
/*static */ void ipc::IPDLParamTraits<ArrayOfRemoteMediaRawData*>::Write(
|
||||
IPC::Message* aMsg, ipc::IProtocol* aActor,
|
||||
IPC::MessageWriter* aWriter, ipc::IProtocol* aActor,
|
||||
ArrayOfRemoteMediaRawData* aVar) {
|
||||
WriteIPDLParam(aMsg, aActor, std::move(aVar->mSamples));
|
||||
WriteIPDLParam(aMsg, aActor, std::move(aVar->mBuffers));
|
||||
WriteIPDLParam(aMsg, aActor, std::move(aVar->mAlphaBuffers));
|
||||
WriteIPDLParam(aMsg, aActor, std::move(aVar->mExtraDatas));
|
||||
WriteIPDLParam(aWriter, aActor, std::move(aVar->mSamples));
|
||||
WriteIPDLParam(aWriter, aActor, std::move(aVar->mBuffers));
|
||||
WriteIPDLParam(aWriter, aActor, std::move(aVar->mAlphaBuffers));
|
||||
WriteIPDLParam(aWriter, aActor, std::move(aVar->mExtraDatas));
|
||||
}
|
||||
|
||||
/* static */ bool ipc::IPDLParamTraits<ArrayOfRemoteMediaRawData*>::Read(
|
||||
const IPC::Message* aMsg, PickleIterator* aIter,
|
||||
mozilla::ipc::IProtocol* aActor, RefPtr<ArrayOfRemoteMediaRawData>* aVar) {
|
||||
IPC::MessageReader* aReader, mozilla::ipc::IProtocol* aActor,
|
||||
RefPtr<ArrayOfRemoteMediaRawData>* aVar) {
|
||||
auto array = MakeRefPtr<ArrayOfRemoteMediaRawData>();
|
||||
if (!ReadIPDLParam(aMsg, aIter, aActor, &array->mSamples) ||
|
||||
!ReadIPDLParam(aMsg, aIter, aActor, &array->mBuffers) ||
|
||||
!ReadIPDLParam(aMsg, aIter, aActor, &array->mAlphaBuffers) ||
|
||||
!ReadIPDLParam(aMsg, aIter, aActor, &array->mExtraDatas)) {
|
||||
if (!ReadIPDLParam(aReader, aActor, &array->mSamples) ||
|
||||
!ReadIPDLParam(aReader, aActor, &array->mBuffers) ||
|
||||
!ReadIPDLParam(aReader, aActor, &array->mAlphaBuffers) ||
|
||||
!ReadIPDLParam(aReader, aActor, &array->mExtraDatas)) {
|
||||
return false;
|
||||
}
|
||||
*aVar = std::move(array);
|
||||
@ -235,24 +235,24 @@ already_AddRefed<MediaRawData> ArrayOfRemoteMediaRawData::ElementAt(
|
||||
|
||||
/* static */ void
|
||||
ipc::IPDLParamTraits<ArrayOfRemoteMediaRawData::RemoteMediaRawData>::Write(
|
||||
IPC::Message* aMsg, ipc::IProtocol* aActor, const paramType& aVar) {
|
||||
WriteIPDLParam(aMsg, aActor, aVar.mBase);
|
||||
WriteIPDLParam(aMsg, aActor, aVar.mEOS);
|
||||
WriteIPDLParam(aMsg, aActor, aVar.mHeight);
|
||||
WriteIPDLParam(aMsg, aActor, aVar.mDiscardPadding);
|
||||
WriteIPDLParam(aMsg, aActor, aVar.mOriginalPresentationWindow);
|
||||
IPC::MessageWriter* aWriter, ipc::IProtocol* aActor,
|
||||
const paramType& aVar) {
|
||||
WriteIPDLParam(aWriter, aActor, aVar.mBase);
|
||||
WriteIPDLParam(aWriter, aActor, aVar.mEOS);
|
||||
WriteIPDLParam(aWriter, aActor, aVar.mHeight);
|
||||
WriteIPDLParam(aWriter, aActor, aVar.mDiscardPadding);
|
||||
WriteIPDLParam(aWriter, aActor, aVar.mOriginalPresentationWindow);
|
||||
}
|
||||
|
||||
/* static */ bool
|
||||
ipc::IPDLParamTraits<ArrayOfRemoteMediaRawData::RemoteMediaRawData>::Read(
|
||||
const IPC::Message* aMsg, PickleIterator* aIter, ipc::IProtocol* aActor,
|
||||
paramType* aVar) {
|
||||
IPC::MessageReader* aReader, ipc::IProtocol* aActor, paramType* aVar) {
|
||||
MediaDataIPDL mBase;
|
||||
return ReadIPDLParam(aMsg, aIter, aActor, &aVar->mBase) &&
|
||||
ReadIPDLParam(aMsg, aIter, aActor, &aVar->mEOS) &&
|
||||
ReadIPDLParam(aMsg, aIter, aActor, &aVar->mHeight) &&
|
||||
ReadIPDLParam(aMsg, aIter, aActor, &aVar->mDiscardPadding) &&
|
||||
ReadIPDLParam(aMsg, aIter, aActor, &aVar->mOriginalPresentationWindow);
|
||||
return ReadIPDLParam(aReader, aActor, &aVar->mBase) &&
|
||||
ReadIPDLParam(aReader, aActor, &aVar->mEOS) &&
|
||||
ReadIPDLParam(aReader, aActor, &aVar->mHeight) &&
|
||||
ReadIPDLParam(aReader, aActor, &aVar->mDiscardPadding) &&
|
||||
ReadIPDLParam(aReader, aActor, &aVar->mOriginalPresentationWindow);
|
||||
};
|
||||
|
||||
bool ArrayOfRemoteAudioData::Fill(
|
||||
@ -304,17 +304,18 @@ already_AddRefed<AudioData> ArrayOfRemoteAudioData::ElementAt(
|
||||
}
|
||||
|
||||
/*static */ void ipc::IPDLParamTraits<ArrayOfRemoteAudioData*>::Write(
|
||||
IPC::Message* aMsg, ipc::IProtocol* aActor, ArrayOfRemoteAudioData* aVar) {
|
||||
WriteIPDLParam(aMsg, aActor, std::move(aVar->mSamples));
|
||||
WriteIPDLParam(aMsg, aActor, std::move(aVar->mBuffers));
|
||||
IPC::MessageWriter* aWriter, ipc::IProtocol* aActor,
|
||||
ArrayOfRemoteAudioData* aVar) {
|
||||
WriteIPDLParam(aWriter, aActor, std::move(aVar->mSamples));
|
||||
WriteIPDLParam(aWriter, aActor, std::move(aVar->mBuffers));
|
||||
}
|
||||
|
||||
/* static */ bool ipc::IPDLParamTraits<ArrayOfRemoteAudioData*>::Read(
|
||||
const IPC::Message* aMsg, PickleIterator* aIter,
|
||||
mozilla::ipc::IProtocol* aActor, RefPtr<ArrayOfRemoteAudioData>* aVar) {
|
||||
IPC::MessageReader* aReader, mozilla::ipc::IProtocol* aActor,
|
||||
RefPtr<ArrayOfRemoteAudioData>* aVar) {
|
||||
auto array = MakeRefPtr<ArrayOfRemoteAudioData>();
|
||||
if (!ReadIPDLParam(aMsg, aIter, aActor, &array->mSamples) ||
|
||||
!ReadIPDLParam(aMsg, aIter, aActor, &array->mBuffers)) {
|
||||
if (!ReadIPDLParam(aReader, aActor, &array->mSamples) ||
|
||||
!ReadIPDLParam(aReader, aActor, &array->mBuffers)) {
|
||||
return false;
|
||||
}
|
||||
*aVar = std::move(array);
|
||||
@ -323,30 +324,30 @@ already_AddRefed<AudioData> ArrayOfRemoteAudioData::ElementAt(
|
||||
|
||||
/* static */ void
|
||||
ipc::IPDLParamTraits<ArrayOfRemoteAudioData::RemoteAudioData>::Write(
|
||||
IPC::Message* aMsg, ipc::IProtocol* aActor, const paramType& aVar) {
|
||||
WriteIPDLParam(aMsg, aActor, aVar.mBase);
|
||||
WriteIPDLParam(aMsg, aActor, aVar.mChannels);
|
||||
WriteIPDLParam(aMsg, aActor, aVar.mRate);
|
||||
WriteIPDLParam(aMsg, aActor, aVar.mChannelMap);
|
||||
WriteIPDLParam(aMsg, aActor, aVar.mOriginalTime);
|
||||
WriteIPDLParam(aMsg, aActor, aVar.mTrimWindow);
|
||||
WriteIPDLParam(aMsg, aActor, aVar.mFrames);
|
||||
WriteIPDLParam(aMsg, aActor, aVar.mDataOffset);
|
||||
IPC::MessageWriter* aWriter, ipc::IProtocol* aActor,
|
||||
const paramType& aVar) {
|
||||
WriteIPDLParam(aWriter, aActor, aVar.mBase);
|
||||
WriteIPDLParam(aWriter, aActor, aVar.mChannels);
|
||||
WriteIPDLParam(aWriter, aActor, aVar.mRate);
|
||||
WriteIPDLParam(aWriter, aActor, aVar.mChannelMap);
|
||||
WriteIPDLParam(aWriter, aActor, aVar.mOriginalTime);
|
||||
WriteIPDLParam(aWriter, aActor, aVar.mTrimWindow);
|
||||
WriteIPDLParam(aWriter, aActor, aVar.mFrames);
|
||||
WriteIPDLParam(aWriter, aActor, aVar.mDataOffset);
|
||||
}
|
||||
|
||||
/* static */ bool
|
||||
ipc::IPDLParamTraits<ArrayOfRemoteAudioData::RemoteAudioData>::Read(
|
||||
const IPC::Message* aMsg, PickleIterator* aIter, ipc::IProtocol* aActor,
|
||||
paramType* aVar) {
|
||||
IPC::MessageReader* aReader, ipc::IProtocol* aActor, paramType* aVar) {
|
||||
MediaDataIPDL mBase;
|
||||
if (!ReadIPDLParam(aMsg, aIter, aActor, &aVar->mBase) ||
|
||||
!ReadIPDLParam(aMsg, aIter, aActor, &aVar->mChannels) ||
|
||||
!ReadIPDLParam(aMsg, aIter, aActor, &aVar->mRate) ||
|
||||
!ReadIPDLParam(aMsg, aIter, aActor, &aVar->mChannelMap) ||
|
||||
!ReadIPDLParam(aMsg, aIter, aActor, &aVar->mOriginalTime) ||
|
||||
!ReadIPDLParam(aMsg, aIter, aActor, &aVar->mTrimWindow) ||
|
||||
!ReadIPDLParam(aMsg, aIter, aActor, &aVar->mFrames) ||
|
||||
!ReadIPDLParam(aMsg, aIter, aActor, &aVar->mDataOffset)) {
|
||||
if (!ReadIPDLParam(aReader, aActor, &aVar->mBase) ||
|
||||
!ReadIPDLParam(aReader, aActor, &aVar->mChannels) ||
|
||||
!ReadIPDLParam(aReader, aActor, &aVar->mRate) ||
|
||||
!ReadIPDLParam(aReader, aActor, &aVar->mChannelMap) ||
|
||||
!ReadIPDLParam(aReader, aActor, &aVar->mOriginalTime) ||
|
||||
!ReadIPDLParam(aReader, aActor, &aVar->mTrimWindow) ||
|
||||
!ReadIPDLParam(aReader, aActor, &aVar->mFrames) ||
|
||||
!ReadIPDLParam(aReader, aActor, &aVar->mDataOffset)) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
@ -296,20 +296,20 @@ namespace ipc {
|
||||
template <>
|
||||
struct IPDLParamTraits<RemoteVideoData> {
|
||||
typedef RemoteVideoData paramType;
|
||||
static void Write(IPC::Message* aMsg, ipc::IProtocol* aActor,
|
||||
static void Write(IPC::MessageWriter* aWriter, ipc::IProtocol* aActor,
|
||||
paramType&& aVar) {
|
||||
WriteIPDLParam(aMsg, aActor, std::move(aVar.mBase));
|
||||
WriteIPDLParam(aMsg, aActor, std::move(aVar.mDisplay));
|
||||
WriteIPDLParam(aMsg, aActor, std::move(aVar.mImage));
|
||||
aMsg->WriteBytes(&aVar.mFrameID, 4);
|
||||
WriteIPDLParam(aWriter, aActor, std::move(aVar.mBase));
|
||||
WriteIPDLParam(aWriter, aActor, std::move(aVar.mDisplay));
|
||||
WriteIPDLParam(aWriter, aActor, std::move(aVar.mImage));
|
||||
aWriter->WriteBytes(&aVar.mFrameID, 4);
|
||||
}
|
||||
|
||||
static bool Read(const IPC::Message* aMsg, PickleIterator* aIter,
|
||||
mozilla::ipc::IProtocol* aActor, paramType* aVar) {
|
||||
if (!ReadIPDLParam(aMsg, aIter, aActor, &aVar->mBase) ||
|
||||
!ReadIPDLParam(aMsg, aIter, aActor, &aVar->mDisplay) ||
|
||||
!ReadIPDLParam(aMsg, aIter, aActor, &aVar->mImage) ||
|
||||
!aMsg->ReadBytesInto(aIter, &aVar->mFrameID, 4)) {
|
||||
static bool Read(IPC::MessageReader* aReader, mozilla::ipc::IProtocol* aActor,
|
||||
paramType* aVar) {
|
||||
if (!ReadIPDLParam(aReader, aActor, &aVar->mBase) ||
|
||||
!ReadIPDLParam(aReader, aActor, &aVar->mDisplay) ||
|
||||
!ReadIPDLParam(aReader, aActor, &aVar->mImage) ||
|
||||
!aReader->ReadBytesInto(&aVar->mFrameID, 4)) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
@ -319,15 +319,15 @@ struct IPDLParamTraits<RemoteVideoData> {
|
||||
template <>
|
||||
struct IPDLParamTraits<ArrayOfRemoteVideoData*> {
|
||||
typedef ArrayOfRemoteVideoData paramType;
|
||||
static void Write(IPC::Message* aMsg, mozilla::ipc::IProtocol* aActor,
|
||||
paramType* aVar) {
|
||||
WriteIPDLParam(aMsg, aActor, std::move(aVar->mArray));
|
||||
static void Write(IPC::MessageWriter* aWriter,
|
||||
mozilla::ipc::IProtocol* aActor, paramType* aVar) {
|
||||
WriteIPDLParam(aWriter, aActor, std::move(aVar->mArray));
|
||||
}
|
||||
|
||||
static bool Read(const IPC::Message* aMsg, PickleIterator* aIter,
|
||||
ipc::IProtocol* aActor, RefPtr<paramType>* aVar) {
|
||||
static bool Read(IPC::MessageReader* aReader, ipc::IProtocol* aActor,
|
||||
RefPtr<paramType>* aVar) {
|
||||
nsTArray<RemoteVideoData> array;
|
||||
if (!ReadIPDLParam(aMsg, aIter, aActor, &array)) {
|
||||
if (!ReadIPDLParam(aReader, aActor, &array)) {
|
||||
return false;
|
||||
}
|
||||
auto results = MakeRefPtr<ArrayOfRemoteVideoData>(std::move(array));
|
||||
@ -341,51 +341,51 @@ struct IPDLParamTraits<RemoteArrayOfByteBuffer> {
|
||||
typedef RemoteArrayOfByteBuffer paramType;
|
||||
// We do not want to move the RemoteArrayOfByteBuffer as we want to recycle
|
||||
// the shmem it contains for another time.
|
||||
static void Write(IPC::Message* aMsg, ipc::IProtocol* aActor,
|
||||
static void Write(IPC::MessageWriter* aWriter, ipc::IProtocol* aActor,
|
||||
const paramType& aVar);
|
||||
|
||||
static bool Read(const IPC::Message* aMsg, PickleIterator* aIter,
|
||||
ipc::IProtocol* aActor, paramType* aVar);
|
||||
static bool Read(IPC::MessageReader* aReader, ipc::IProtocol* aActor,
|
||||
paramType* aVar);
|
||||
};
|
||||
|
||||
template <>
|
||||
struct IPDLParamTraits<ArrayOfRemoteMediaRawData::RemoteMediaRawData> {
|
||||
typedef ArrayOfRemoteMediaRawData::RemoteMediaRawData paramType;
|
||||
static void Write(IPC::Message* aMsg, ipc::IProtocol* aActor,
|
||||
static void Write(IPC::MessageWriter* aWriter, ipc::IProtocol* aActor,
|
||||
const paramType& aVar);
|
||||
|
||||
static bool Read(const IPC::Message* aMsg, PickleIterator* aIter,
|
||||
ipc::IProtocol* aActor, paramType* aVar);
|
||||
static bool Read(IPC::MessageReader* aReader, ipc::IProtocol* aActor,
|
||||
paramType* aVar);
|
||||
};
|
||||
|
||||
template <>
|
||||
struct IPDLParamTraits<ArrayOfRemoteMediaRawData*> {
|
||||
typedef ArrayOfRemoteMediaRawData paramType;
|
||||
static void Write(IPC::Message* aMsg, ipc::IProtocol* aActor,
|
||||
static void Write(IPC::MessageWriter* aWriter, ipc::IProtocol* aActor,
|
||||
paramType* aVar);
|
||||
|
||||
static bool Read(const IPC::Message* aMsg, PickleIterator* aIter,
|
||||
ipc::IProtocol* aActor, RefPtr<paramType>* aVar);
|
||||
static bool Read(IPC::MessageReader* aReader, ipc::IProtocol* aActor,
|
||||
RefPtr<paramType>* aVar);
|
||||
};
|
||||
|
||||
template <>
|
||||
struct IPDLParamTraits<ArrayOfRemoteAudioData::RemoteAudioData> {
|
||||
typedef ArrayOfRemoteAudioData::RemoteAudioData paramType;
|
||||
static void Write(IPC::Message* aMsg, ipc::IProtocol* aActor,
|
||||
static void Write(IPC::MessageWriter* aWriter, ipc::IProtocol* aActor,
|
||||
const paramType& aVar);
|
||||
|
||||
static bool Read(const IPC::Message* aMsg, PickleIterator* aIter,
|
||||
ipc::IProtocol* aActor, paramType* aVar);
|
||||
static bool Read(IPC::MessageReader* aReader, ipc::IProtocol* aActor,
|
||||
paramType* aVar);
|
||||
};
|
||||
|
||||
template <>
|
||||
struct IPDLParamTraits<ArrayOfRemoteAudioData*> {
|
||||
typedef ArrayOfRemoteAudioData paramType;
|
||||
static void Write(IPC::Message* aMsg, ipc::IProtocol* aActor,
|
||||
static void Write(IPC::MessageWriter* aWriter, ipc::IProtocol* aActor,
|
||||
paramType* aVar);
|
||||
|
||||
static bool Read(const IPC::Message* aMsg, PickleIterator* aIter,
|
||||
ipc::IProtocol* aActor, RefPtr<paramType>* aVar);
|
||||
static bool Read(IPC::MessageReader* aReader, ipc::IProtocol* aActor,
|
||||
RefPtr<paramType>* aVar);
|
||||
};
|
||||
} // namespace ipc
|
||||
|
||||
|
@ -38,15 +38,14 @@ template <>
|
||||
struct ParamTraits<mozilla::dom::SeekDetails> {
|
||||
typedef mozilla::dom::SeekDetails paramType;
|
||||
|
||||
static void Write(Message* aMsg, const paramType& aParam) {
|
||||
WriteParam(aMsg, aParam.mSeekTime);
|
||||
WriteParam(aMsg, aParam.mFastSeek);
|
||||
static void Write(MessageWriter* aWriter, const paramType& aParam) {
|
||||
WriteParam(aWriter, aParam.mSeekTime);
|
||||
WriteParam(aWriter, aParam.mFastSeek);
|
||||
}
|
||||
|
||||
static bool Read(const Message* aMsg, PickleIterator* aIter,
|
||||
paramType* aResult) {
|
||||
if (!ReadParam(aMsg, aIter, &aResult->mSeekTime) ||
|
||||
!ReadParam(aMsg, aIter, &aResult->mFastSeek)) {
|
||||
static bool Read(MessageReader* aReader, paramType* aResult) {
|
||||
if (!ReadParam(aReader, &aResult->mSeekTime) ||
|
||||
!ReadParam(aReader, &aResult->mFastSeek)) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
@ -57,15 +56,14 @@ template <>
|
||||
struct ParamTraits<mozilla::dom::MediaControlAction> {
|
||||
typedef mozilla::dom::MediaControlAction paramType;
|
||||
|
||||
static void Write(Message* aMsg, const paramType& aParam) {
|
||||
WriteParam(aMsg, aParam.mKey);
|
||||
WriteParam(aMsg, aParam.mDetails);
|
||||
static void Write(MessageWriter* aWriter, const paramType& aParam) {
|
||||
WriteParam(aWriter, aParam.mKey);
|
||||
WriteParam(aWriter, aParam.mDetails);
|
||||
}
|
||||
|
||||
static bool Read(const Message* aMsg, PickleIterator* aIter,
|
||||
paramType* aResult) {
|
||||
if (!ReadParam(aMsg, aIter, &aResult->mKey) ||
|
||||
!ReadParam(aMsg, aIter, &aResult->mDetails)) {
|
||||
static bool Read(MessageReader* aReader, paramType* aResult) {
|
||||
if (!ReadParam(aReader, &aResult->mKey) ||
|
||||
!ReadParam(aReader, &aResult->mDetails)) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
@ -25,17 +25,16 @@ template <>
|
||||
struct ParamTraits<mozilla::dom::MediaImage> {
|
||||
typedef mozilla::dom::MediaImage paramType;
|
||||
|
||||
static void Write(Message* aMsg, const paramType& aParam) {
|
||||
WriteParam(aMsg, aParam.mSizes);
|
||||
WriteParam(aMsg, aParam.mSrc);
|
||||
WriteParam(aMsg, aParam.mType);
|
||||
static void Write(MessageWriter* aWriter, const paramType& aParam) {
|
||||
WriteParam(aWriter, aParam.mSizes);
|
||||
WriteParam(aWriter, aParam.mSrc);
|
||||
WriteParam(aWriter, aParam.mType);
|
||||
}
|
||||
|
||||
static bool Read(const Message* aMsg, PickleIterator* aIter,
|
||||
paramType* aResult) {
|
||||
if (!ReadParam(aMsg, aIter, &(aResult->mSizes)) ||
|
||||
!ReadParam(aMsg, aIter, &(aResult->mSrc)) ||
|
||||
!ReadParam(aMsg, aIter, &(aResult->mType))) {
|
||||
static bool Read(MessageReader* aReader, paramType* aResult) {
|
||||
if (!ReadParam(aReader, &(aResult->mSizes)) ||
|
||||
!ReadParam(aReader, &(aResult->mSrc)) ||
|
||||
!ReadParam(aReader, &(aResult->mType))) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
@ -46,19 +45,18 @@ template <>
|
||||
struct ParamTraits<mozilla::dom::MediaMetadataBase> {
|
||||
typedef mozilla::dom::MediaMetadataBase paramType;
|
||||
|
||||
static void Write(Message* aMsg, const paramType& aParam) {
|
||||
WriteParam(aMsg, aParam.mTitle);
|
||||
WriteParam(aMsg, aParam.mArtist);
|
||||
WriteParam(aMsg, aParam.mAlbum);
|
||||
WriteParam(aMsg, aParam.mArtwork);
|
||||
static void Write(MessageWriter* aWriter, const paramType& aParam) {
|
||||
WriteParam(aWriter, aParam.mTitle);
|
||||
WriteParam(aWriter, aParam.mArtist);
|
||||
WriteParam(aWriter, aParam.mAlbum);
|
||||
WriteParam(aWriter, aParam.mArtwork);
|
||||
}
|
||||
|
||||
static bool Read(const Message* aMsg, PickleIterator* aIter,
|
||||
paramType* aResult) {
|
||||
if (!ReadParam(aMsg, aIter, &(aResult->mTitle)) ||
|
||||
!ReadParam(aMsg, aIter, &(aResult->mArtist)) ||
|
||||
!ReadParam(aMsg, aIter, &(aResult->mAlbum)) ||
|
||||
!ReadParam(aMsg, aIter, &(aResult->mArtwork))) {
|
||||
static bool Read(MessageReader* aReader, paramType* aResult) {
|
||||
if (!ReadParam(aReader, &(aResult->mTitle)) ||
|
||||
!ReadParam(aReader, &(aResult->mArtist)) ||
|
||||
!ReadParam(aReader, &(aResult->mAlbum)) ||
|
||||
!ReadParam(aReader, &(aResult->mArtwork))) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
@ -69,17 +67,16 @@ template <>
|
||||
struct ParamTraits<mozilla::dom::PositionState> {
|
||||
typedef mozilla::dom::PositionState paramType;
|
||||
|
||||
static void Write(Message* aMsg, const paramType& aParam) {
|
||||
WriteParam(aMsg, aParam.mDuration);
|
||||
WriteParam(aMsg, aParam.mPlaybackRate);
|
||||
WriteParam(aMsg, aParam.mLastReportedPlaybackPosition);
|
||||
static void Write(MessageWriter* aWriter, const paramType& aParam) {
|
||||
WriteParam(aWriter, aParam.mDuration);
|
||||
WriteParam(aWriter, aParam.mPlaybackRate);
|
||||
WriteParam(aWriter, aParam.mLastReportedPlaybackPosition);
|
||||
}
|
||||
|
||||
static bool Read(const Message* aMsg, PickleIterator* aIter,
|
||||
paramType* aResult) {
|
||||
if (!ReadParam(aMsg, aIter, &(aResult->mDuration)) ||
|
||||
!ReadParam(aMsg, aIter, &(aResult->mPlaybackRate)) ||
|
||||
!ReadParam(aMsg, aIter, &(aResult->mLastReportedPlaybackPosition))) {
|
||||
static bool Read(MessageReader* aReader, paramType* aResult) {
|
||||
if (!ReadParam(aReader, &(aResult->mDuration)) ||
|
||||
!ReadParam(aReader, &(aResult->mPlaybackRate)) ||
|
||||
!ReadParam(aReader, &(aResult->mLastReportedPlaybackPosition))) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
@ -99,13 +99,12 @@ struct ParamTraits<
|
||||
mozilla::dom::NotReallyMovableButLetsPretendItIsRTCStatsCollection> {
|
||||
typedef mozilla::dom::NotReallyMovableButLetsPretendItIsRTCStatsCollection
|
||||
paramType;
|
||||
static void Write(Message* aMsg, const paramType& aParam) {
|
||||
WriteParam(aMsg,
|
||||
static void Write(MessageWriter* aWriter, const paramType& aParam) {
|
||||
WriteParam(aWriter,
|
||||
static_cast<const mozilla::dom::RTCStatsCollection&>(aParam));
|
||||
}
|
||||
static bool Read(const Message* aMsg, PickleIterator* aIter,
|
||||
paramType* aResult) {
|
||||
return ReadParam(aMsg, aIter,
|
||||
static bool Read(MessageReader* aReader, paramType* aResult) {
|
||||
return ReadParam(aReader,
|
||||
static_cast<mozilla::dom::RTCStatsCollection*>(aResult));
|
||||
}
|
||||
};
|
||||
@ -133,17 +132,18 @@ DEFINE_IPC_SERIALIZER_WITH_FIELDS(mozilla::dom::RTCSdpHistoryEntryInternal,
|
||||
|
||||
template <>
|
||||
struct ParamTraits<mozilla::dom::RTCStatsCollection> {
|
||||
static void Write(Message* aMsg,
|
||||
static void Write(MessageWriter* aWriter,
|
||||
const mozilla::dom::RTCStatsCollection& aParam) {
|
||||
mozilla::dom::ForAllRTCStatsCollectionMembers(
|
||||
aParam, [&](const auto&... aMember) { WriteParams(aMsg, aMember...); });
|
||||
aParam,
|
||||
[&](const auto&... aMember) { WriteParams(aWriter, aMember...); });
|
||||
}
|
||||
|
||||
static bool Read(const Message* aMsg, PickleIterator* aIter,
|
||||
static bool Read(MessageReader* aReader,
|
||||
mozilla::dom::RTCStatsCollection* aResult) {
|
||||
return mozilla::dom::ForAllRTCStatsCollectionMembers(
|
||||
*aResult,
|
||||
[&](auto&... aMember) { return ReadParams(aMsg, aIter, aMember...); });
|
||||
[&](auto&... aMember) { return ReadParams(aReader, aMember...); });
|
||||
}
|
||||
};
|
||||
|
||||
@ -154,19 +154,18 @@ DEFINE_IPC_SERIALIZER_WITH_SUPER_CLASS_AND_FIELDS(
|
||||
|
||||
typedef mozilla::dom::RTCStats RTCStats;
|
||||
|
||||
static void WriteRTCStats(Message* aMsg, const RTCStats& aParam) {
|
||||
static void WriteRTCStats(MessageWriter* aWriter, const RTCStats& aParam) {
|
||||
// RTCStats base class
|
||||
WriteParam(aMsg, aParam.mId);
|
||||
WriteParam(aMsg, aParam.mTimestamp);
|
||||
WriteParam(aMsg, aParam.mType);
|
||||
WriteParam(aWriter, aParam.mId);
|
||||
WriteParam(aWriter, aParam.mTimestamp);
|
||||
WriteParam(aWriter, aParam.mType);
|
||||
}
|
||||
|
||||
static bool ReadRTCStats(const Message* aMsg, PickleIterator* aIter,
|
||||
RTCStats* aResult) {
|
||||
static bool ReadRTCStats(MessageReader* aReader, RTCStats* aResult) {
|
||||
// RTCStats base class
|
||||
if (!ReadParam(aMsg, aIter, &(aResult->mId)) ||
|
||||
!ReadParam(aMsg, aIter, &(aResult->mTimestamp)) ||
|
||||
!ReadParam(aMsg, aIter, &(aResult->mType))) {
|
||||
if (!ReadParam(aReader, &(aResult->mId)) ||
|
||||
!ReadParam(aReader, &(aResult->mTimestamp)) ||
|
||||
!ReadParam(aReader, &(aResult->mType))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -177,41 +176,40 @@ template <>
|
||||
struct ParamTraits<mozilla::dom::RTCIceCandidatePairStats> {
|
||||
typedef mozilla::dom::RTCIceCandidatePairStats paramType;
|
||||
|
||||
static void Write(Message* aMsg, const paramType& aParam) {
|
||||
WriteParam(aMsg, aParam.mTransportId);
|
||||
WriteParam(aMsg, aParam.mLocalCandidateId);
|
||||
WriteParam(aMsg, aParam.mPriority);
|
||||
WriteParam(aMsg, aParam.mNominated);
|
||||
WriteParam(aMsg, aParam.mWritable);
|
||||
WriteParam(aMsg, aParam.mReadable);
|
||||
WriteParam(aMsg, aParam.mRemoteCandidateId);
|
||||
WriteParam(aMsg, aParam.mSelected);
|
||||
WriteParam(aMsg, aParam.mComponentId);
|
||||
WriteParam(aMsg, aParam.mState);
|
||||
WriteParam(aMsg, aParam.mBytesSent);
|
||||
WriteParam(aMsg, aParam.mBytesReceived);
|
||||
WriteParam(aMsg, aParam.mLastPacketSentTimestamp);
|
||||
WriteParam(aMsg, aParam.mLastPacketReceivedTimestamp);
|
||||
WriteRTCStats(aMsg, aParam);
|
||||
static void Write(MessageWriter* aWriter, const paramType& aParam) {
|
||||
WriteParam(aWriter, aParam.mTransportId);
|
||||
WriteParam(aWriter, aParam.mLocalCandidateId);
|
||||
WriteParam(aWriter, aParam.mPriority);
|
||||
WriteParam(aWriter, aParam.mNominated);
|
||||
WriteParam(aWriter, aParam.mWritable);
|
||||
WriteParam(aWriter, aParam.mReadable);
|
||||
WriteParam(aWriter, aParam.mRemoteCandidateId);
|
||||
WriteParam(aWriter, aParam.mSelected);
|
||||
WriteParam(aWriter, aParam.mComponentId);
|
||||
WriteParam(aWriter, aParam.mState);
|
||||
WriteParam(aWriter, aParam.mBytesSent);
|
||||
WriteParam(aWriter, aParam.mBytesReceived);
|
||||
WriteParam(aWriter, aParam.mLastPacketSentTimestamp);
|
||||
WriteParam(aWriter, aParam.mLastPacketReceivedTimestamp);
|
||||
WriteRTCStats(aWriter, aParam);
|
||||
}
|
||||
|
||||
static bool Read(const Message* aMsg, PickleIterator* aIter,
|
||||
paramType* aResult) {
|
||||
if (!ReadParam(aMsg, aIter, &(aResult->mTransportId)) ||
|
||||
!ReadParam(aMsg, aIter, &(aResult->mLocalCandidateId)) ||
|
||||
!ReadParam(aMsg, aIter, &(aResult->mPriority)) ||
|
||||
!ReadParam(aMsg, aIter, &(aResult->mNominated)) ||
|
||||
!ReadParam(aMsg, aIter, &(aResult->mWritable)) ||
|
||||
!ReadParam(aMsg, aIter, &(aResult->mReadable)) ||
|
||||
!ReadParam(aMsg, aIter, &(aResult->mRemoteCandidateId)) ||
|
||||
!ReadParam(aMsg, aIter, &(aResult->mSelected)) ||
|
||||
!ReadParam(aMsg, aIter, &(aResult->mComponentId)) ||
|
||||
!ReadParam(aMsg, aIter, &(aResult->mState)) ||
|
||||
!ReadParam(aMsg, aIter, &(aResult->mBytesSent)) ||
|
||||
!ReadParam(aMsg, aIter, &(aResult->mBytesReceived)) ||
|
||||
!ReadParam(aMsg, aIter, &(aResult->mLastPacketSentTimestamp)) ||
|
||||
!ReadParam(aMsg, aIter, &(aResult->mLastPacketReceivedTimestamp)) ||
|
||||
!ReadRTCStats(aMsg, aIter, aResult)) {
|
||||
static bool Read(MessageReader* aReader, paramType* aResult) {
|
||||
if (!ReadParam(aReader, &(aResult->mTransportId)) ||
|
||||
!ReadParam(aReader, &(aResult->mLocalCandidateId)) ||
|
||||
!ReadParam(aReader, &(aResult->mPriority)) ||
|
||||
!ReadParam(aReader, &(aResult->mNominated)) ||
|
||||
!ReadParam(aReader, &(aResult->mWritable)) ||
|
||||
!ReadParam(aReader, &(aResult->mReadable)) ||
|
||||
!ReadParam(aReader, &(aResult->mRemoteCandidateId)) ||
|
||||
!ReadParam(aReader, &(aResult->mSelected)) ||
|
||||
!ReadParam(aReader, &(aResult->mComponentId)) ||
|
||||
!ReadParam(aReader, &(aResult->mState)) ||
|
||||
!ReadParam(aReader, &(aResult->mBytesSent)) ||
|
||||
!ReadParam(aReader, &(aResult->mBytesReceived)) ||
|
||||
!ReadParam(aReader, &(aResult->mLastPacketSentTimestamp)) ||
|
||||
!ReadParam(aReader, &(aResult->mLastPacketReceivedTimestamp)) ||
|
||||
!ReadRTCStats(aReader, aResult)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -223,29 +221,28 @@ template <>
|
||||
struct ParamTraits<mozilla::dom::RTCIceCandidateStats> {
|
||||
typedef mozilla::dom::RTCIceCandidateStats paramType;
|
||||
|
||||
static void Write(Message* aMsg, const paramType& aParam) {
|
||||
WriteParam(aMsg, aParam.mCandidateType);
|
||||
WriteParam(aMsg, aParam.mPriority);
|
||||
WriteParam(aMsg, aParam.mTransportId);
|
||||
WriteParam(aMsg, aParam.mAddress);
|
||||
WriteParam(aMsg, aParam.mRelayProtocol);
|
||||
WriteParam(aMsg, aParam.mPort);
|
||||
WriteParam(aMsg, aParam.mProtocol);
|
||||
WriteParam(aMsg, aParam.mProxied);
|
||||
WriteRTCStats(aMsg, aParam);
|
||||
static void Write(MessageWriter* aWriter, const paramType& aParam) {
|
||||
WriteParam(aWriter, aParam.mCandidateType);
|
||||
WriteParam(aWriter, aParam.mPriority);
|
||||
WriteParam(aWriter, aParam.mTransportId);
|
||||
WriteParam(aWriter, aParam.mAddress);
|
||||
WriteParam(aWriter, aParam.mRelayProtocol);
|
||||
WriteParam(aWriter, aParam.mPort);
|
||||
WriteParam(aWriter, aParam.mProtocol);
|
||||
WriteParam(aWriter, aParam.mProxied);
|
||||
WriteRTCStats(aWriter, aParam);
|
||||
}
|
||||
|
||||
static bool Read(const Message* aMsg, PickleIterator* aIter,
|
||||
paramType* aResult) {
|
||||
if (!ReadParam(aMsg, aIter, &(aResult->mCandidateType)) ||
|
||||
!ReadParam(aMsg, aIter, &(aResult->mPriority)) ||
|
||||
!ReadParam(aMsg, aIter, &(aResult->mTransportId)) ||
|
||||
!ReadParam(aMsg, aIter, &(aResult->mAddress)) ||
|
||||
!ReadParam(aMsg, aIter, &(aResult->mRelayProtocol)) ||
|
||||
!ReadParam(aMsg, aIter, &(aResult->mPort)) ||
|
||||
!ReadParam(aMsg, aIter, &(aResult->mProtocol)) ||
|
||||
!ReadParam(aMsg, aIter, &(aResult->mProxied)) ||
|
||||
!ReadRTCStats(aMsg, aIter, aResult)) {
|
||||
static bool Read(MessageReader* aReader, paramType* aResult) {
|
||||
if (!ReadParam(aReader, &(aResult->mCandidateType)) ||
|
||||
!ReadParam(aReader, &(aResult->mPriority)) ||
|
||||
!ReadParam(aReader, &(aResult->mTransportId)) ||
|
||||
!ReadParam(aReader, &(aResult->mAddress)) ||
|
||||
!ReadParam(aReader, &(aResult->mRelayProtocol)) ||
|
||||
!ReadParam(aReader, &(aResult->mPort)) ||
|
||||
!ReadParam(aReader, &(aResult->mProtocol)) ||
|
||||
!ReadParam(aReader, &(aResult->mProxied)) ||
|
||||
!ReadRTCStats(aReader, aResult)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -254,110 +251,107 @@ struct ParamTraits<mozilla::dom::RTCIceCandidateStats> {
|
||||
};
|
||||
|
||||
static void WriteRTCRtpStreamStats(
|
||||
Message* aMsg, const mozilla::dom::RTCRtpStreamStats& aParam) {
|
||||
WriteParam(aMsg, aParam.mSsrc);
|
||||
WriteParam(aMsg, aParam.mMediaType);
|
||||
WriteParam(aMsg, aParam.mKind);
|
||||
WriteParam(aMsg, aParam.mTransportId);
|
||||
WriteParam(aMsg, aParam.mCodecId);
|
||||
WriteRTCStats(aMsg, aParam);
|
||||
MessageWriter* aWriter, const mozilla::dom::RTCRtpStreamStats& aParam) {
|
||||
WriteParam(aWriter, aParam.mSsrc);
|
||||
WriteParam(aWriter, aParam.mMediaType);
|
||||
WriteParam(aWriter, aParam.mKind);
|
||||
WriteParam(aWriter, aParam.mTransportId);
|
||||
WriteParam(aWriter, aParam.mCodecId);
|
||||
WriteRTCStats(aWriter, aParam);
|
||||
}
|
||||
|
||||
static bool ReadRTCRtpStreamStats(const Message* aMsg, PickleIterator* aIter,
|
||||
static bool ReadRTCRtpStreamStats(MessageReader* aReader,
|
||||
mozilla::dom::RTCRtpStreamStats* aResult) {
|
||||
return ReadParam(aMsg, aIter, &(aResult->mSsrc)) &&
|
||||
ReadParam(aMsg, aIter, &(aResult->mMediaType)) &&
|
||||
ReadParam(aMsg, aIter, &(aResult->mKind)) &&
|
||||
ReadParam(aMsg, aIter, &(aResult->mTransportId)) &&
|
||||
ReadParam(aMsg, aIter, &(aResult->mCodecId)) &&
|
||||
ReadRTCStats(aMsg, aIter, aResult);
|
||||
return ReadParam(aReader, &(aResult->mSsrc)) &&
|
||||
ReadParam(aReader, &(aResult->mMediaType)) &&
|
||||
ReadParam(aReader, &(aResult->mKind)) &&
|
||||
ReadParam(aReader, &(aResult->mTransportId)) &&
|
||||
ReadParam(aReader, &(aResult->mCodecId)) &&
|
||||
ReadRTCStats(aReader, aResult);
|
||||
}
|
||||
|
||||
static void WriteRTCReceivedRtpStreamStats(
|
||||
Message* aMsg, const mozilla::dom::RTCReceivedRtpStreamStats& aParam) {
|
||||
WriteParam(aMsg, aParam.mPacketsReceived);
|
||||
WriteParam(aMsg, aParam.mPacketsLost);
|
||||
WriteParam(aMsg, aParam.mJitter);
|
||||
WriteParam(aMsg, aParam.mDiscardedPackets);
|
||||
WriteParam(aMsg, aParam.mPacketsDiscarded);
|
||||
WriteRTCRtpStreamStats(aMsg, aParam);
|
||||
MessageWriter* aWriter,
|
||||
const mozilla::dom::RTCReceivedRtpStreamStats& aParam) {
|
||||
WriteParam(aWriter, aParam.mPacketsReceived);
|
||||
WriteParam(aWriter, aParam.mPacketsLost);
|
||||
WriteParam(aWriter, aParam.mJitter);
|
||||
WriteParam(aWriter, aParam.mDiscardedPackets);
|
||||
WriteParam(aWriter, aParam.mPacketsDiscarded);
|
||||
WriteRTCRtpStreamStats(aWriter, aParam);
|
||||
}
|
||||
|
||||
static bool ReadRTCReceivedRtpStreamStats(
|
||||
const Message* aMsg, PickleIterator* aIter,
|
||||
mozilla::dom::RTCReceivedRtpStreamStats* aResult) {
|
||||
return ReadParam(aMsg, aIter, &(aResult->mPacketsReceived)) &&
|
||||
ReadParam(aMsg, aIter, &(aResult->mPacketsLost)) &&
|
||||
ReadParam(aMsg, aIter, &(aResult->mJitter)) &&
|
||||
ReadParam(aMsg, aIter, &(aResult->mDiscardedPackets)) &&
|
||||
ReadParam(aMsg, aIter, &(aResult->mPacketsDiscarded)) &&
|
||||
ReadRTCRtpStreamStats(aMsg, aIter, aResult);
|
||||
MessageReader* aReader, mozilla::dom::RTCReceivedRtpStreamStats* aResult) {
|
||||
return ReadParam(aReader, &(aResult->mPacketsReceived)) &&
|
||||
ReadParam(aReader, &(aResult->mPacketsLost)) &&
|
||||
ReadParam(aReader, &(aResult->mJitter)) &&
|
||||
ReadParam(aReader, &(aResult->mDiscardedPackets)) &&
|
||||
ReadParam(aReader, &(aResult->mPacketsDiscarded)) &&
|
||||
ReadRTCRtpStreamStats(aReader, aResult);
|
||||
}
|
||||
|
||||
template <>
|
||||
struct ParamTraits<mozilla::dom::RTCInboundRtpStreamStats> {
|
||||
typedef mozilla::dom::RTCInboundRtpStreamStats paramType;
|
||||
|
||||
static void Write(Message* aMsg, const paramType& aParam) {
|
||||
WriteParam(aMsg, aParam.mRemoteId);
|
||||
WriteParam(aMsg, aParam.mFramesDecoded);
|
||||
WriteParam(aMsg, aParam.mBytesReceived);
|
||||
WriteParam(aMsg, aParam.mNackCount);
|
||||
WriteParam(aMsg, aParam.mFirCount);
|
||||
WriteParam(aMsg, aParam.mPliCount);
|
||||
WriteRTCReceivedRtpStreamStats(aMsg, aParam);
|
||||
static void Write(MessageWriter* aWriter, const paramType& aParam) {
|
||||
WriteParam(aWriter, aParam.mRemoteId);
|
||||
WriteParam(aWriter, aParam.mFramesDecoded);
|
||||
WriteParam(aWriter, aParam.mBytesReceived);
|
||||
WriteParam(aWriter, aParam.mNackCount);
|
||||
WriteParam(aWriter, aParam.mFirCount);
|
||||
WriteParam(aWriter, aParam.mPliCount);
|
||||
WriteRTCReceivedRtpStreamStats(aWriter, aParam);
|
||||
}
|
||||
|
||||
static bool Read(const Message* aMsg, PickleIterator* aIter,
|
||||
paramType* aResult) {
|
||||
return ReadParam(aMsg, aIter, &(aResult->mRemoteId)) &&
|
||||
ReadParam(aMsg, aIter, &(aResult->mFramesDecoded)) &&
|
||||
ReadParam(aMsg, aIter, &(aResult->mBytesReceived)) &&
|
||||
ReadParam(aMsg, aIter, &(aResult->mNackCount)) &&
|
||||
ReadParam(aMsg, aIter, &(aResult->mFirCount)) &&
|
||||
ReadParam(aMsg, aIter, &(aResult->mPliCount)) &&
|
||||
ReadRTCReceivedRtpStreamStats(aMsg, aIter, aResult);
|
||||
static bool Read(MessageReader* aReader, paramType* aResult) {
|
||||
return ReadParam(aReader, &(aResult->mRemoteId)) &&
|
||||
ReadParam(aReader, &(aResult->mFramesDecoded)) &&
|
||||
ReadParam(aReader, &(aResult->mBytesReceived)) &&
|
||||
ReadParam(aReader, &(aResult->mNackCount)) &&
|
||||
ReadParam(aReader, &(aResult->mFirCount)) &&
|
||||
ReadParam(aReader, &(aResult->mPliCount)) &&
|
||||
ReadRTCReceivedRtpStreamStats(aReader, aResult);
|
||||
}
|
||||
};
|
||||
|
||||
static void WriteRTCSentRtpStreamStats(
|
||||
Message* aMsg, const mozilla::dom::RTCSentRtpStreamStats& aParam) {
|
||||
WriteParam(aMsg, aParam.mPacketsSent);
|
||||
WriteParam(aMsg, aParam.mBytesSent);
|
||||
WriteRTCRtpStreamStats(aMsg, aParam);
|
||||
MessageWriter* aWriter, const mozilla::dom::RTCSentRtpStreamStats& aParam) {
|
||||
WriteParam(aWriter, aParam.mPacketsSent);
|
||||
WriteParam(aWriter, aParam.mBytesSent);
|
||||
WriteRTCRtpStreamStats(aWriter, aParam);
|
||||
}
|
||||
|
||||
static bool ReadRTCSentRtpStreamStats(
|
||||
const Message* aMsg, PickleIterator* aIter,
|
||||
mozilla::dom::RTCSentRtpStreamStats* aResult) {
|
||||
return ReadParam(aMsg, aIter, &(aResult->mPacketsSent)) &&
|
||||
ReadParam(aMsg, aIter, &(aResult->mBytesSent)) &&
|
||||
ReadRTCRtpStreamStats(aMsg, aIter, aResult);
|
||||
MessageReader* aReader, mozilla::dom::RTCSentRtpStreamStats* aResult) {
|
||||
return ReadParam(aReader, &(aResult->mPacketsSent)) &&
|
||||
ReadParam(aReader, &(aResult->mBytesSent)) &&
|
||||
ReadRTCRtpStreamStats(aReader, aResult);
|
||||
}
|
||||
|
||||
template <>
|
||||
struct ParamTraits<mozilla::dom::RTCOutboundRtpStreamStats> {
|
||||
typedef mozilla::dom::RTCOutboundRtpStreamStats paramType;
|
||||
|
||||
static void Write(Message* aMsg, const paramType& aParam) {
|
||||
WriteParam(aMsg, aParam.mRemoteId);
|
||||
WriteParam(aMsg, aParam.mFramesEncoded);
|
||||
WriteParam(aMsg, aParam.mQpSum);
|
||||
WriteParam(aMsg, aParam.mNackCount);
|
||||
WriteParam(aMsg, aParam.mFirCount);
|
||||
WriteParam(aMsg, aParam.mPliCount);
|
||||
WriteRTCSentRtpStreamStats(aMsg, aParam);
|
||||
static void Write(MessageWriter* aWriter, const paramType& aParam) {
|
||||
WriteParam(aWriter, aParam.mRemoteId);
|
||||
WriteParam(aWriter, aParam.mFramesEncoded);
|
||||
WriteParam(aWriter, aParam.mQpSum);
|
||||
WriteParam(aWriter, aParam.mNackCount);
|
||||
WriteParam(aWriter, aParam.mFirCount);
|
||||
WriteParam(aWriter, aParam.mPliCount);
|
||||
WriteRTCSentRtpStreamStats(aWriter, aParam);
|
||||
}
|
||||
|
||||
static bool Read(const Message* aMsg, PickleIterator* aIter,
|
||||
paramType* aResult) {
|
||||
return ReadParam(aMsg, aIter, &(aResult->mRemoteId)) &&
|
||||
ReadParam(aMsg, aIter, &(aResult->mFramesEncoded)) &&
|
||||
ReadParam(aMsg, aIter, &(aResult->mQpSum)) &&
|
||||
ReadParam(aMsg, aIter, &(aResult->mNackCount)) &&
|
||||
ReadParam(aMsg, aIter, &(aResult->mFirCount)) &&
|
||||
ReadParam(aMsg, aIter, &(aResult->mPliCount)) &&
|
||||
ReadRTCSentRtpStreamStats(aMsg, aIter, aResult);
|
||||
static bool Read(MessageReader* aReader, paramType* aResult) {
|
||||
return ReadParam(aReader, &(aResult->mRemoteId)) &&
|
||||
ReadParam(aReader, &(aResult->mFramesEncoded)) &&
|
||||
ReadParam(aReader, &(aResult->mQpSum)) &&
|
||||
ReadParam(aReader, &(aResult->mNackCount)) &&
|
||||
ReadParam(aReader, &(aResult->mFirCount)) &&
|
||||
ReadParam(aReader, &(aResult->mPliCount)) &&
|
||||
ReadRTCSentRtpStreamStats(aReader, aResult);
|
||||
}
|
||||
};
|
||||
|
||||
@ -365,17 +359,16 @@ template <>
|
||||
struct ParamTraits<mozilla::dom::RTCRemoteInboundRtpStreamStats> {
|
||||
typedef mozilla::dom::RTCRemoteInboundRtpStreamStats paramType;
|
||||
|
||||
static void Write(Message* aMsg, const paramType& aParam) {
|
||||
WriteParam(aMsg, aParam.mLocalId);
|
||||
WriteParam(aMsg, aParam.mRoundTripTime);
|
||||
WriteRTCReceivedRtpStreamStats(aMsg, aParam);
|
||||
static void Write(MessageWriter* aWriter, const paramType& aParam) {
|
||||
WriteParam(aWriter, aParam.mLocalId);
|
||||
WriteParam(aWriter, aParam.mRoundTripTime);
|
||||
WriteRTCReceivedRtpStreamStats(aWriter, aParam);
|
||||
}
|
||||
|
||||
static bool Read(const Message* aMsg, PickleIterator* aIter,
|
||||
paramType* aResult) {
|
||||
return ReadParam(aMsg, aIter, &(aResult->mLocalId)) &&
|
||||
ReadParam(aMsg, aIter, &(aResult->mRoundTripTime)) &&
|
||||
ReadRTCReceivedRtpStreamStats(aMsg, aIter, aResult);
|
||||
static bool Read(MessageReader* aReader, paramType* aResult) {
|
||||
return ReadParam(aReader, &(aResult->mLocalId)) &&
|
||||
ReadParam(aReader, &(aResult->mRoundTripTime)) &&
|
||||
ReadRTCReceivedRtpStreamStats(aReader, aResult);
|
||||
}
|
||||
};
|
||||
|
||||
@ -383,17 +376,16 @@ template <>
|
||||
struct ParamTraits<mozilla::dom::RTCRemoteOutboundRtpStreamStats> {
|
||||
typedef mozilla::dom::RTCRemoteOutboundRtpStreamStats paramType;
|
||||
|
||||
static void Write(Message* aMsg, const paramType& aParam) {
|
||||
WriteParam(aMsg, aParam.mLocalId);
|
||||
WriteParam(aMsg, aParam.mRemoteTimestamp);
|
||||
WriteRTCSentRtpStreamStats(aMsg, aParam);
|
||||
static void Write(MessageWriter* aWriter, const paramType& aParam) {
|
||||
WriteParam(aWriter, aParam.mLocalId);
|
||||
WriteParam(aWriter, aParam.mRemoteTimestamp);
|
||||
WriteRTCSentRtpStreamStats(aWriter, aParam);
|
||||
}
|
||||
|
||||
static bool Read(const Message* aMsg, PickleIterator* aIter,
|
||||
paramType* aResult) {
|
||||
return ReadParam(aMsg, aIter, &(aResult->mLocalId)) &&
|
||||
ReadParam(aMsg, aIter, &(aResult->mRemoteTimestamp)) &&
|
||||
ReadRTCSentRtpStreamStats(aMsg, aIter, aResult);
|
||||
static bool Read(MessageReader* aReader, paramType* aResult) {
|
||||
return ReadParam(aReader, &(aResult->mLocalId)) &&
|
||||
ReadParam(aReader, &(aResult->mRemoteTimestamp)) &&
|
||||
ReadRTCSentRtpStreamStats(aReader, aResult);
|
||||
}
|
||||
};
|
||||
|
||||
@ -401,17 +393,16 @@ template <>
|
||||
struct ParamTraits<mozilla::dom::RTCRTPContributingSourceStats> {
|
||||
typedef mozilla::dom::RTCRTPContributingSourceStats paramType;
|
||||
|
||||
static void Write(Message* aMsg, const paramType& aParam) {
|
||||
WriteParam(aMsg, aParam.mContributorSsrc);
|
||||
WriteParam(aMsg, aParam.mInboundRtpStreamId);
|
||||
WriteRTCStats(aMsg, aParam);
|
||||
static void Write(MessageWriter* aWriter, const paramType& aParam) {
|
||||
WriteParam(aWriter, aParam.mContributorSsrc);
|
||||
WriteParam(aWriter, aParam.mInboundRtpStreamId);
|
||||
WriteRTCStats(aWriter, aParam);
|
||||
}
|
||||
|
||||
static bool Read(const Message* aMsg, PickleIterator* aIter,
|
||||
paramType* aResult) {
|
||||
if (!ReadParam(aMsg, aIter, &(aResult->mContributorSsrc)) ||
|
||||
!ReadParam(aMsg, aIter, &(aResult->mInboundRtpStreamId)) ||
|
||||
!ReadRTCStats(aMsg, aIter, aResult)) {
|
||||
static bool Read(MessageReader* aReader, paramType* aResult) {
|
||||
if (!ReadParam(aReader, &(aResult->mContributorSsrc)) ||
|
||||
!ReadParam(aReader, &(aResult->mInboundRtpStreamId)) ||
|
||||
!ReadRTCStats(aReader, aResult)) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
@ -30,22 +30,21 @@ struct ParamTraits<mozilla::dom::OwningStringOrStringSequence> {
|
||||
// private generated code. So we have to re-create it.
|
||||
enum Type { kUninitialized, kString, kStringSequence };
|
||||
|
||||
static void Write(Message* aMsg, const paramType& aParam) {
|
||||
static void Write(MessageWriter* aWriter, const paramType& aParam) {
|
||||
if (aParam.IsString()) {
|
||||
aMsg->WriteInt16(kString);
|
||||
WriteParam(aMsg, aParam.GetAsString());
|
||||
aWriter->WriteInt16(kString);
|
||||
WriteParam(aWriter, aParam.GetAsString());
|
||||
} else if (aParam.IsStringSequence()) {
|
||||
aMsg->WriteInt16(kStringSequence);
|
||||
WriteParam(aMsg, aParam.GetAsStringSequence());
|
||||
aWriter->WriteInt16(kStringSequence);
|
||||
WriteParam(aWriter, aParam.GetAsStringSequence());
|
||||
} else {
|
||||
aMsg->WriteInt16(kUninitialized);
|
||||
aWriter->WriteInt16(kUninitialized);
|
||||
}
|
||||
}
|
||||
|
||||
static bool Read(const Message* aMsg, PickleIterator* aIter,
|
||||
paramType* aResult) {
|
||||
static bool Read(MessageReader* aReader, paramType* aResult) {
|
||||
int16_t type;
|
||||
if (!aMsg->ReadInt16(aIter, &type)) {
|
||||
if (!aReader->ReadInt16(&type)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -54,9 +53,9 @@ struct ParamTraits<mozilla::dom::OwningStringOrStringSequence> {
|
||||
aResult->Uninit();
|
||||
return true;
|
||||
case kString:
|
||||
return ReadParam(aMsg, aIter, &aResult->SetAsString());
|
||||
return ReadParam(aReader, &aResult->SetAsString());
|
||||
case kStringSequence:
|
||||
return ReadParam(aMsg, aIter, &aResult->SetAsStringSequence());
|
||||
return ReadParam(aReader, &aResult->SetAsStringSequence());
|
||||
}
|
||||
|
||||
return false;
|
||||
|
@ -20,22 +20,22 @@ namespace IPC {
|
||||
|
||||
template <>
|
||||
struct ParamTraits<mozilla::NrIceStunAddr> {
|
||||
static void Write(Message* aMsg, const mozilla::NrIceStunAddr& aParam) {
|
||||
static void Write(MessageWriter* aWriter,
|
||||
const mozilla::NrIceStunAddr& aParam) {
|
||||
#ifdef MOZ_WEBRTC
|
||||
const size_t bufSize = aParam.SerializationBufferSize();
|
||||
char* buffer = new char[bufSize];
|
||||
aParam.Serialize(buffer, bufSize);
|
||||
aMsg->WriteBytes((void*)buffer, bufSize);
|
||||
aWriter->WriteBytes((void*)buffer, bufSize);
|
||||
delete[] buffer;
|
||||
#endif
|
||||
}
|
||||
|
||||
static bool Read(const Message* aMsg, PickleIterator* aIter,
|
||||
mozilla::NrIceStunAddr* aResult) {
|
||||
static bool Read(MessageReader* aReader, mozilla::NrIceStunAddr* aResult) {
|
||||
#ifdef MOZ_WEBRTC
|
||||
const size_t bufSize = aResult->SerializationBufferSize();
|
||||
char* buffer = new char[bufSize];
|
||||
bool result = aMsg->ReadBytesInto(aIter, (void*)buffer, bufSize);
|
||||
bool result = aReader->ReadBytesInto((void*)buffer, bufSize);
|
||||
|
||||
if (result) {
|
||||
result = result && (NS_OK == aResult->Deserialize(buffer, bufSize));
|
||||
|
@ -26,34 +26,34 @@ void MediaPacket::Copy(const uint8_t* data, size_t len, size_t capacity) {
|
||||
memcpy(data_.get(), data, len);
|
||||
}
|
||||
|
||||
void MediaPacket::Serialize(IPC::Message* aMsg) const {
|
||||
aMsg->WriteUInt32(len_);
|
||||
aMsg->WriteUInt32(capacity_);
|
||||
void MediaPacket::Serialize(IPC::MessageWriter* aWriter) const {
|
||||
aWriter->WriteUInt32(len_);
|
||||
aWriter->WriteUInt32(capacity_);
|
||||
if (len_) {
|
||||
aMsg->WriteBytes(data_.get(), len_);
|
||||
aWriter->WriteBytes(data_.get(), len_);
|
||||
}
|
||||
aMsg->WriteUInt32(encrypted_len_);
|
||||
aWriter->WriteUInt32(encrypted_len_);
|
||||
if (encrypted_len_) {
|
||||
aMsg->WriteBytes(encrypted_data_.get(), encrypted_len_);
|
||||
aWriter->WriteBytes(encrypted_data_.get(), encrypted_len_);
|
||||
}
|
||||
aMsg->WriteInt32(sdp_level_.isSome() ? *sdp_level_ : -1);
|
||||
aMsg->WriteInt32(type_);
|
||||
aWriter->WriteInt32(sdp_level_.isSome() ? *sdp_level_ : -1);
|
||||
aWriter->WriteInt32(type_);
|
||||
}
|
||||
|
||||
bool MediaPacket::Deserialize(const IPC::Message* aMsg, PickleIterator* aIter) {
|
||||
bool MediaPacket::Deserialize(IPC::MessageReader* aReader) {
|
||||
Reset();
|
||||
uint32_t len;
|
||||
if (!aMsg->ReadUInt32(aIter, &len)) {
|
||||
if (!aReader->ReadUInt32(&len)) {
|
||||
return false;
|
||||
}
|
||||
uint32_t capacity;
|
||||
if (!aMsg->ReadUInt32(aIter, &capacity)) {
|
||||
if (!aReader->ReadUInt32(&capacity)) {
|
||||
return false;
|
||||
}
|
||||
if (len) {
|
||||
MOZ_RELEASE_ASSERT(capacity >= len);
|
||||
UniquePtr<uint8_t[]> data(new uint8_t[capacity]);
|
||||
if (!aMsg->ReadBytesInto(aIter, data.get(), len)) {
|
||||
if (!aReader->ReadBytesInto(data.get(), len)) {
|
||||
return false;
|
||||
}
|
||||
data_ = std::move(data);
|
||||
@ -61,12 +61,12 @@ bool MediaPacket::Deserialize(const IPC::Message* aMsg, PickleIterator* aIter) {
|
||||
capacity_ = capacity;
|
||||
}
|
||||
|
||||
if (!aMsg->ReadUInt32(aIter, &len)) {
|
||||
if (!aReader->ReadUInt32(&len)) {
|
||||
return false;
|
||||
}
|
||||
if (len) {
|
||||
UniquePtr<uint8_t[]> data(new uint8_t[len]);
|
||||
if (!aMsg->ReadBytesInto(aIter, data.get(), len)) {
|
||||
if (!aReader->ReadBytesInto(data.get(), len)) {
|
||||
return false;
|
||||
}
|
||||
encrypted_data_ = std::move(data);
|
||||
@ -74,7 +74,7 @@ bool MediaPacket::Deserialize(const IPC::Message* aMsg, PickleIterator* aIter) {
|
||||
}
|
||||
|
||||
int32_t sdp_level;
|
||||
if (!aMsg->ReadInt32(aIter, &sdp_level)) {
|
||||
if (!aReader->ReadInt32(&sdp_level)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -83,7 +83,7 @@ bool MediaPacket::Deserialize(const IPC::Message* aMsg, PickleIterator* aIter) {
|
||||
}
|
||||
|
||||
int32_t type;
|
||||
if (!aMsg->ReadInt32(aIter, &type)) {
|
||||
if (!aReader->ReadInt32(&type)) {
|
||||
return false;
|
||||
}
|
||||
type_ = static_cast<Type>(type);
|
||||
|
@ -80,8 +80,8 @@ class MediaPacket {
|
||||
|
||||
Type type() const { return type_; }
|
||||
|
||||
void Serialize(IPC::Message* aMsg) const;
|
||||
bool Deserialize(const IPC::Message* aMsg, PickleIterator* aIter);
|
||||
void Serialize(IPC::MessageWriter* aWriter) const;
|
||||
bool Deserialize(IPC::MessageReader* aReader);
|
||||
|
||||
private:
|
||||
UniquePtr<uint8_t[]> data_;
|
||||
@ -102,13 +102,13 @@ struct ParamTraits;
|
||||
|
||||
template <>
|
||||
struct ParamTraits<mozilla::MediaPacket> {
|
||||
static void Write(Message* aMsg, const mozilla::MediaPacket& aParam) {
|
||||
aParam.Serialize(aMsg);
|
||||
static void Write(MessageWriter* aWriter,
|
||||
const mozilla::MediaPacket& aParam) {
|
||||
aParam.Serialize(aWriter);
|
||||
}
|
||||
|
||||
static bool Read(const Message* aMsg, PickleIterator* aIter,
|
||||
mozilla::MediaPacket* aResult) {
|
||||
return aResult->Deserialize(aMsg, aIter);
|
||||
static bool Read(MessageReader* aReader, mozilla::MediaPacket* aResult) {
|
||||
return aResult->Deserialize(aReader);
|
||||
}
|
||||
};
|
||||
} // namespace IPC
|
||||
|
@ -428,127 +428,126 @@ namespace ipc {
|
||||
template <>
|
||||
struct IPDLParamTraits<mozilla::dom::PerformanceTimingData> {
|
||||
using paramType = mozilla::dom::PerformanceTimingData;
|
||||
static void Write(IPC::Message* aMsg, IProtocol* aActor,
|
||||
static void Write(IPC::MessageWriter* aWriter, IProtocol* aActor,
|
||||
const paramType& aParam) {
|
||||
WriteIPDLParam(aMsg, aActor, aParam.mServerTiming);
|
||||
WriteIPDLParam(aMsg, aActor, aParam.mNextHopProtocol);
|
||||
WriteIPDLParam(aMsg, aActor, aParam.mAsyncOpen);
|
||||
WriteIPDLParam(aMsg, aActor, aParam.mRedirectStart);
|
||||
WriteIPDLParam(aMsg, aActor, aParam.mRedirectEnd);
|
||||
WriteIPDLParam(aMsg, aActor, aParam.mDomainLookupStart);
|
||||
WriteIPDLParam(aMsg, aActor, aParam.mDomainLookupEnd);
|
||||
WriteIPDLParam(aMsg, aActor, aParam.mConnectStart);
|
||||
WriteIPDLParam(aMsg, aActor, aParam.mSecureConnectionStart);
|
||||
WriteIPDLParam(aMsg, aActor, aParam.mConnectEnd);
|
||||
WriteIPDLParam(aMsg, aActor, aParam.mRequestStart);
|
||||
WriteIPDLParam(aMsg, aActor, aParam.mResponseStart);
|
||||
WriteIPDLParam(aMsg, aActor, aParam.mCacheReadStart);
|
||||
WriteIPDLParam(aMsg, aActor, aParam.mResponseEnd);
|
||||
WriteIPDLParam(aMsg, aActor, aParam.mCacheReadEnd);
|
||||
WriteIPDLParam(aMsg, aActor, aParam.mWorkerStart);
|
||||
WriteIPDLParam(aMsg, aActor, aParam.mWorkerRequestStart);
|
||||
WriteIPDLParam(aMsg, aActor, aParam.mWorkerResponseEnd);
|
||||
WriteIPDLParam(aMsg, aActor, aParam.mZeroTime);
|
||||
WriteIPDLParam(aMsg, aActor, aParam.mFetchStart);
|
||||
WriteIPDLParam(aMsg, aActor, aParam.mEncodedBodySize);
|
||||
WriteIPDLParam(aMsg, aActor, aParam.mTransferSize);
|
||||
WriteIPDLParam(aMsg, aActor, aParam.mDecodedBodySize);
|
||||
WriteIPDLParam(aMsg, aActor, aParam.mRedirectCount);
|
||||
WriteIPDLParam(aMsg, aActor, aParam.mAllRedirectsSameOrigin);
|
||||
WriteIPDLParam(aMsg, aActor, aParam.mAllRedirectsPassTAO);
|
||||
WriteIPDLParam(aMsg, aActor, aParam.mSecureConnection);
|
||||
WriteIPDLParam(aMsg, aActor, aParam.mTimingAllowed);
|
||||
WriteIPDLParam(aMsg, aActor, aParam.mInitialized);
|
||||
WriteIPDLParam(aWriter, aActor, aParam.mServerTiming);
|
||||
WriteIPDLParam(aWriter, aActor, aParam.mNextHopProtocol);
|
||||
WriteIPDLParam(aWriter, aActor, aParam.mAsyncOpen);
|
||||
WriteIPDLParam(aWriter, aActor, aParam.mRedirectStart);
|
||||
WriteIPDLParam(aWriter, aActor, aParam.mRedirectEnd);
|
||||
WriteIPDLParam(aWriter, aActor, aParam.mDomainLookupStart);
|
||||
WriteIPDLParam(aWriter, aActor, aParam.mDomainLookupEnd);
|
||||
WriteIPDLParam(aWriter, aActor, aParam.mConnectStart);
|
||||
WriteIPDLParam(aWriter, aActor, aParam.mSecureConnectionStart);
|
||||
WriteIPDLParam(aWriter, aActor, aParam.mConnectEnd);
|
||||
WriteIPDLParam(aWriter, aActor, aParam.mRequestStart);
|
||||
WriteIPDLParam(aWriter, aActor, aParam.mResponseStart);
|
||||
WriteIPDLParam(aWriter, aActor, aParam.mCacheReadStart);
|
||||
WriteIPDLParam(aWriter, aActor, aParam.mResponseEnd);
|
||||
WriteIPDLParam(aWriter, aActor, aParam.mCacheReadEnd);
|
||||
WriteIPDLParam(aWriter, aActor, aParam.mWorkerStart);
|
||||
WriteIPDLParam(aWriter, aActor, aParam.mWorkerRequestStart);
|
||||
WriteIPDLParam(aWriter, aActor, aParam.mWorkerResponseEnd);
|
||||
WriteIPDLParam(aWriter, aActor, aParam.mZeroTime);
|
||||
WriteIPDLParam(aWriter, aActor, aParam.mFetchStart);
|
||||
WriteIPDLParam(aWriter, aActor, aParam.mEncodedBodySize);
|
||||
WriteIPDLParam(aWriter, aActor, aParam.mTransferSize);
|
||||
WriteIPDLParam(aWriter, aActor, aParam.mDecodedBodySize);
|
||||
WriteIPDLParam(aWriter, aActor, aParam.mRedirectCount);
|
||||
WriteIPDLParam(aWriter, aActor, aParam.mAllRedirectsSameOrigin);
|
||||
WriteIPDLParam(aWriter, aActor, aParam.mAllRedirectsPassTAO);
|
||||
WriteIPDLParam(aWriter, aActor, aParam.mSecureConnection);
|
||||
WriteIPDLParam(aWriter, aActor, aParam.mTimingAllowed);
|
||||
WriteIPDLParam(aWriter, aActor, aParam.mInitialized);
|
||||
}
|
||||
|
||||
static bool Read(const IPC::Message* aMsg, PickleIterator* aIter,
|
||||
IProtocol* aActor, paramType* aResult) {
|
||||
if (!ReadIPDLParam(aMsg, aIter, aActor, &aResult->mServerTiming)) {
|
||||
static bool Read(IPC::MessageReader* aReader, IProtocol* aActor,
|
||||
paramType* aResult) {
|
||||
if (!ReadIPDLParam(aReader, aActor, &aResult->mServerTiming)) {
|
||||
return false;
|
||||
}
|
||||
if (!ReadIPDLParam(aMsg, aIter, aActor, &aResult->mNextHopProtocol)) {
|
||||
if (!ReadIPDLParam(aReader, aActor, &aResult->mNextHopProtocol)) {
|
||||
return false;
|
||||
}
|
||||
if (!ReadIPDLParam(aMsg, aIter, aActor, &aResult->mAsyncOpen)) {
|
||||
if (!ReadIPDLParam(aReader, aActor, &aResult->mAsyncOpen)) {
|
||||
return false;
|
||||
}
|
||||
if (!ReadIPDLParam(aMsg, aIter, aActor, &aResult->mRedirectStart)) {
|
||||
if (!ReadIPDLParam(aReader, aActor, &aResult->mRedirectStart)) {
|
||||
return false;
|
||||
}
|
||||
if (!ReadIPDLParam(aMsg, aIter, aActor, &aResult->mRedirectEnd)) {
|
||||
if (!ReadIPDLParam(aReader, aActor, &aResult->mRedirectEnd)) {
|
||||
return false;
|
||||
}
|
||||
if (!ReadIPDLParam(aMsg, aIter, aActor, &aResult->mDomainLookupStart)) {
|
||||
if (!ReadIPDLParam(aReader, aActor, &aResult->mDomainLookupStart)) {
|
||||
return false;
|
||||
}
|
||||
if (!ReadIPDLParam(aMsg, aIter, aActor, &aResult->mDomainLookupEnd)) {
|
||||
if (!ReadIPDLParam(aReader, aActor, &aResult->mDomainLookupEnd)) {
|
||||
return false;
|
||||
}
|
||||
if (!ReadIPDLParam(aMsg, aIter, aActor, &aResult->mConnectStart)) {
|
||||
if (!ReadIPDLParam(aReader, aActor, &aResult->mConnectStart)) {
|
||||
return false;
|
||||
}
|
||||
if (!ReadIPDLParam(aMsg, aIter, aActor, &aResult->mSecureConnectionStart)) {
|
||||
if (!ReadIPDLParam(aReader, aActor, &aResult->mSecureConnectionStart)) {
|
||||
return false;
|
||||
}
|
||||
if (!ReadIPDLParam(aMsg, aIter, aActor, &aResult->mConnectEnd)) {
|
||||
if (!ReadIPDLParam(aReader, aActor, &aResult->mConnectEnd)) {
|
||||
return false;
|
||||
}
|
||||
if (!ReadIPDLParam(aMsg, aIter, aActor, &aResult->mRequestStart)) {
|
||||
if (!ReadIPDLParam(aReader, aActor, &aResult->mRequestStart)) {
|
||||
return false;
|
||||
}
|
||||
if (!ReadIPDLParam(aMsg, aIter, aActor, &aResult->mResponseStart)) {
|
||||
if (!ReadIPDLParam(aReader, aActor, &aResult->mResponseStart)) {
|
||||
return false;
|
||||
}
|
||||
if (!ReadIPDLParam(aMsg, aIter, aActor, &aResult->mCacheReadStart)) {
|
||||
if (!ReadIPDLParam(aReader, aActor, &aResult->mCacheReadStart)) {
|
||||
return false;
|
||||
}
|
||||
if (!ReadIPDLParam(aMsg, aIter, aActor, &aResult->mResponseEnd)) {
|
||||
if (!ReadIPDLParam(aReader, aActor, &aResult->mResponseEnd)) {
|
||||
return false;
|
||||
}
|
||||
if (!ReadIPDLParam(aMsg, aIter, aActor, &aResult->mCacheReadEnd)) {
|
||||
if (!ReadIPDLParam(aReader, aActor, &aResult->mCacheReadEnd)) {
|
||||
return false;
|
||||
}
|
||||
if (!ReadIPDLParam(aMsg, aIter, aActor, &aResult->mWorkerStart)) {
|
||||
if (!ReadIPDLParam(aReader, aActor, &aResult->mWorkerStart)) {
|
||||
return false;
|
||||
}
|
||||
if (!ReadIPDLParam(aMsg, aIter, aActor, &aResult->mWorkerRequestStart)) {
|
||||
if (!ReadIPDLParam(aReader, aActor, &aResult->mWorkerRequestStart)) {
|
||||
return false;
|
||||
}
|
||||
if (!ReadIPDLParam(aMsg, aIter, aActor, &aResult->mWorkerResponseEnd)) {
|
||||
if (!ReadIPDLParam(aReader, aActor, &aResult->mWorkerResponseEnd)) {
|
||||
return false;
|
||||
}
|
||||
if (!ReadIPDLParam(aMsg, aIter, aActor, &aResult->mZeroTime)) {
|
||||
if (!ReadIPDLParam(aReader, aActor, &aResult->mZeroTime)) {
|
||||
return false;
|
||||
}
|
||||
if (!ReadIPDLParam(aMsg, aIter, aActor, &aResult->mFetchStart)) {
|
||||
if (!ReadIPDLParam(aReader, aActor, &aResult->mFetchStart)) {
|
||||
return false;
|
||||
}
|
||||
if (!ReadIPDLParam(aMsg, aIter, aActor, &aResult->mEncodedBodySize)) {
|
||||
if (!ReadIPDLParam(aReader, aActor, &aResult->mEncodedBodySize)) {
|
||||
return false;
|
||||
}
|
||||
if (!ReadIPDLParam(aMsg, aIter, aActor, &aResult->mTransferSize)) {
|
||||
if (!ReadIPDLParam(aReader, aActor, &aResult->mTransferSize)) {
|
||||
return false;
|
||||
}
|
||||
if (!ReadIPDLParam(aMsg, aIter, aActor, &aResult->mDecodedBodySize)) {
|
||||
if (!ReadIPDLParam(aReader, aActor, &aResult->mDecodedBodySize)) {
|
||||
return false;
|
||||
}
|
||||
if (!ReadIPDLParam(aMsg, aIter, aActor, &aResult->mRedirectCount)) {
|
||||
if (!ReadIPDLParam(aReader, aActor, &aResult->mRedirectCount)) {
|
||||
return false;
|
||||
}
|
||||
if (!ReadIPDLParam(aMsg, aIter, aActor,
|
||||
&aResult->mAllRedirectsSameOrigin)) {
|
||||
if (!ReadIPDLParam(aReader, aActor, &aResult->mAllRedirectsSameOrigin)) {
|
||||
return false;
|
||||
}
|
||||
if (!ReadIPDLParam(aMsg, aIter, aActor, &aResult->mAllRedirectsPassTAO)) {
|
||||
if (!ReadIPDLParam(aReader, aActor, &aResult->mAllRedirectsPassTAO)) {
|
||||
return false;
|
||||
}
|
||||
if (!ReadIPDLParam(aMsg, aIter, aActor, &aResult->mSecureConnection)) {
|
||||
if (!ReadIPDLParam(aReader, aActor, &aResult->mSecureConnection)) {
|
||||
return false;
|
||||
}
|
||||
if (!ReadIPDLParam(aMsg, aIter, aActor, &aResult->mTimingAllowed)) {
|
||||
if (!ReadIPDLParam(aReader, aActor, &aResult->mTimingAllowed)) {
|
||||
return false;
|
||||
}
|
||||
if (!ReadIPDLParam(aMsg, aIter, aActor, &aResult->mInitialized)) {
|
||||
if (!ReadIPDLParam(aReader, aActor, &aResult->mInitialized)) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
@ -558,7 +557,7 @@ struct IPDLParamTraits<mozilla::dom::PerformanceTimingData> {
|
||||
template <>
|
||||
struct IPDLParamTraits<nsCOMPtr<nsIServerTiming>> {
|
||||
using paramType = nsCOMPtr<nsIServerTiming>;
|
||||
static void Write(IPC::Message* aMsg, IProtocol* aActor,
|
||||
static void Write(IPC::MessageWriter* aWriter, IProtocol* aActor,
|
||||
const paramType& aParam) {
|
||||
nsAutoCString name;
|
||||
Unused << aParam->GetName(name);
|
||||
@ -566,23 +565,23 @@ struct IPDLParamTraits<nsCOMPtr<nsIServerTiming>> {
|
||||
Unused << aParam->GetDuration(&duration);
|
||||
nsAutoCString description;
|
||||
Unused << aParam->GetDescription(description);
|
||||
WriteIPDLParam(aMsg, aActor, name);
|
||||
WriteIPDLParam(aMsg, aActor, duration);
|
||||
WriteIPDLParam(aMsg, aActor, description);
|
||||
WriteIPDLParam(aWriter, aActor, name);
|
||||
WriteIPDLParam(aWriter, aActor, duration);
|
||||
WriteIPDLParam(aWriter, aActor, description);
|
||||
}
|
||||
|
||||
static bool Read(const IPC::Message* aMsg, PickleIterator* aIter,
|
||||
IProtocol* aActor, paramType* aResult) {
|
||||
static bool Read(IPC::MessageReader* aReader, IProtocol* aActor,
|
||||
paramType* aResult) {
|
||||
nsAutoCString name;
|
||||
double duration;
|
||||
nsAutoCString description;
|
||||
if (!ReadIPDLParam(aMsg, aIter, aActor, &name)) {
|
||||
if (!ReadIPDLParam(aReader, aActor, &name)) {
|
||||
return false;
|
||||
}
|
||||
if (!ReadIPDLParam(aMsg, aIter, aActor, &duration)) {
|
||||
if (!ReadIPDLParam(aReader, aActor, &duration)) {
|
||||
return false;
|
||||
}
|
||||
if (!ReadIPDLParam(aMsg, aIter, aActor, &description)) {
|
||||
if (!ReadIPDLParam(aReader, aActor, &description)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -34,23 +34,22 @@ template <>
|
||||
struct ParamTraits<mozilla::dom::quota::FullOriginMetadata> {
|
||||
using ParamType = mozilla::dom::quota::FullOriginMetadata;
|
||||
|
||||
static void Write(Message* aMsg, const ParamType& aParam) {
|
||||
WriteParam(aMsg, aParam.mSuffix);
|
||||
WriteParam(aMsg, aParam.mGroup);
|
||||
WriteParam(aMsg, aParam.mOrigin);
|
||||
WriteParam(aMsg, aParam.mPersistenceType);
|
||||
WriteParam(aMsg, aParam.mPersisted);
|
||||
WriteParam(aMsg, aParam.mLastAccessTime);
|
||||
static void Write(MessageWriter* aWriter, const ParamType& aParam) {
|
||||
WriteParam(aWriter, aParam.mSuffix);
|
||||
WriteParam(aWriter, aParam.mGroup);
|
||||
WriteParam(aWriter, aParam.mOrigin);
|
||||
WriteParam(aWriter, aParam.mPersistenceType);
|
||||
WriteParam(aWriter, aParam.mPersisted);
|
||||
WriteParam(aWriter, aParam.mLastAccessTime);
|
||||
}
|
||||
|
||||
static bool Read(const Message* aMsg, PickleIterator* aIter,
|
||||
ParamType* aResult) {
|
||||
return ReadParam(aMsg, aIter, &aResult->mSuffix) &&
|
||||
ReadParam(aMsg, aIter, &aResult->mGroup) &&
|
||||
ReadParam(aMsg, aIter, &aResult->mOrigin) &&
|
||||
ReadParam(aMsg, aIter, &aResult->mPersistenceType) &&
|
||||
ReadParam(aMsg, aIter, &aResult->mPersisted) &&
|
||||
ReadParam(aMsg, aIter, &aResult->mLastAccessTime);
|
||||
static bool Read(MessageReader* aReader, ParamType* aResult) {
|
||||
return ReadParam(aReader, &aResult->mSuffix) &&
|
||||
ReadParam(aReader, &aResult->mGroup) &&
|
||||
ReadParam(aReader, &aResult->mOrigin) &&
|
||||
ReadParam(aReader, &aResult->mPersistenceType) &&
|
||||
ReadParam(aReader, &aResult->mPersisted) &&
|
||||
ReadParam(aReader, &aResult->mLastAccessTime);
|
||||
}
|
||||
};
|
||||
|
||||
@ -58,21 +57,20 @@ template <>
|
||||
struct ParamTraits<mozilla::OriginAttributesPattern> {
|
||||
typedef mozilla::OriginAttributesPattern paramType;
|
||||
|
||||
static void Write(Message* aMsg, const paramType& aParam) {
|
||||
WriteParam(aMsg, aParam.mFirstPartyDomain);
|
||||
WriteParam(aMsg, aParam.mInIsolatedMozBrowser);
|
||||
WriteParam(aMsg, aParam.mPrivateBrowsingId);
|
||||
WriteParam(aMsg, aParam.mUserContextId);
|
||||
WriteParam(aMsg, aParam.mGeckoViewSessionContextId);
|
||||
static void Write(MessageWriter* aWriter, const paramType& aParam) {
|
||||
WriteParam(aWriter, aParam.mFirstPartyDomain);
|
||||
WriteParam(aWriter, aParam.mInIsolatedMozBrowser);
|
||||
WriteParam(aWriter, aParam.mPrivateBrowsingId);
|
||||
WriteParam(aWriter, aParam.mUserContextId);
|
||||
WriteParam(aWriter, aParam.mGeckoViewSessionContextId);
|
||||
}
|
||||
|
||||
static bool Read(const Message* aMsg, PickleIterator* aIter,
|
||||
paramType* aResult) {
|
||||
return ReadParam(aMsg, aIter, &aResult->mFirstPartyDomain) &&
|
||||
ReadParam(aMsg, aIter, &aResult->mInIsolatedMozBrowser) &&
|
||||
ReadParam(aMsg, aIter, &aResult->mPrivateBrowsingId) &&
|
||||
ReadParam(aMsg, aIter, &aResult->mUserContextId) &&
|
||||
ReadParam(aMsg, aIter, &aResult->mGeckoViewSessionContextId);
|
||||
static bool Read(MessageReader* aReader, paramType* aResult) {
|
||||
return ReadParam(aReader, &aResult->mFirstPartyDomain) &&
|
||||
ReadParam(aReader, &aResult->mInIsolatedMozBrowser) &&
|
||||
ReadParam(aReader, &aResult->mPrivateBrowsingId) &&
|
||||
ReadParam(aReader, &aResult->mUserContextId) &&
|
||||
ReadParam(aReader, &aResult->mGeckoViewSessionContextId);
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -242,15 +242,15 @@ void FeaturePolicyUtils::ReportViolation(Document* aDocument,
|
||||
} // namespace dom
|
||||
|
||||
namespace ipc {
|
||||
void IPDLParamTraits<dom::FeaturePolicy*>::Write(IPC::Message* aMsg,
|
||||
void IPDLParamTraits<dom::FeaturePolicy*>::Write(IPC::MessageWriter* aWriter,
|
||||
IProtocol* aActor,
|
||||
dom::FeaturePolicy* aParam) {
|
||||
if (!aParam) {
|
||||
WriteIPDLParam(aMsg, aActor, false);
|
||||
WriteIPDLParam(aWriter, aActor, false);
|
||||
return;
|
||||
}
|
||||
|
||||
WriteIPDLParam(aMsg, aActor, true);
|
||||
WriteIPDLParam(aWriter, aActor, true);
|
||||
|
||||
dom::FeaturePolicyInfo info;
|
||||
info.defaultOrigin() = aParam->DefaultOrigin();
|
||||
@ -263,15 +263,15 @@ void IPDLParamTraits<dom::FeaturePolicy*>::Write(IPC::Message* aMsg,
|
||||
info.attributeEnabledFeatureNames() =
|
||||
aParam->AttributeEnabledFeatureNames().Clone();
|
||||
|
||||
WriteIPDLParam(aMsg, aActor, info);
|
||||
WriteIPDLParam(aWriter, aActor, info);
|
||||
}
|
||||
|
||||
bool IPDLParamTraits<dom::FeaturePolicy*>::Read(
|
||||
const IPC::Message* aMsg, PickleIterator* aIter, IProtocol* aActor,
|
||||
IPC::MessageReader* aReader, IProtocol* aActor,
|
||||
RefPtr<dom::FeaturePolicy>* aResult) {
|
||||
*aResult = nullptr;
|
||||
bool notnull = false;
|
||||
if (!ReadIPDLParam(aMsg, aIter, aActor, ¬null)) {
|
||||
if (!ReadIPDLParam(aReader, aActor, ¬null)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -280,7 +280,7 @@ bool IPDLParamTraits<dom::FeaturePolicy*>::Read(
|
||||
}
|
||||
|
||||
dom::FeaturePolicyInfo info;
|
||||
if (!ReadIPDLParam(aMsg, aIter, aActor, &info)) {
|
||||
if (!ReadIPDLParam(aReader, aActor, &info)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -80,10 +80,9 @@ struct IPDLParamTraits;
|
||||
|
||||
template <>
|
||||
struct IPDLParamTraits<mozilla::dom::FeaturePolicy*> {
|
||||
static void Write(IPC::Message* aMsg, IProtocol* aActor,
|
||||
static void Write(IPC::MessageWriter* aWriter, IProtocol* aActor,
|
||||
mozilla::dom::FeaturePolicy* aParam);
|
||||
static bool Read(const IPC::Message* aMsg, PickleIterator* aIter,
|
||||
IProtocol* aActor,
|
||||
static bool Read(IPC::MessageReader* aReader, IProtocol* aActor,
|
||||
RefPtr<mozilla::dom::FeaturePolicy>* aResult);
|
||||
};
|
||||
} // namespace ipc
|
||||
|
@ -18,16 +18,15 @@ struct ParamTraits<
|
||||
mozilla::PermissionDelegateHandler::DelegatedPermissionList> {
|
||||
typedef mozilla::PermissionDelegateHandler::DelegatedPermissionList paramType;
|
||||
|
||||
static void Write(Message* aMsg, const paramType& aParam) {
|
||||
static void Write(MessageWriter* aWriter, const paramType& aParam) {
|
||||
for (auto& permission : aParam.mPermissions) {
|
||||
WriteParam(aMsg, permission);
|
||||
WriteParam(aWriter, permission);
|
||||
}
|
||||
}
|
||||
|
||||
static bool Read(const Message* aMsg, PickleIterator* aIter,
|
||||
paramType* aResult) {
|
||||
static bool Read(MessageReader* aReader, paramType* aResult) {
|
||||
for (auto& permission : aResult->mPermissions) {
|
||||
if (!ReadParam(aMsg, aIter, &permission)) {
|
||||
if (!ReadParam(aReader, &permission)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -27,40 +27,39 @@ const DXGI_ADAPTER_DESC& DxgiAdapterDesc::ToDesc() const {
|
||||
|
||||
namespace IPC {
|
||||
|
||||
void ParamTraits<DxgiAdapterDesc>::Write(Message* aMsg,
|
||||
void ParamTraits<DxgiAdapterDesc>::Write(MessageWriter* aWriter,
|
||||
const paramType& aParam) {
|
||||
#if defined(XP_WIN)
|
||||
aMsg->WriteBytes(aParam.Description, sizeof(aParam.Description));
|
||||
WriteParam(aMsg, aParam.VendorId);
|
||||
WriteParam(aMsg, aParam.DeviceId);
|
||||
WriteParam(aMsg, aParam.SubSysId);
|
||||
WriteParam(aMsg, aParam.Revision);
|
||||
WriteParam(aMsg, aParam.DedicatedVideoMemory);
|
||||
WriteParam(aMsg, aParam.DedicatedSystemMemory);
|
||||
WriteParam(aMsg, aParam.SharedSystemMemory);
|
||||
WriteParam(aMsg, aParam.AdapterLuid.LowPart);
|
||||
WriteParam(aMsg, aParam.AdapterLuid.HighPart);
|
||||
aWriter->WriteBytes(aParam.Description, sizeof(aParam.Description));
|
||||
WriteParam(aWriter, aParam.VendorId);
|
||||
WriteParam(aWriter, aParam.DeviceId);
|
||||
WriteParam(aWriter, aParam.SubSysId);
|
||||
WriteParam(aWriter, aParam.Revision);
|
||||
WriteParam(aWriter, aParam.DedicatedVideoMemory);
|
||||
WriteParam(aWriter, aParam.DedicatedSystemMemory);
|
||||
WriteParam(aWriter, aParam.SharedSystemMemory);
|
||||
WriteParam(aWriter, aParam.AdapterLuid.LowPart);
|
||||
WriteParam(aWriter, aParam.AdapterLuid.HighPart);
|
||||
#endif
|
||||
}
|
||||
|
||||
bool ParamTraits<DxgiAdapterDesc>::Read(const Message* aMsg,
|
||||
PickleIterator* aIter,
|
||||
bool ParamTraits<DxgiAdapterDesc>::Read(MessageReader* aReader,
|
||||
paramType* aResult) {
|
||||
#if defined(XP_WIN)
|
||||
if (!aMsg->ReadBytesInto(aIter, aResult->Description,
|
||||
sizeof(aResult->Description))) {
|
||||
if (!aReader->ReadBytesInto(aResult->Description,
|
||||
sizeof(aResult->Description))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (ReadParam(aMsg, aIter, &aResult->VendorId) &&
|
||||
ReadParam(aMsg, aIter, &aResult->DeviceId) &&
|
||||
ReadParam(aMsg, aIter, &aResult->SubSysId) &&
|
||||
ReadParam(aMsg, aIter, &aResult->Revision) &&
|
||||
ReadParam(aMsg, aIter, &aResult->DedicatedVideoMemory) &&
|
||||
ReadParam(aMsg, aIter, &aResult->DedicatedSystemMemory) &&
|
||||
ReadParam(aMsg, aIter, &aResult->SharedSystemMemory) &&
|
||||
ReadParam(aMsg, aIter, &aResult->AdapterLuid.LowPart) &&
|
||||
ReadParam(aMsg, aIter, &aResult->AdapterLuid.HighPart)) {
|
||||
if (ReadParam(aReader, &aResult->VendorId) &&
|
||||
ReadParam(aReader, &aResult->DeviceId) &&
|
||||
ReadParam(aReader, &aResult->SubSysId) &&
|
||||
ReadParam(aReader, &aResult->Revision) &&
|
||||
ReadParam(aReader, &aResult->DedicatedVideoMemory) &&
|
||||
ReadParam(aReader, &aResult->DedicatedSystemMemory) &&
|
||||
ReadParam(aReader, &aResult->SharedSystemMemory) &&
|
||||
ReadParam(aReader, &aResult->AdapterLuid.LowPart) &&
|
||||
ReadParam(aReader, &aResult->AdapterLuid.HighPart)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
@ -37,9 +37,8 @@ namespace IPC {
|
||||
template <>
|
||||
struct ParamTraits<DxgiAdapterDesc> {
|
||||
typedef DxgiAdapterDesc paramType;
|
||||
static void Write(Message* aMsg, const paramType& aParam);
|
||||
static bool Read(const Message* aMsg, PickleIterator* aIter,
|
||||
paramType* aResult);
|
||||
static void Write(MessageWriter* aWriter, const paramType& aParam);
|
||||
static bool Read(MessageReader* aReader, paramType* aResult);
|
||||
};
|
||||
|
||||
} // namespace IPC
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -180,21 +180,20 @@ template <>
|
||||
struct ParamTraits<mozilla::layers::APZTestData> {
|
||||
typedef mozilla::layers::APZTestData paramType;
|
||||
|
||||
static void Write(Message* aMsg, const paramType& aParam) {
|
||||
WriteParam(aMsg, aParam.mPaints);
|
||||
WriteParam(aMsg, aParam.mRepaintRequests);
|
||||
WriteParam(aMsg, aParam.mHitResults);
|
||||
WriteParam(aMsg, aParam.mSampledResults);
|
||||
WriteParam(aMsg, aParam.mAdditionalData);
|
||||
static void Write(MessageWriter* aWriter, const paramType& aParam) {
|
||||
WriteParam(aWriter, aParam.mPaints);
|
||||
WriteParam(aWriter, aParam.mRepaintRequests);
|
||||
WriteParam(aWriter, aParam.mHitResults);
|
||||
WriteParam(aWriter, aParam.mSampledResults);
|
||||
WriteParam(aWriter, aParam.mAdditionalData);
|
||||
}
|
||||
|
||||
static bool Read(const Message* aMsg, PickleIterator* aIter,
|
||||
paramType* aResult) {
|
||||
return (ReadParam(aMsg, aIter, &aResult->mPaints) &&
|
||||
ReadParam(aMsg, aIter, &aResult->mRepaintRequests) &&
|
||||
ReadParam(aMsg, aIter, &aResult->mHitResults) &&
|
||||
ReadParam(aMsg, aIter, &aResult->mSampledResults) &&
|
||||
ReadParam(aMsg, aIter, &aResult->mAdditionalData));
|
||||
static bool Read(MessageReader* aReader, paramType* aResult) {
|
||||
return (ReadParam(aReader, &aResult->mPaints) &&
|
||||
ReadParam(aReader, &aResult->mRepaintRequests) &&
|
||||
ReadParam(aReader, &aResult->mHitResults) &&
|
||||
ReadParam(aReader, &aResult->mSampledResults) &&
|
||||
ReadParam(aReader, &aResult->mAdditionalData));
|
||||
}
|
||||
};
|
||||
|
||||
@ -214,19 +213,18 @@ template <>
|
||||
struct ParamTraits<mozilla::layers::APZTestData::HitResult> {
|
||||
typedef mozilla::layers::APZTestData::HitResult paramType;
|
||||
|
||||
static void Write(Message* aMsg, const paramType& aParam) {
|
||||
WriteParam(aMsg, aParam.point);
|
||||
WriteParam(aMsg, aParam.result);
|
||||
WriteParam(aMsg, aParam.layersId);
|
||||
WriteParam(aMsg, aParam.scrollId);
|
||||
static void Write(MessageWriter* aWriter, const paramType& aParam) {
|
||||
WriteParam(aWriter, aParam.point);
|
||||
WriteParam(aWriter, aParam.result);
|
||||
WriteParam(aWriter, aParam.layersId);
|
||||
WriteParam(aWriter, aParam.scrollId);
|
||||
}
|
||||
|
||||
static bool Read(const Message* aMsg, PickleIterator* aIter,
|
||||
paramType* aResult) {
|
||||
return (ReadParam(aMsg, aIter, &aResult->point) &&
|
||||
ReadParam(aMsg, aIter, &aResult->result) &&
|
||||
ReadParam(aMsg, aIter, &aResult->layersId) &&
|
||||
ReadParam(aMsg, aIter, &aResult->scrollId));
|
||||
static bool Read(MessageReader* aReader, paramType* aResult) {
|
||||
return (ReadParam(aReader, &aResult->point) &&
|
||||
ReadParam(aReader, &aResult->result) &&
|
||||
ReadParam(aReader, &aResult->layersId) &&
|
||||
ReadParam(aReader, &aResult->scrollId));
|
||||
}
|
||||
};
|
||||
|
||||
@ -234,19 +232,18 @@ template <>
|
||||
struct ParamTraits<mozilla::layers::APZTestData::SampledResult> {
|
||||
typedef mozilla::layers::APZTestData::SampledResult paramType;
|
||||
|
||||
static void Write(Message* aMsg, const paramType& aParam) {
|
||||
WriteParam(aMsg, aParam.scrollOffset);
|
||||
WriteParam(aMsg, aParam.sampledTimeStamp);
|
||||
WriteParam(aMsg, aParam.layersId);
|
||||
WriteParam(aMsg, aParam.scrollId);
|
||||
static void Write(MessageWriter* aWriter, const paramType& aParam) {
|
||||
WriteParam(aWriter, aParam.scrollOffset);
|
||||
WriteParam(aWriter, aParam.sampledTimeStamp);
|
||||
WriteParam(aWriter, aParam.layersId);
|
||||
WriteParam(aWriter, aParam.scrollId);
|
||||
}
|
||||
|
||||
static bool Read(const Message* aMsg, PickleIterator* aIter,
|
||||
paramType* aResult) {
|
||||
return (ReadParam(aMsg, aIter, &aResult->scrollOffset) &&
|
||||
ReadParam(aMsg, aIter, &aResult->sampledTimeStamp) &&
|
||||
ReadParam(aMsg, aIter, &aResult->layersId) &&
|
||||
ReadParam(aMsg, aIter, &aResult->scrollId));
|
||||
static bool Read(MessageReader* aReader, paramType* aResult) {
|
||||
return (ReadParam(aReader, &aResult->scrollOffset) &&
|
||||
ReadParam(aReader, &aResult->sampledTimeStamp) &&
|
||||
ReadParam(aReader, &aResult->layersId) &&
|
||||
ReadParam(aReader, &aResult->scrollId));
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -34,14 +34,13 @@ template <>
|
||||
struct ParamTraits<mozilla::layers::FrameUniformityData> {
|
||||
typedef mozilla::layers::FrameUniformityData paramType;
|
||||
|
||||
static void Write(Message* aMsg, const paramType& aParam) {
|
||||
WriteParam(aMsg, aParam.mUniformities);
|
||||
static void Write(MessageWriter* aWriter, const paramType& aParam) {
|
||||
WriteParam(aWriter, aParam.mUniformities);
|
||||
}
|
||||
|
||||
static bool Read(const Message* aMsg, PickleIterator* aIter,
|
||||
paramType* aResult) {
|
||||
static bool Read(MessageReader* aReader, paramType* aResult) {
|
||||
return ParamTraitsStd<std::map<uintptr_t, float>>::Read(
|
||||
aMsg, aIter, &aResult->mUniformities);
|
||||
aReader, &aResult->mUniformities);
|
||||
}
|
||||
};
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -40,13 +40,12 @@ template <>
|
||||
struct ParamTraits<mozilla::layers::SharedSurfacesMemoryReport> {
|
||||
typedef mozilla::layers::SharedSurfacesMemoryReport paramType;
|
||||
|
||||
static void Write(Message* aMsg, const paramType& aParam) {
|
||||
WriteParam(aMsg, aParam.mSurfaces);
|
||||
static void Write(MessageWriter* aWriter, const paramType& aParam) {
|
||||
WriteParam(aWriter, aParam.mSurfaces);
|
||||
}
|
||||
|
||||
static bool Read(const Message* aMsg, PickleIterator* aIter,
|
||||
paramType* aResult) {
|
||||
return ReadParam(aMsg, aIter, &aResult->mSurfaces);
|
||||
static bool Read(MessageReader* aReader, paramType* aResult) {
|
||||
return ReadParam(aReader, &aResult->mSurfaces);
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -12,57 +12,56 @@ namespace mozilla {
|
||||
namespace ipc {
|
||||
|
||||
void IPDLParamTraits<mozilla::layers::DisplayListData>::Write(
|
||||
IPC::Message* aMsg, IProtocol* aActor, paramType&& aParam) {
|
||||
WriteIPDLParam(aMsg, aActor, aParam.mIdNamespace);
|
||||
WriteIPDLParam(aMsg, aActor, aParam.mRect);
|
||||
WriteIPDLParam(aMsg, aActor, aParam.mCommands);
|
||||
WriteIPDLParam(aMsg, aActor, std::move(aParam.mDLItems));
|
||||
WriteIPDLParam(aMsg, aActor, std::move(aParam.mDLCache));
|
||||
WriteIPDLParam(aMsg, aActor, std::move(aParam.mDLSpatialTree));
|
||||
WriteIPDLParam(aMsg, aActor, aParam.mDLDesc);
|
||||
WriteIPDLParam(aMsg, aActor, aParam.mRemotePipelineIds);
|
||||
WriteIPDLParam(aMsg, aActor, aParam.mResourceUpdates);
|
||||
WriteIPDLParam(aMsg, aActor, aParam.mSmallShmems);
|
||||
WriteIPDLParam(aMsg, aActor, std::move(aParam.mLargeShmems));
|
||||
WriteIPDLParam(aMsg, aActor, aParam.mScrollData);
|
||||
IPC::MessageWriter* aWriter, IProtocol* aActor, paramType&& aParam) {
|
||||
WriteIPDLParam(aWriter, aActor, aParam.mIdNamespace);
|
||||
WriteIPDLParam(aWriter, aActor, aParam.mRect);
|
||||
WriteIPDLParam(aWriter, aActor, aParam.mCommands);
|
||||
WriteIPDLParam(aWriter, aActor, std::move(aParam.mDLItems));
|
||||
WriteIPDLParam(aWriter, aActor, std::move(aParam.mDLCache));
|
||||
WriteIPDLParam(aWriter, aActor, std::move(aParam.mDLSpatialTree));
|
||||
WriteIPDLParam(aWriter, aActor, aParam.mDLDesc);
|
||||
WriteIPDLParam(aWriter, aActor, aParam.mRemotePipelineIds);
|
||||
WriteIPDLParam(aWriter, aActor, aParam.mResourceUpdates);
|
||||
WriteIPDLParam(aWriter, aActor, aParam.mSmallShmems);
|
||||
WriteIPDLParam(aWriter, aActor, std::move(aParam.mLargeShmems));
|
||||
WriteIPDLParam(aWriter, aActor, aParam.mScrollData);
|
||||
}
|
||||
|
||||
bool IPDLParamTraits<mozilla::layers::DisplayListData>::Read(
|
||||
const IPC::Message* aMsg, PickleIterator* aIter, IProtocol* aActor,
|
||||
paramType* aResult) {
|
||||
if (ReadIPDLParam(aMsg, aIter, aActor, &aResult->mIdNamespace) &&
|
||||
ReadIPDLParam(aMsg, aIter, aActor, &aResult->mRect) &&
|
||||
ReadIPDLParam(aMsg, aIter, aActor, &aResult->mCommands) &&
|
||||
ReadIPDLParam(aMsg, aIter, aActor, &aResult->mDLItems) &&
|
||||
ReadIPDLParam(aMsg, aIter, aActor, &aResult->mDLCache) &&
|
||||
ReadIPDLParam(aMsg, aIter, aActor, &aResult->mDLSpatialTree) &&
|
||||
ReadIPDLParam(aMsg, aIter, aActor, &aResult->mDLDesc) &&
|
||||
ReadIPDLParam(aMsg, aIter, aActor, &aResult->mRemotePipelineIds) &&
|
||||
ReadIPDLParam(aMsg, aIter, aActor, &aResult->mResourceUpdates) &&
|
||||
ReadIPDLParam(aMsg, aIter, aActor, &aResult->mSmallShmems) &&
|
||||
ReadIPDLParam(aMsg, aIter, aActor, &aResult->mLargeShmems) &&
|
||||
ReadIPDLParam(aMsg, aIter, aActor, &aResult->mScrollData)) {
|
||||
IPC::MessageReader* aReader, IProtocol* aActor, paramType* aResult) {
|
||||
if (ReadIPDLParam(aReader, aActor, &aResult->mIdNamespace) &&
|
||||
ReadIPDLParam(aReader, aActor, &aResult->mRect) &&
|
||||
ReadIPDLParam(aReader, aActor, &aResult->mCommands) &&
|
||||
ReadIPDLParam(aReader, aActor, &aResult->mDLItems) &&
|
||||
ReadIPDLParam(aReader, aActor, &aResult->mDLCache) &&
|
||||
ReadIPDLParam(aReader, aActor, &aResult->mDLSpatialTree) &&
|
||||
ReadIPDLParam(aReader, aActor, &aResult->mDLDesc) &&
|
||||
ReadIPDLParam(aReader, aActor, &aResult->mRemotePipelineIds) &&
|
||||
ReadIPDLParam(aReader, aActor, &aResult->mResourceUpdates) &&
|
||||
ReadIPDLParam(aReader, aActor, &aResult->mSmallShmems) &&
|
||||
ReadIPDLParam(aReader, aActor, &aResult->mLargeShmems) &&
|
||||
ReadIPDLParam(aReader, aActor, &aResult->mScrollData)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void WriteScrollUpdates(IPC::Message* aMsg, IProtocol* aActor,
|
||||
void WriteScrollUpdates(IPC::MessageWriter* aWriter, IProtocol* aActor,
|
||||
layers::ScrollUpdatesMap& aParam) {
|
||||
// ICK: we need to manually serialize this map because
|
||||
// nsDataHashTable doesn't support it (and other maps cause other issues)
|
||||
WriteIPDLParam(aMsg, aActor, aParam.Count());
|
||||
WriteIPDLParam(aWriter, aActor, aParam.Count());
|
||||
for (auto it = aParam.ConstIter(); !it.Done(); it.Next()) {
|
||||
WriteIPDLParam(aMsg, aActor, it.Key());
|
||||
WriteIPDLParam(aMsg, aActor, it.Data());
|
||||
WriteIPDLParam(aWriter, aActor, it.Key());
|
||||
WriteIPDLParam(aWriter, aActor, it.Data());
|
||||
}
|
||||
}
|
||||
|
||||
bool ReadScrollUpdates(const IPC::Message* aMsg, PickleIterator* aIter,
|
||||
IProtocol* aActor, layers::ScrollUpdatesMap* aResult) {
|
||||
bool ReadScrollUpdates(IPC::MessageReader* aReader, IProtocol* aActor,
|
||||
layers::ScrollUpdatesMap* aResult) {
|
||||
// Manually deserialize mScrollUpdates as a stream of K,V pairs
|
||||
uint32_t count;
|
||||
if (!ReadIPDLParam(aMsg, aIter, aActor, &count)) {
|
||||
if (!ReadIPDLParam(aReader, aActor, &count)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -70,8 +69,8 @@ bool ReadScrollUpdates(const IPC::Message* aMsg, PickleIterator* aIter,
|
||||
for (size_t i = 0; i < count; ++i) {
|
||||
layers::ScrollableLayerGuid::ViewID key;
|
||||
nsTArray<mozilla::ScrollPositionUpdate> data;
|
||||
if (!ReadIPDLParam(aMsg, aIter, aActor, &key) ||
|
||||
!ReadIPDLParam(aMsg, aIter, aActor, &data)) {
|
||||
if (!ReadIPDLParam(aReader, aActor, &key) ||
|
||||
!ReadIPDLParam(aReader, aActor, &data)) {
|
||||
return false;
|
||||
}
|
||||
map.InsertOrUpdate(key, std::move(data));
|
||||
@ -83,26 +82,25 @@ bool ReadScrollUpdates(const IPC::Message* aMsg, PickleIterator* aIter,
|
||||
}
|
||||
|
||||
void IPDLParamTraits<mozilla::layers::TransactionData>::Write(
|
||||
IPC::Message* aMsg, IProtocol* aActor, paramType&& aParam) {
|
||||
WriteIPDLParam(aMsg, aActor, aParam.mIdNamespace);
|
||||
WriteIPDLParam(aMsg, aActor, aParam.mCommands);
|
||||
WriteIPDLParam(aMsg, aActor, aParam.mResourceUpdates);
|
||||
WriteIPDLParam(aMsg, aActor, aParam.mSmallShmems);
|
||||
WriteIPDLParam(aMsg, aActor, std::move(aParam.mLargeShmems));
|
||||
WriteScrollUpdates(aMsg, aActor, aParam.mScrollUpdates);
|
||||
WriteIPDLParam(aMsg, aActor, aParam.mPaintSequenceNumber);
|
||||
IPC::MessageWriter* aWriter, IProtocol* aActor, paramType&& aParam) {
|
||||
WriteIPDLParam(aWriter, aActor, aParam.mIdNamespace);
|
||||
WriteIPDLParam(aWriter, aActor, aParam.mCommands);
|
||||
WriteIPDLParam(aWriter, aActor, aParam.mResourceUpdates);
|
||||
WriteIPDLParam(aWriter, aActor, aParam.mSmallShmems);
|
||||
WriteIPDLParam(aWriter, aActor, std::move(aParam.mLargeShmems));
|
||||
WriteScrollUpdates(aWriter, aActor, aParam.mScrollUpdates);
|
||||
WriteIPDLParam(aWriter, aActor, aParam.mPaintSequenceNumber);
|
||||
}
|
||||
|
||||
bool IPDLParamTraits<mozilla::layers::TransactionData>::Read(
|
||||
const IPC::Message* aMsg, PickleIterator* aIter, IProtocol* aActor,
|
||||
paramType* aResult) {
|
||||
if (ReadIPDLParam(aMsg, aIter, aActor, &aResult->mIdNamespace) &&
|
||||
ReadIPDLParam(aMsg, aIter, aActor, &aResult->mCommands) &&
|
||||
ReadIPDLParam(aMsg, aIter, aActor, &aResult->mResourceUpdates) &&
|
||||
ReadIPDLParam(aMsg, aIter, aActor, &aResult->mSmallShmems) &&
|
||||
ReadIPDLParam(aMsg, aIter, aActor, &aResult->mLargeShmems) &&
|
||||
ReadScrollUpdates(aMsg, aIter, aActor, &aResult->mScrollUpdates) &&
|
||||
ReadIPDLParam(aMsg, aIter, aActor, &aResult->mPaintSequenceNumber)) {
|
||||
IPC::MessageReader* aReader, IProtocol* aActor, paramType* aResult) {
|
||||
if (ReadIPDLParam(aReader, aActor, &aResult->mIdNamespace) &&
|
||||
ReadIPDLParam(aReader, aActor, &aResult->mCommands) &&
|
||||
ReadIPDLParam(aReader, aActor, &aResult->mResourceUpdates) &&
|
||||
ReadIPDLParam(aReader, aActor, &aResult->mSmallShmems) &&
|
||||
ReadIPDLParam(aReader, aActor, &aResult->mLargeShmems) &&
|
||||
ReadScrollUpdates(aReader, aActor, &aResult->mScrollUpdates) &&
|
||||
ReadIPDLParam(aReader, aActor, &aResult->mPaintSequenceNumber)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
@ -51,20 +51,22 @@ template <>
|
||||
struct IPDLParamTraits<mozilla::layers::DisplayListData> {
|
||||
typedef mozilla::layers::DisplayListData paramType;
|
||||
|
||||
static void Write(IPC::Message* aMsg, IProtocol* aActor, paramType&& aParam);
|
||||
static void Write(IPC::MessageWriter* aWriter, IProtocol* aActor,
|
||||
paramType&& aParam);
|
||||
|
||||
static bool Read(const IPC::Message* aMsg, PickleIterator* aIter,
|
||||
IProtocol* aActor, paramType* aResult);
|
||||
static bool Read(IPC::MessageReader* aReader, IProtocol* aActor,
|
||||
paramType* aResult);
|
||||
};
|
||||
|
||||
template <>
|
||||
struct IPDLParamTraits<mozilla::layers::TransactionData> {
|
||||
typedef mozilla::layers::TransactionData paramType;
|
||||
|
||||
static void Write(IPC::Message* aMsg, IProtocol* aActor, paramType&& aParam);
|
||||
static void Write(IPC::MessageWriter* aWriter, IProtocol* aActor,
|
||||
paramType&& aParam);
|
||||
|
||||
static bool Read(const IPC::Message* aMsg, PickleIterator* aIter,
|
||||
IProtocol* aActor, paramType* aResult);
|
||||
static bool Read(IPC::MessageReader* aReader, IProtocol* aActor,
|
||||
paramType* aResult);
|
||||
};
|
||||
|
||||
} // namespace ipc
|
||||
|
@ -21,16 +21,15 @@ template <>
|
||||
struct ParamTraits<mozilla::wr::ByteBuffer> {
|
||||
typedef mozilla::wr::ByteBuffer paramType;
|
||||
|
||||
static void Write(Message* aMsg, const paramType& aParam) {
|
||||
WriteParam(aMsg, aParam.mLength);
|
||||
aMsg->WriteBytes(aParam.mData, aParam.mLength);
|
||||
static void Write(MessageWriter* aWriter, const paramType& aParam) {
|
||||
WriteParam(aWriter, aParam.mLength);
|
||||
aWriter->WriteBytes(aParam.mData, aParam.mLength);
|
||||
}
|
||||
|
||||
static bool Read(const Message* aMsg, PickleIterator* aIter,
|
||||
paramType* aResult) {
|
||||
static bool Read(MessageReader* aReader, paramType* aResult) {
|
||||
size_t length;
|
||||
return ReadParam(aMsg, aIter, &length) && aResult->Allocate(length) &&
|
||||
aMsg->ReadBytesInto(aIter, aResult->mData, length);
|
||||
return ReadParam(aReader, &length) && aResult->Allocate(length) &&
|
||||
aReader->ReadBytesInto(aResult->mData, length);
|
||||
}
|
||||
};
|
||||
|
||||
@ -38,21 +37,20 @@ template <>
|
||||
struct ParamTraits<mozilla::wr::ImageDescriptor> {
|
||||
typedef mozilla::wr::ImageDescriptor paramType;
|
||||
|
||||
static void Write(Message* aMsg, const paramType& aParam) {
|
||||
WriteParam(aMsg, aParam.format);
|
||||
WriteParam(aMsg, aParam.width);
|
||||
WriteParam(aMsg, aParam.height);
|
||||
WriteParam(aMsg, aParam.stride);
|
||||
WriteParam(aMsg, aParam.opacity);
|
||||
static void Write(MessageWriter* aWriter, const paramType& aParam) {
|
||||
WriteParam(aWriter, aParam.format);
|
||||
WriteParam(aWriter, aParam.width);
|
||||
WriteParam(aWriter, aParam.height);
|
||||
WriteParam(aWriter, aParam.stride);
|
||||
WriteParam(aWriter, aParam.opacity);
|
||||
}
|
||||
|
||||
static bool Read(const Message* aMsg, PickleIterator* aIter,
|
||||
paramType* aResult) {
|
||||
return ReadParam(aMsg, aIter, &aResult->format) &&
|
||||
ReadParam(aMsg, aIter, &aResult->width) &&
|
||||
ReadParam(aMsg, aIter, &aResult->height) &&
|
||||
ReadParam(aMsg, aIter, &aResult->stride) &&
|
||||
ReadParam(aMsg, aIter, &aResult->opacity);
|
||||
static bool Read(MessageReader* aReader, paramType* aResult) {
|
||||
return ReadParam(aReader, &aResult->format) &&
|
||||
ReadParam(aReader, &aResult->width) &&
|
||||
ReadParam(aReader, &aResult->height) &&
|
||||
ReadParam(aReader, &aResult->stride) &&
|
||||
ReadParam(aReader, &aResult->opacity);
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -354,71 +354,71 @@ bool WebRenderScrollData::RepopulateMap() {
|
||||
namespace IPC {
|
||||
|
||||
void ParamTraits<mozilla::layers::WebRenderLayerScrollData>::Write(
|
||||
Message* aMsg, const paramType& aParam) {
|
||||
WriteParam(aMsg, aParam.mDescendantCount);
|
||||
WriteParam(aMsg, aParam.mScrollIds);
|
||||
WriteParam(aMsg, aParam.mAncestorTransform);
|
||||
WriteParam(aMsg, aParam.mAncestorTransformId);
|
||||
WriteParam(aMsg, aParam.mTransform);
|
||||
WriteParam(aMsg, aParam.mTransformIsPerspective);
|
||||
WriteParam(aMsg, aParam.mResolution);
|
||||
WriteParam(aMsg, aParam.mVisibleRegion);
|
||||
WriteParam(aMsg, aParam.mRemoteDocumentSize);
|
||||
WriteParam(aMsg, aParam.mReferentId);
|
||||
WriteParam(aMsg, aParam.mEventRegionsOverride);
|
||||
WriteParam(aMsg, aParam.mScrollbarData);
|
||||
WriteParam(aMsg, aParam.mScrollbarAnimationId);
|
||||
WriteParam(aMsg, aParam.mFixedPositionAnimationId);
|
||||
WriteParam(aMsg, aParam.mFixedPositionSides);
|
||||
WriteParam(aMsg, aParam.mFixedPosScrollContainerId);
|
||||
WriteParam(aMsg, aParam.mStickyPosScrollContainerId);
|
||||
WriteParam(aMsg, aParam.mStickyScrollRangeOuter);
|
||||
WriteParam(aMsg, aParam.mStickyScrollRangeInner);
|
||||
WriteParam(aMsg, aParam.mStickyPositionAnimationId);
|
||||
WriteParam(aMsg, aParam.mZoomAnimationId);
|
||||
WriteParam(aMsg, aParam.mAsyncZoomContainerId);
|
||||
MessageWriter* aWriter, const paramType& aParam) {
|
||||
WriteParam(aWriter, aParam.mDescendantCount);
|
||||
WriteParam(aWriter, aParam.mScrollIds);
|
||||
WriteParam(aWriter, aParam.mAncestorTransform);
|
||||
WriteParam(aWriter, aParam.mAncestorTransformId);
|
||||
WriteParam(aWriter, aParam.mTransform);
|
||||
WriteParam(aWriter, aParam.mTransformIsPerspective);
|
||||
WriteParam(aWriter, aParam.mResolution);
|
||||
WriteParam(aWriter, aParam.mVisibleRegion);
|
||||
WriteParam(aWriter, aParam.mRemoteDocumentSize);
|
||||
WriteParam(aWriter, aParam.mReferentId);
|
||||
WriteParam(aWriter, aParam.mEventRegionsOverride);
|
||||
WriteParam(aWriter, aParam.mScrollbarData);
|
||||
WriteParam(aWriter, aParam.mScrollbarAnimationId);
|
||||
WriteParam(aWriter, aParam.mFixedPositionAnimationId);
|
||||
WriteParam(aWriter, aParam.mFixedPositionSides);
|
||||
WriteParam(aWriter, aParam.mFixedPosScrollContainerId);
|
||||
WriteParam(aWriter, aParam.mStickyPosScrollContainerId);
|
||||
WriteParam(aWriter, aParam.mStickyScrollRangeOuter);
|
||||
WriteParam(aWriter, aParam.mStickyScrollRangeInner);
|
||||
WriteParam(aWriter, aParam.mStickyPositionAnimationId);
|
||||
WriteParam(aWriter, aParam.mZoomAnimationId);
|
||||
WriteParam(aWriter, aParam.mAsyncZoomContainerId);
|
||||
}
|
||||
|
||||
bool ParamTraits<mozilla::layers::WebRenderLayerScrollData>::Read(
|
||||
const Message* aMsg, PickleIterator* aIter, paramType* aResult) {
|
||||
return ReadParam(aMsg, aIter, &aResult->mDescendantCount) &&
|
||||
ReadParam(aMsg, aIter, &aResult->mScrollIds) &&
|
||||
ReadParam(aMsg, aIter, &aResult->mAncestorTransform) &&
|
||||
ReadParam(aMsg, aIter, &aResult->mAncestorTransformId) &&
|
||||
ReadParam(aMsg, aIter, &aResult->mTransform) &&
|
||||
ReadParam(aMsg, aIter, &aResult->mTransformIsPerspective) &&
|
||||
ReadParam(aMsg, aIter, &aResult->mResolution) &&
|
||||
ReadParam(aMsg, aIter, &aResult->mVisibleRegion) &&
|
||||
ReadParam(aMsg, aIter, &aResult->mRemoteDocumentSize) &&
|
||||
ReadParam(aMsg, aIter, &aResult->mReferentId) &&
|
||||
ReadParam(aMsg, aIter, &aResult->mEventRegionsOverride) &&
|
||||
ReadParam(aMsg, aIter, &aResult->mScrollbarData) &&
|
||||
ReadParam(aMsg, aIter, &aResult->mScrollbarAnimationId) &&
|
||||
ReadParam(aMsg, aIter, &aResult->mFixedPositionAnimationId) &&
|
||||
ReadParam(aMsg, aIter, &aResult->mFixedPositionSides) &&
|
||||
ReadParam(aMsg, aIter, &aResult->mFixedPosScrollContainerId) &&
|
||||
ReadParam(aMsg, aIter, &aResult->mStickyPosScrollContainerId) &&
|
||||
ReadParam(aMsg, aIter, &aResult->mStickyScrollRangeOuter) &&
|
||||
ReadParam(aMsg, aIter, &aResult->mStickyScrollRangeInner) &&
|
||||
ReadParam(aMsg, aIter, &aResult->mStickyPositionAnimationId) &&
|
||||
ReadParam(aMsg, aIter, &aResult->mZoomAnimationId) &&
|
||||
ReadParam(aMsg, aIter, &aResult->mAsyncZoomContainerId);
|
||||
MessageReader* aReader, paramType* aResult) {
|
||||
return ReadParam(aReader, &aResult->mDescendantCount) &&
|
||||
ReadParam(aReader, &aResult->mScrollIds) &&
|
||||
ReadParam(aReader, &aResult->mAncestorTransform) &&
|
||||
ReadParam(aReader, &aResult->mAncestorTransformId) &&
|
||||
ReadParam(aReader, &aResult->mTransform) &&
|
||||
ReadParam(aReader, &aResult->mTransformIsPerspective) &&
|
||||
ReadParam(aReader, &aResult->mResolution) &&
|
||||
ReadParam(aReader, &aResult->mVisibleRegion) &&
|
||||
ReadParam(aReader, &aResult->mRemoteDocumentSize) &&
|
||||
ReadParam(aReader, &aResult->mReferentId) &&
|
||||
ReadParam(aReader, &aResult->mEventRegionsOverride) &&
|
||||
ReadParam(aReader, &aResult->mScrollbarData) &&
|
||||
ReadParam(aReader, &aResult->mScrollbarAnimationId) &&
|
||||
ReadParam(aReader, &aResult->mFixedPositionAnimationId) &&
|
||||
ReadParam(aReader, &aResult->mFixedPositionSides) &&
|
||||
ReadParam(aReader, &aResult->mFixedPosScrollContainerId) &&
|
||||
ReadParam(aReader, &aResult->mStickyPosScrollContainerId) &&
|
||||
ReadParam(aReader, &aResult->mStickyScrollRangeOuter) &&
|
||||
ReadParam(aReader, &aResult->mStickyScrollRangeInner) &&
|
||||
ReadParam(aReader, &aResult->mStickyPositionAnimationId) &&
|
||||
ReadParam(aReader, &aResult->mZoomAnimationId) &&
|
||||
ReadParam(aReader, &aResult->mAsyncZoomContainerId);
|
||||
}
|
||||
|
||||
void ParamTraits<mozilla::layers::WebRenderScrollData>::Write(
|
||||
Message* aMsg, const paramType& aParam) {
|
||||
WriteParam(aMsg, aParam.mScrollMetadatas);
|
||||
WriteParam(aMsg, aParam.mLayerScrollData);
|
||||
WriteParam(aMsg, aParam.mIsFirstPaint);
|
||||
WriteParam(aMsg, aParam.mPaintSequenceNumber);
|
||||
MessageWriter* aWriter, const paramType& aParam) {
|
||||
WriteParam(aWriter, aParam.mScrollMetadatas);
|
||||
WriteParam(aWriter, aParam.mLayerScrollData);
|
||||
WriteParam(aWriter, aParam.mIsFirstPaint);
|
||||
WriteParam(aWriter, aParam.mPaintSequenceNumber);
|
||||
}
|
||||
|
||||
bool ParamTraits<mozilla::layers::WebRenderScrollData>::Read(
|
||||
const Message* aMsg, PickleIterator* aIter, paramType* aResult) {
|
||||
return ReadParam(aMsg, aIter, &aResult->mScrollMetadatas) &&
|
||||
ReadParam(aMsg, aIter, &aResult->mLayerScrollData) &&
|
||||
ReadParam(aMsg, aIter, &aResult->mIsFirstPaint) &&
|
||||
ReadParam(aMsg, aIter, &aResult->mPaintSequenceNumber) &&
|
||||
MessageReader* aReader, paramType* aResult) {
|
||||
return ReadParam(aReader, &aResult->mScrollMetadatas) &&
|
||||
ReadParam(aReader, &aResult->mLayerScrollData) &&
|
||||
ReadParam(aReader, &aResult->mIsFirstPaint) &&
|
||||
ReadParam(aReader, &aResult->mPaintSequenceNumber) &&
|
||||
aResult->RepopulateMap();
|
||||
}
|
||||
|
||||
|
@ -328,20 +328,18 @@ template <>
|
||||
struct ParamTraits<mozilla::layers::WebRenderLayerScrollData> {
|
||||
typedef mozilla::layers::WebRenderLayerScrollData paramType;
|
||||
|
||||
static void Write(Message* aMsg, const paramType& aParam);
|
||||
static void Write(MessageWriter* aWriter, const paramType& aParam);
|
||||
|
||||
static bool Read(const Message* aMsg, PickleIterator* aIter,
|
||||
paramType* aResult);
|
||||
static bool Read(MessageReader* aReader, paramType* aResult);
|
||||
};
|
||||
|
||||
template <>
|
||||
struct ParamTraits<mozilla::layers::WebRenderScrollData> {
|
||||
typedef mozilla::layers::WebRenderScrollData paramType;
|
||||
|
||||
static void Write(Message* aMsg, const paramType& aParam);
|
||||
static void Write(MessageWriter* aWriter, const paramType& aParam);
|
||||
|
||||
static bool Read(const Message* aMsg, PickleIterator* aIter,
|
||||
paramType* aResult);
|
||||
static bool Read(MessageReader* aReader, paramType* aResult);
|
||||
};
|
||||
|
||||
} // namespace IPC
|
||||
|
@ -385,14 +385,13 @@ namespace IPC {
|
||||
template <>
|
||||
struct ParamTraits<mozilla::fontlist::Pointer> {
|
||||
typedef mozilla::fontlist::Pointer paramType;
|
||||
static void Write(Message* aMsg, const paramType& aParam) {
|
||||
static void Write(MessageWriter* aWriter, const paramType& aParam) {
|
||||
uint32_t v = aParam.mBlockAndOffset;
|
||||
WriteParam(aMsg, v);
|
||||
WriteParam(aWriter, v);
|
||||
}
|
||||
static bool Read(const Message* aMsg, PickleIterator* aIter,
|
||||
paramType* aResult) {
|
||||
static bool Read(MessageReader* aReader, paramType* aResult) {
|
||||
uint32_t v;
|
||||
if (ReadParam(aMsg, aIter, &v)) {
|
||||
if (ReadParam(aReader, &v)) {
|
||||
aResult->mBlockAndOffset.store(v);
|
||||
return true;
|
||||
}
|
||||
|
@ -341,26 +341,24 @@ namespace IPC {
|
||||
template <>
|
||||
struct ParamTraits<gfxSparseBitSet> {
|
||||
typedef gfxSparseBitSet paramType;
|
||||
static void Write(Message* aMsg, const paramType& aParam) {
|
||||
WriteParam(aMsg, aParam.mBlockIndex);
|
||||
WriteParam(aMsg, aParam.mBlocks);
|
||||
static void Write(MessageWriter* aWriter, const paramType& aParam) {
|
||||
WriteParam(aWriter, aParam.mBlockIndex);
|
||||
WriteParam(aWriter, aParam.mBlocks);
|
||||
}
|
||||
static bool Read(const Message* aMsg, PickleIterator* aIter,
|
||||
paramType* aResult) {
|
||||
return ReadParam(aMsg, aIter, &aResult->mBlockIndex) &&
|
||||
ReadParam(aMsg, aIter, &aResult->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(Message* aMsg, const paramType& aParam) {
|
||||
aMsg->WriteBytes(&aParam, sizeof(aParam));
|
||||
static void Write(MessageWriter* aWriter, const paramType& aParam) {
|
||||
aWriter->WriteBytes(&aParam, sizeof(aParam));
|
||||
}
|
||||
static bool Read(const Message* aMsg, PickleIterator* aIter,
|
||||
paramType* aResult) {
|
||||
return aMsg->ReadBytesInto(aIter, aResult, sizeof(*aResult));
|
||||
static bool Read(MessageReader* aReader, paramType* aResult) {
|
||||
return aReader->ReadBytesInto(aResult, sizeof(*aResult));
|
||||
}
|
||||
};
|
||||
} // namespace IPC
|
||||
|
@ -41,21 +41,20 @@ template <>
|
||||
struct ParamTraits<mozilla::gfx::VRSubmitFrameResultInfo> {
|
||||
typedef mozilla::gfx::VRSubmitFrameResultInfo paramType;
|
||||
|
||||
static void Write(Message* aMsg, const paramType& aParam) {
|
||||
WriteParam(aMsg, aParam.mBase64Image);
|
||||
WriteParam(aMsg, aParam.mFormat);
|
||||
WriteParam(aMsg, aParam.mWidth);
|
||||
WriteParam(aMsg, aParam.mHeight);
|
||||
WriteParam(aMsg, aParam.mFrameNum);
|
||||
static void Write(MessageWriter* aWriter, const paramType& aParam) {
|
||||
WriteParam(aWriter, aParam.mBase64Image);
|
||||
WriteParam(aWriter, aParam.mFormat);
|
||||
WriteParam(aWriter, aParam.mWidth);
|
||||
WriteParam(aWriter, aParam.mHeight);
|
||||
WriteParam(aWriter, aParam.mFrameNum);
|
||||
}
|
||||
|
||||
static bool Read(const Message* aMsg, PickleIterator* aIter,
|
||||
paramType* aResult) {
|
||||
if (!ReadParam(aMsg, aIter, &(aResult->mBase64Image)) ||
|
||||
!ReadParam(aMsg, aIter, &(aResult->mFormat)) ||
|
||||
!ReadParam(aMsg, aIter, &(aResult->mWidth)) ||
|
||||
!ReadParam(aMsg, aIter, &(aResult->mHeight)) ||
|
||||
!ReadParam(aMsg, aIter, &(aResult->mFrameNum))) {
|
||||
static bool Read(MessageReader* aReader, paramType* aResult) {
|
||||
if (!ReadParam(aReader, &(aResult->mBase64Image)) ||
|
||||
!ReadParam(aReader, &(aResult->mFormat)) ||
|
||||
!ReadParam(aReader, &(aResult->mWidth)) ||
|
||||
!ReadParam(aReader, &(aResult->mHeight)) ||
|
||||
!ReadParam(aReader, &(aResult->mFrameNum))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -276,14 +276,13 @@ template <class P>
|
||||
struct ParamTraits;
|
||||
|
||||
template <typename P>
|
||||
static inline void WriteParam(Message* m, P&& p) {
|
||||
ParamTraits<std::decay_t<P>>::Write(m, std::forward<P>(p));
|
||||
static inline void WriteParam(MessageWriter* writer, P&& p) {
|
||||
ParamTraits<std::decay_t<P>>::Write(writer, std::forward<P>(p));
|
||||
}
|
||||
|
||||
template <typename P>
|
||||
static inline bool WARN_UNUSED_RESULT ReadParam(const Message* m,
|
||||
PickleIterator* iter, P* p) {
|
||||
return ParamTraits<P>::Read(m, iter, p);
|
||||
static inline bool WARN_UNUSED_RESULT ReadParam(MessageReader* reader, P* p) {
|
||||
return ParamTraits<P>::Read(reader, p);
|
||||
}
|
||||
|
||||
template <typename P>
|
||||
@ -299,9 +298,11 @@ struct ParamTraitsFundamental {};
|
||||
template <>
|
||||
struct ParamTraitsFundamental<bool> {
|
||||
typedef bool param_type;
|
||||
static void Write(Message* m, const param_type& p) { m->WriteBool(p); }
|
||||
static bool Read(const Message* m, PickleIterator* iter, param_type* r) {
|
||||
return m->ReadBool(iter, r);
|
||||
static void Write(MessageWriter* writer, const param_type& p) {
|
||||
writer->WriteBool(p);
|
||||
}
|
||||
static bool Read(MessageReader* reader, param_type* r) {
|
||||
return reader->ReadBool(r);
|
||||
}
|
||||
static void Log(const param_type& p, std::wstring* l) {
|
||||
l->append(p ? L"true" : L"false");
|
||||
@ -311,9 +312,11 @@ struct ParamTraitsFundamental<bool> {
|
||||
template <>
|
||||
struct ParamTraitsFundamental<int> {
|
||||
typedef int param_type;
|
||||
static void Write(Message* m, const param_type& p) { m->WriteInt(p); }
|
||||
static bool Read(const Message* m, PickleIterator* iter, param_type* r) {
|
||||
return m->ReadInt(iter, r);
|
||||
static void Write(MessageWriter* writer, const param_type& p) {
|
||||
writer->WriteInt(p);
|
||||
}
|
||||
static bool Read(MessageReader* reader, param_type* r) {
|
||||
return reader->ReadInt(r);
|
||||
}
|
||||
static void Log(const param_type& p, std::wstring* l) {
|
||||
l->append(StringPrintf(L"%d", p));
|
||||
@ -323,9 +326,11 @@ struct ParamTraitsFundamental<int> {
|
||||
template <>
|
||||
struct ParamTraitsFundamental<long> {
|
||||
typedef long param_type;
|
||||
static void Write(Message* m, const param_type& p) { m->WriteLong(p); }
|
||||
static bool Read(const Message* m, PickleIterator* iter, param_type* r) {
|
||||
return m->ReadLong(iter, r);
|
||||
static void Write(MessageWriter* writer, const param_type& p) {
|
||||
writer->WriteLong(p);
|
||||
}
|
||||
static bool Read(MessageReader* reader, param_type* r) {
|
||||
return reader->ReadLong(r);
|
||||
}
|
||||
static void Log(const param_type& p, std::wstring* l) {
|
||||
l->append(StringPrintf(L"%l", p));
|
||||
@ -335,9 +340,11 @@ struct ParamTraitsFundamental<long> {
|
||||
template <>
|
||||
struct ParamTraitsFundamental<unsigned long> {
|
||||
typedef unsigned long param_type;
|
||||
static void Write(Message* m, const param_type& p) { m->WriteULong(p); }
|
||||
static bool Read(const Message* m, PickleIterator* iter, param_type* r) {
|
||||
return m->ReadULong(iter, r);
|
||||
static void Write(MessageWriter* writer, const param_type& p) {
|
||||
writer->WriteULong(p);
|
||||
}
|
||||
static bool Read(MessageReader* reader, param_type* r) {
|
||||
return reader->ReadULong(r);
|
||||
}
|
||||
static void Log(const param_type& p, std::wstring* l) {
|
||||
l->append(StringPrintf(L"%ul", p));
|
||||
@ -347,11 +354,11 @@ struct ParamTraitsFundamental<unsigned long> {
|
||||
template <>
|
||||
struct ParamTraitsFundamental<long long> {
|
||||
typedef long long param_type;
|
||||
static void Write(Message* m, const param_type& p) {
|
||||
m->WriteBytes(&p, sizeof(param_type));
|
||||
static void Write(MessageWriter* writer, const param_type& p) {
|
||||
writer->WriteBytes(&p, sizeof(param_type));
|
||||
}
|
||||
static bool Read(const Message* m, PickleIterator* iter, param_type* r) {
|
||||
return m->ReadBytesInto(iter, r, sizeof(*r));
|
||||
static bool Read(MessageReader* reader, param_type* r) {
|
||||
return reader->ReadBytesInto(r, sizeof(*r));
|
||||
}
|
||||
static void Log(const param_type& p, std::wstring* l) {
|
||||
l->append(StringPrintf(L"%ll", p));
|
||||
@ -361,11 +368,11 @@ struct ParamTraitsFundamental<long long> {
|
||||
template <>
|
||||
struct ParamTraitsFundamental<unsigned long long> {
|
||||
typedef unsigned long long param_type;
|
||||
static void Write(Message* m, const param_type& p) {
|
||||
m->WriteBytes(&p, sizeof(param_type));
|
||||
static void Write(MessageWriter* writer, const param_type& p) {
|
||||
writer->WriteBytes(&p, sizeof(param_type));
|
||||
}
|
||||
static bool Read(const Message* m, PickleIterator* iter, param_type* r) {
|
||||
return m->ReadBytesInto(iter, r, sizeof(*r));
|
||||
static bool Read(MessageReader* reader, param_type* r) {
|
||||
return reader->ReadBytesInto(r, sizeof(*r));
|
||||
}
|
||||
static void Log(const param_type& p, std::wstring* l) {
|
||||
l->append(StringPrintf(L"%ull", p));
|
||||
@ -375,9 +382,11 @@ struct ParamTraitsFundamental<unsigned long long> {
|
||||
template <>
|
||||
struct ParamTraitsFundamental<double> {
|
||||
typedef double param_type;
|
||||
static void Write(Message* m, const param_type& p) { m->WriteDouble(p); }
|
||||
static bool Read(const Message* m, PickleIterator* iter, param_type* r) {
|
||||
return m->ReadDouble(iter, r);
|
||||
static void Write(MessageWriter* writer, const param_type& p) {
|
||||
writer->WriteDouble(p);
|
||||
}
|
||||
static bool Read(MessageReader* reader, param_type* r) {
|
||||
return reader->ReadDouble(r);
|
||||
}
|
||||
static void Log(const param_type& p, std::wstring* l) {
|
||||
l->append(StringPrintf(L"e", p));
|
||||
@ -392,9 +401,11 @@ struct ParamTraitsFixed : ParamTraitsFundamental<P> {};
|
||||
template <>
|
||||
struct ParamTraitsFixed<int16_t> {
|
||||
typedef int16_t param_type;
|
||||
static void Write(Message* m, const param_type& p) { m->WriteInt16(p); }
|
||||
static bool Read(const Message* m, PickleIterator* iter, param_type* r) {
|
||||
return m->ReadInt16(iter, r);
|
||||
static void Write(MessageWriter* writer, const param_type& p) {
|
||||
writer->WriteInt16(p);
|
||||
}
|
||||
static bool Read(MessageReader* reader, param_type* r) {
|
||||
return reader->ReadInt16(r);
|
||||
}
|
||||
static void Log(const param_type& p, std::wstring* l) {
|
||||
l->append(StringPrintf(L"%hd", p));
|
||||
@ -404,9 +415,11 @@ struct ParamTraitsFixed<int16_t> {
|
||||
template <>
|
||||
struct ParamTraitsFixed<uint16_t> {
|
||||
typedef uint16_t param_type;
|
||||
static void Write(Message* m, const param_type& p) { m->WriteUInt16(p); }
|
||||
static bool Read(const Message* m, PickleIterator* iter, param_type* r) {
|
||||
return m->ReadUInt16(iter, r);
|
||||
static void Write(MessageWriter* writer, const param_type& p) {
|
||||
writer->WriteUInt16(p);
|
||||
}
|
||||
static bool Read(MessageReader* reader, param_type* r) {
|
||||
return reader->ReadUInt16(r);
|
||||
}
|
||||
static void Log(const param_type& p, std::wstring* l) {
|
||||
l->append(StringPrintf(L"%hu", p));
|
||||
@ -416,9 +429,11 @@ struct ParamTraitsFixed<uint16_t> {
|
||||
template <>
|
||||
struct ParamTraitsFixed<uint32_t> {
|
||||
typedef uint32_t param_type;
|
||||
static void Write(Message* m, const param_type& p) { m->WriteUInt32(p); }
|
||||
static bool Read(const Message* m, PickleIterator* iter, param_type* r) {
|
||||
return m->ReadUInt32(iter, r);
|
||||
static void Write(MessageWriter* writer, const param_type& p) {
|
||||
writer->WriteUInt32(p);
|
||||
}
|
||||
static bool Read(MessageReader* reader, param_type* r) {
|
||||
return reader->ReadUInt32(r);
|
||||
}
|
||||
static void Log(const param_type& p, std::wstring* l) {
|
||||
l->append(StringPrintf(L"%u", p));
|
||||
@ -428,9 +443,11 @@ struct ParamTraitsFixed<uint32_t> {
|
||||
template <>
|
||||
struct ParamTraitsFixed<int64_t> {
|
||||
typedef int64_t param_type;
|
||||
static void Write(Message* m, const param_type& p) { m->WriteInt64(p); }
|
||||
static bool Read(const Message* m, PickleIterator* iter, param_type* r) {
|
||||
return m->ReadInt64(iter, r);
|
||||
static void Write(MessageWriter* writer, const param_type& p) {
|
||||
writer->WriteInt64(p);
|
||||
}
|
||||
static bool Read(MessageReader* reader, param_type* r) {
|
||||
return reader->ReadInt64(r);
|
||||
}
|
||||
static void Log(const param_type& p, std::wstring* l) {
|
||||
l->append(StringPrintf(L"%" PRId64L, p));
|
||||
@ -440,11 +457,11 @@ struct ParamTraitsFixed<int64_t> {
|
||||
template <>
|
||||
struct ParamTraitsFixed<uint64_t> {
|
||||
typedef uint64_t param_type;
|
||||
static void Write(Message* m, const param_type& p) {
|
||||
m->WriteInt64(static_cast<int64_t>(p));
|
||||
static void Write(MessageWriter* writer, const param_type& p) {
|
||||
writer->WriteInt64(static_cast<int64_t>(p));
|
||||
}
|
||||
static bool Read(const Message* m, PickleIterator* iter, param_type* r) {
|
||||
return m->ReadInt64(iter, reinterpret_cast<int64_t*>(r));
|
||||
static bool Read(MessageReader* reader, param_type* r) {
|
||||
return reader->ReadInt64(reinterpret_cast<int64_t*>(r));
|
||||
}
|
||||
static void Log(const param_type& p, std::wstring* l) {
|
||||
l->append(StringPrintf(L"%" PRIu64L, p));
|
||||
@ -459,9 +476,11 @@ struct ParamTraitsStd : ParamTraitsFixed<P> {};
|
||||
template <>
|
||||
struct ParamTraitsStd<std::string> {
|
||||
typedef std::string param_type;
|
||||
static void Write(Message* m, const param_type& p) { m->WriteString(p); }
|
||||
static bool Read(const Message* m, PickleIterator* iter, param_type* r) {
|
||||
return m->ReadString(iter, r);
|
||||
static void Write(MessageWriter* writer, const param_type& p) {
|
||||
writer->WriteString(p);
|
||||
}
|
||||
static bool Read(MessageReader* reader, param_type* r) {
|
||||
return reader->ReadString(r);
|
||||
}
|
||||
static void Log(const param_type& p, std::wstring* l) {
|
||||
l->append(UTF8ToWide(p));
|
||||
@ -471,9 +490,11 @@ struct ParamTraitsStd<std::string> {
|
||||
template <>
|
||||
struct ParamTraitsStd<std::wstring> {
|
||||
typedef std::wstring param_type;
|
||||
static void Write(Message* m, const param_type& p) { m->WriteWString(p); }
|
||||
static bool Read(const Message* m, PickleIterator* iter, param_type* r) {
|
||||
return m->ReadWString(iter, r);
|
||||
static void Write(MessageWriter* writer, const param_type& p) {
|
||||
writer->WriteWString(p);
|
||||
}
|
||||
static bool Read(MessageReader* reader, param_type* r) {
|
||||
return reader->ReadWString(r);
|
||||
}
|
||||
static void Log(const param_type& p, std::wstring* l) { l->append(p); }
|
||||
};
|
||||
@ -481,22 +502,22 @@ struct ParamTraitsStd<std::wstring> {
|
||||
template <class K, class V>
|
||||
struct ParamTraitsStd<std::map<K, V>> {
|
||||
typedef std::map<K, V> param_type;
|
||||
static void Write(Message* m, const param_type& p) {
|
||||
WriteParam(m, static_cast<int>(p.size()));
|
||||
static void Write(MessageWriter* writer, const param_type& p) {
|
||||
WriteParam(writer, static_cast<int>(p.size()));
|
||||
typename param_type::const_iterator iter;
|
||||
for (iter = p.begin(); iter != p.end(); ++iter) {
|
||||
WriteParam(m, iter->first);
|
||||
WriteParam(m, iter->second);
|
||||
WriteParam(writer, iter->first);
|
||||
WriteParam(writer, iter->second);
|
||||
}
|
||||
}
|
||||
static bool Read(const Message* m, PickleIterator* iter, param_type* r) {
|
||||
static bool Read(MessageReader* reader, param_type* r) {
|
||||
int size;
|
||||
if (!ReadParam(m, iter, &size) || size < 0) return false;
|
||||
if (!ReadParam(reader, &size) || size < 0) return false;
|
||||
for (int i = 0; i < size; ++i) {
|
||||
K k;
|
||||
if (!ReadParam(m, iter, &k)) return false;
|
||||
if (!ReadParam(reader, &k)) return false;
|
||||
V& value = (*r)[k];
|
||||
if (!ReadParam(m, iter, &value)) return false;
|
||||
if (!ReadParam(reader, &value)) return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@ -515,11 +536,11 @@ template <>
|
||||
struct ParamTraitsWindows<HANDLE> {
|
||||
static_assert(sizeof(HANDLE) == sizeof(intptr_t), "Wrong size for HANDLE?");
|
||||
|
||||
static void Write(Message* m, HANDLE p) {
|
||||
m->WriteIntPtr(reinterpret_cast<intptr_t>(p));
|
||||
static void Write(MessageWriter* writer, HANDLE p) {
|
||||
writer->WriteIntPtr(reinterpret_cast<intptr_t>(p));
|
||||
}
|
||||
static bool Read(const Message* m, PickleIterator* iter, HANDLE* r) {
|
||||
return m->ReadIntPtr(iter, reinterpret_cast<intptr_t*>(r));
|
||||
static bool Read(MessageReader* reader, HANDLE* r) {
|
||||
return reader->ReadIntPtr(reinterpret_cast<intptr_t*>(r));
|
||||
}
|
||||
static void Log(const HANDLE& p, std::wstring* l) {
|
||||
l->append(StringPrintf(L"0x%X", p));
|
||||
@ -530,11 +551,11 @@ template <>
|
||||
struct ParamTraitsWindows<HWND> {
|
||||
static_assert(sizeof(HWND) == sizeof(intptr_t), "Wrong size for HWND?");
|
||||
|
||||
static void Write(Message* m, HWND p) {
|
||||
m->WriteIntPtr(reinterpret_cast<intptr_t>(p));
|
||||
static void Write(MessageWriter* writer, HWND p) {
|
||||
writer->WriteIntPtr(reinterpret_cast<intptr_t>(p));
|
||||
}
|
||||
static bool Read(const Message* m, PickleIterator* iter, HWND* r) {
|
||||
return m->ReadIntPtr(iter, reinterpret_cast<intptr_t*>(r));
|
||||
static bool Read(MessageReader* reader, HWND* r) {
|
||||
return reader->ReadIntPtr(reinterpret_cast<intptr_t*>(r));
|
||||
}
|
||||
static void Log(const HWND& p, std::wstring* l) {
|
||||
l->append(StringPrintf(L"0x%X", p));
|
||||
@ -560,18 +581,18 @@ struct ParamTraitsIPC : ParamTraitsWindows<P> {};
|
||||
template <>
|
||||
struct ParamTraitsIPC<mozilla::UniqueFileHandle> {
|
||||
typedef mozilla::UniqueFileHandle param_type;
|
||||
static void Write(Message* m, param_type&& p) {
|
||||
static void Write(MessageWriter* writer, param_type&& p) {
|
||||
const bool valid = p != nullptr;
|
||||
WriteParam(m, valid);
|
||||
WriteParam(writer, valid);
|
||||
if (valid) {
|
||||
if (!m->WriteFileHandle(std::move(p))) {
|
||||
if (!writer->WriteFileHandle(std::move(p))) {
|
||||
NOTREACHED() << "Too many file handles for one message!";
|
||||
}
|
||||
}
|
||||
}
|
||||
static bool Read(const Message* m, PickleIterator* iter, param_type* r) {
|
||||
static bool Read(MessageReader* reader, param_type* r) {
|
||||
bool valid;
|
||||
if (!ReadParam(m, iter, &valid)) {
|
||||
if (!ReadParam(reader, &valid)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -580,7 +601,7 @@ struct ParamTraitsIPC<mozilla::UniqueFileHandle> {
|
||||
return true;
|
||||
}
|
||||
|
||||
return m->ConsumeFileHandle(iter, r);
|
||||
return reader->ConsumeFileHandle(r);
|
||||
}
|
||||
};
|
||||
|
||||
@ -598,18 +619,18 @@ struct ParamTraitsIPC<mozilla::UniqueFileHandle> {
|
||||
template <>
|
||||
struct ParamTraitsIPC<mozilla::UniqueMachSendRight> {
|
||||
typedef mozilla::UniqueMachSendRight param_type;
|
||||
static void Write(Message* m, param_type&& p) {
|
||||
static void Write(MessageWriter* writer, param_type&& p) {
|
||||
const bool valid = p != nullptr;
|
||||
WriteParam(m, valid);
|
||||
WriteParam(writer, valid);
|
||||
if (valid) {
|
||||
if (!m->WriteMachSendRight(std::move(p))) {
|
||||
if (!writer->WriteMachSendRight(std::move(p))) {
|
||||
NOTREACHED() << "Too many mach send rights for one message!";
|
||||
}
|
||||
}
|
||||
}
|
||||
static bool Read(const Message* m, PickleIterator* iter, param_type* r) {
|
||||
static bool Read(MessageReader* reader, param_type* r) {
|
||||
bool valid;
|
||||
if (!ReadParam(m, iter, &valid)) {
|
||||
if (!ReadParam(reader, &valid)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -618,7 +639,7 @@ struct ParamTraitsIPC<mozilla::UniqueMachSendRight> {
|
||||
return true;
|
||||
}
|
||||
|
||||
return m->ConsumeMachSendRight(iter, r);
|
||||
return reader->ConsumeMachSendRight(r);
|
||||
}
|
||||
};
|
||||
#endif
|
||||
@ -631,11 +652,11 @@ struct ParamTraitsMozilla : ParamTraitsIPC<P> {};
|
||||
template <>
|
||||
struct ParamTraitsMozilla<nsresult> {
|
||||
typedef nsresult param_type;
|
||||
static void Write(Message* m, const param_type& p) {
|
||||
m->WriteUInt32(static_cast<uint32_t>(p));
|
||||
static void Write(MessageWriter* writer, const param_type& p) {
|
||||
writer->WriteUInt32(static_cast<uint32_t>(p));
|
||||
}
|
||||
static bool Read(const Message* m, PickleIterator* iter, param_type* r) {
|
||||
return m->ReadUInt32(iter, reinterpret_cast<uint32_t*>(r));
|
||||
static bool Read(MessageReader* reader, param_type* r) {
|
||||
return reader->ReadUInt32(reinterpret_cast<uint32_t*>(r));
|
||||
}
|
||||
static void Log(const param_type& p, std::wstring* l) {
|
||||
l->append(StringPrintf(L"%u", static_cast<uint32_t>(p)));
|
||||
@ -646,24 +667,24 @@ struct ParamTraitsMozilla<nsresult> {
|
||||
// nsCOMPtr<T> for more details.
|
||||
template <class T>
|
||||
struct ParamTraitsMozilla<RefPtr<T>> {
|
||||
static void Write(Message* m, const RefPtr<T>& p) {
|
||||
ParamTraits<T*>::Write(m, p.get());
|
||||
static void Write(MessageWriter* writer, const RefPtr<T>& p) {
|
||||
ParamTraits<T*>::Write(writer, p.get());
|
||||
}
|
||||
|
||||
static bool Read(const Message* m, PickleIterator* iter, RefPtr<T>* r) {
|
||||
return ParamTraits<T*>::Read(m, iter, r);
|
||||
static bool Read(MessageReader* reader, RefPtr<T>* r) {
|
||||
return ParamTraits<T*>::Read(reader, r);
|
||||
}
|
||||
};
|
||||
|
||||
template <class T>
|
||||
struct ParamTraitsMozilla<nsCOMPtr<T>> {
|
||||
static void Write(Message* m, const nsCOMPtr<T>& p) {
|
||||
ParamTraits<T*>::Write(m, p.get());
|
||||
static void Write(MessageWriter* writer, const nsCOMPtr<T>& p) {
|
||||
ParamTraits<T*>::Write(writer, p.get());
|
||||
}
|
||||
|
||||
static bool Read(const Message* m, PickleIterator* iter, nsCOMPtr<T>* r) {
|
||||
static bool Read(MessageReader* reader, nsCOMPtr<T>* r) {
|
||||
RefPtr<T> refptr;
|
||||
if (!ParamTraits<T*>::Read(m, iter, &refptr)) {
|
||||
if (!ParamTraits<T*>::Read(reader, &refptr)) {
|
||||
return false;
|
||||
}
|
||||
*r = std::move(refptr);
|
||||
|
@ -32,27 +32,23 @@ mozilla::Logger& operator<<(mozilla::Logger& log, const Name& name) {
|
||||
} // namespace mojo
|
||||
|
||||
void IPC::ParamTraits<mojo::core::ports::PortName>::Write(
|
||||
Message* aMsg, const paramType& aParam) {
|
||||
WriteParam(aMsg, aParam.v1);
|
||||
WriteParam(aMsg, aParam.v2);
|
||||
MessageWriter* aWriter, const paramType& aParam) {
|
||||
WriteParam(aWriter, aParam.v1);
|
||||
WriteParam(aWriter, aParam.v2);
|
||||
}
|
||||
|
||||
bool IPC::ParamTraits<mojo::core::ports::PortName>::Read(const Message* aMsg,
|
||||
PickleIterator* aIter,
|
||||
bool IPC::ParamTraits<mojo::core::ports::PortName>::Read(MessageReader* aReader,
|
||||
paramType* aResult) {
|
||||
return ReadParam(aMsg, aIter, &aResult->v1) &&
|
||||
ReadParam(aMsg, aIter, &aResult->v2);
|
||||
return ReadParam(aReader, &aResult->v1) && ReadParam(aReader, &aResult->v2);
|
||||
}
|
||||
|
||||
void IPC::ParamTraits<mojo::core::ports::NodeName>::Write(
|
||||
Message* aMsg, const paramType& aParam) {
|
||||
WriteParam(aMsg, aParam.v1);
|
||||
WriteParam(aMsg, aParam.v2);
|
||||
MessageWriter* aWriter, const paramType& aParam) {
|
||||
WriteParam(aWriter, aParam.v1);
|
||||
WriteParam(aWriter, aParam.v2);
|
||||
}
|
||||
|
||||
bool IPC::ParamTraits<mojo::core::ports::NodeName>::Read(const Message* aMsg,
|
||||
PickleIterator* aIter,
|
||||
bool IPC::ParamTraits<mojo::core::ports::NodeName>::Read(MessageReader* aReader,
|
||||
paramType* aResult) {
|
||||
return ReadParam(aMsg, aIter, &aResult->v1) &&
|
||||
ReadParam(aMsg, aIter, &aResult->v2);
|
||||
return ReadParam(aReader, &aResult->v1) && ReadParam(aReader, &aResult->v2);
|
||||
}
|
||||
|
@ -106,17 +106,15 @@ class MessageWriter;
|
||||
template <>
|
||||
struct ParamTraits<mojo::core::ports::PortName> {
|
||||
using paramType = mojo::core::ports::PortName;
|
||||
static void Write(Message* aMsg, const paramType& aParam);
|
||||
static bool Read(const Message* aMsg, PickleIterator* aIter,
|
||||
paramType* aResult);
|
||||
static void Write(MessageWriter* aWriter, const paramType& aParam);
|
||||
static bool Read(MessageReader* aReader, paramType* aResult);
|
||||
};
|
||||
|
||||
template <>
|
||||
struct ParamTraits<mojo::core::ports::NodeName> {
|
||||
using paramType = mojo::core::ports::NodeName;
|
||||
static void Write(Message* aMsg, const paramType& aParam);
|
||||
static bool Read(const Message* aMsg, PickleIterator* aIter,
|
||||
paramType* aResult);
|
||||
static void Write(MessageWriter* aWriter, const paramType& aParam);
|
||||
static bool Read(MessageReader* aReader, paramType* aResult);
|
||||
};
|
||||
|
||||
} // namespace IPC
|
||||
|
@ -26,17 +26,15 @@ template <class ParamType>
|
||||
struct OriginAttributesParamTraits {
|
||||
typedef ParamType paramType;
|
||||
|
||||
static void Write(Message* aMsg, const paramType& aParam) {
|
||||
static void Write(MessageWriter* aWriter, const paramType& aParam) {
|
||||
nsAutoCString suffix;
|
||||
aParam.CreateSuffix(suffix);
|
||||
WriteParam(aMsg, suffix);
|
||||
WriteParam(aWriter, suffix);
|
||||
}
|
||||
|
||||
static bool Read(const Message* aMsg, PickleIterator* aIter,
|
||||
paramType* aResult) {
|
||||
static bool Read(MessageReader* aReader, paramType* aResult) {
|
||||
nsAutoCString suffix;
|
||||
return ReadParam(aMsg, aIter, &suffix) &&
|
||||
aResult->PopulateFromSuffix(suffix);
|
||||
return ReadParam(aReader, &suffix) && aResult->PopulateFromSuffix(suffix);
|
||||
}
|
||||
};
|
||||
} // namespace detail
|
||||
|
@ -24,34 +24,33 @@ struct ParamTraits<mozilla::ipc::ByteBuf> {
|
||||
|
||||
// this is where we transfer the memory from the ByteBuf to IPDL, avoiding a
|
||||
// copy
|
||||
static void Write(Message* aMsg, paramType&& aParam) {
|
||||
static void Write(MessageWriter* aWriter, paramType&& aParam) {
|
||||
// We need to send the length as a 32-bit value, not a size_t, because on
|
||||
// ARM64 Windows we end up with a 32-bit GMP process sending a ByteBuf to
|
||||
// a 64-bit parent process. WriteBytesZeroCopy takes a uint32_t as an
|
||||
// argument, so it would end up getting truncated anyways. See bug 1757534.
|
||||
mozilla::CheckedInt<uint32_t> length = aParam.mLen;
|
||||
MOZ_RELEASE_ASSERT(length.isValid());
|
||||
WriteParam(aMsg, length.value());
|
||||
WriteParam(aWriter, length.value());
|
||||
// hand over ownership of the buffer to the Message
|
||||
aMsg->WriteBytesZeroCopy(aParam.mData, length.value(), aParam.mCapacity);
|
||||
aWriter->WriteBytesZeroCopy(aParam.mData, length.value(), aParam.mCapacity);
|
||||
aParam.mData = nullptr;
|
||||
aParam.mCapacity = 0;
|
||||
aParam.mLen = 0;
|
||||
}
|
||||
|
||||
static bool Read(const Message* aMsg, PickleIterator* aIter,
|
||||
paramType* aResult) {
|
||||
static bool Read(MessageReader* aReader, 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)
|
||||
uint32_t length;
|
||||
if (!ReadParam(aMsg, aIter, &length)) return false;
|
||||
if (!ReadParam(aReader, &length)) return false;
|
||||
if (!aResult->Allocate(length)) {
|
||||
mozalloc_handle_oom(length);
|
||||
return false;
|
||||
}
|
||||
return aMsg->ReadBytesInto(aIter, aResult->mData, length);
|
||||
return aReader->ReadBytesInto(aResult->mData, length);
|
||||
}
|
||||
|
||||
static void Log(const paramType& aParam, std::wstring* aLog) {
|
||||
|
@ -413,12 +413,12 @@ nsCString DataPipeBase::Describe(DataPipeAutoLock& aLock) {
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
void DataPipeWrite(IPC::Message* aMsg, T* aParam) {
|
||||
void DataPipeWrite(IPC::MessageWriter* aWriter, T* aParam) {
|
||||
DataPipeAutoLock lock(*aParam->mMutex);
|
||||
MOZ_LOG(gDataPipeLog, LogLevel::Debug,
|
||||
("IPC Write: %s", aParam->Describe(lock).get()));
|
||||
|
||||
WriteParam(aMsg, aParam->mStatus);
|
||||
WriteParam(aWriter, aParam->mStatus);
|
||||
if (NS_FAILED(aParam->mStatus)) {
|
||||
return;
|
||||
}
|
||||
@ -427,12 +427,12 @@ void DataPipeWrite(IPC::Message* aMsg, T* aParam) {
|
||||
"cannot transfer while processing a segment");
|
||||
|
||||
// Serialize relevant parameters to our peer.
|
||||
WriteParam(aMsg, std::move(aParam->mLink->mPort));
|
||||
MOZ_ALWAYS_TRUE(aParam->mLink->mShmem->WriteHandle(aMsg));
|
||||
WriteParam(aMsg, aParam->mLink->mCapacity);
|
||||
WriteParam(aMsg, aParam->mLink->mPeerStatus);
|
||||
WriteParam(aMsg, aParam->mLink->mOffset);
|
||||
WriteParam(aMsg, aParam->mLink->mAvailable);
|
||||
WriteParam(aWriter, std::move(aParam->mLink->mPort));
|
||||
MOZ_ALWAYS_TRUE(aParam->mLink->mShmem->WriteHandle(aWriter));
|
||||
WriteParam(aWriter, aParam->mLink->mCapacity);
|
||||
WriteParam(aWriter, aParam->mLink->mPeerStatus);
|
||||
WriteParam(aWriter, aParam->mLink->mOffset);
|
||||
WriteParam(aWriter, aParam->mLink->mAvailable);
|
||||
|
||||
// Mark our peer as closed so we don't try to send to it when closing.
|
||||
aParam->mLink->mPeerStatus = NS_ERROR_NOT_INITIALIZED;
|
||||
@ -440,10 +440,9 @@ void DataPipeWrite(IPC::Message* aMsg, T* aParam) {
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
bool DataPipeRead(const IPC::Message* aMsg, PickleIterator* aIter,
|
||||
RefPtr<T>* aResult) {
|
||||
bool DataPipeRead(IPC::MessageReader* aReader, RefPtr<T>* aResult) {
|
||||
nsresult rv = NS_OK;
|
||||
if (!ReadParam(aMsg, aIter, &rv)) {
|
||||
if (!ReadParam(aReader, &rv)) {
|
||||
NS_WARNING("failed to read status!");
|
||||
return false;
|
||||
}
|
||||
@ -460,10 +459,9 @@ bool DataPipeRead(const IPC::Message* aMsg, PickleIterator* aIter,
|
||||
nsresult peerStatus = NS_OK;
|
||||
uint32_t offset = 0;
|
||||
uint32_t available = 0;
|
||||
if (!ReadParam(aMsg, aIter, &port) || !shmem->ReadHandle(aMsg, aIter) ||
|
||||
!ReadParam(aMsg, aIter, &capacity) ||
|
||||
!ReadParam(aMsg, aIter, &peerStatus) ||
|
||||
!ReadParam(aMsg, aIter, &offset) || !ReadParam(aMsg, aIter, &available)) {
|
||||
if (!ReadParam(aReader, &port) || !shmem->ReadHandle(aReader) ||
|
||||
!ReadParam(aReader, &capacity) || !ReadParam(aReader, &peerStatus) ||
|
||||
!ReadParam(aReader, &offset) || !ReadParam(aReader, &available)) {
|
||||
NS_WARNING("failed to read fields!");
|
||||
return false;
|
||||
}
|
||||
@ -685,23 +683,21 @@ nsresult NewDataPipe(uint32_t aCapacity, DataPipeSender** aSender,
|
||||
} // namespace mozilla
|
||||
|
||||
void IPC::ParamTraits<mozilla::ipc::DataPipeSender*>::Write(
|
||||
Message* aMsg, mozilla::ipc::DataPipeSender* aParam) {
|
||||
mozilla::ipc::data_pipe_detail::DataPipeWrite(aMsg, aParam);
|
||||
MessageWriter* aWriter, mozilla::ipc::DataPipeSender* aParam) {
|
||||
mozilla::ipc::data_pipe_detail::DataPipeWrite(aWriter, aParam);
|
||||
}
|
||||
|
||||
bool IPC::ParamTraits<mozilla::ipc::DataPipeSender*>::Read(
|
||||
const Message* aMsg, PickleIterator* aIter,
|
||||
RefPtr<mozilla::ipc::DataPipeSender>* aResult) {
|
||||
return mozilla::ipc::data_pipe_detail::DataPipeRead(aMsg, aIter, aResult);
|
||||
MessageReader* aReader, RefPtr<mozilla::ipc::DataPipeSender>* aResult) {
|
||||
return mozilla::ipc::data_pipe_detail::DataPipeRead(aReader, aResult);
|
||||
}
|
||||
|
||||
void IPC::ParamTraits<mozilla::ipc::DataPipeReceiver*>::Write(
|
||||
Message* aMsg, mozilla::ipc::DataPipeReceiver* aParam) {
|
||||
mozilla::ipc::data_pipe_detail::DataPipeWrite(aMsg, aParam);
|
||||
MessageWriter* aWriter, mozilla::ipc::DataPipeReceiver* aParam) {
|
||||
mozilla::ipc::data_pipe_detail::DataPipeWrite(aWriter, aParam);
|
||||
}
|
||||
|
||||
bool IPC::ParamTraits<mozilla::ipc::DataPipeReceiver*>::Read(
|
||||
const Message* aMsg, PickleIterator* aIter,
|
||||
RefPtr<mozilla::ipc::DataPipeReceiver>* aResult) {
|
||||
return mozilla::ipc::data_pipe_detail::DataPipeRead(aMsg, aIter, aResult);
|
||||
MessageReader* aReader, RefPtr<mozilla::ipc::DataPipeReceiver>* aResult) {
|
||||
return mozilla::ipc::data_pipe_detail::DataPipeRead(aReader, aResult);
|
||||
}
|
||||
|
@ -59,11 +59,10 @@ class DataPipeBase {
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
void DataPipeWrite(IPC::Message* aMsg, T* aParam);
|
||||
void DataPipeWrite(IPC::MessageWriter* aWriter, T* aParam);
|
||||
|
||||
template <typename T>
|
||||
bool DataPipeRead(const IPC::Message* aMsg, PickleIterator* aIter,
|
||||
RefPtr<T>* aResult);
|
||||
bool DataPipeRead(IPC::MessageReader* aReader, RefPtr<T>* aResult);
|
||||
|
||||
} // namespace data_pipe_detail
|
||||
|
||||
@ -89,10 +88,9 @@ class DataPipeSender final : public nsIAsyncOutputStream,
|
||||
private:
|
||||
friend nsresult NewDataPipe(uint32_t, DataPipeSender**, DataPipeReceiver**);
|
||||
friend void data_pipe_detail::DataPipeWrite<DataPipeSender>(
|
||||
IPC::Message* aMsg, DataPipeSender* aParam);
|
||||
IPC::MessageWriter* aWriter, DataPipeSender* aParam);
|
||||
friend bool data_pipe_detail::DataPipeRead<DataPipeSender>(
|
||||
const IPC::Message* aMsg, PickleIterator* aIter,
|
||||
RefPtr<DataPipeSender>* aResult);
|
||||
IPC::MessageReader* aReader, RefPtr<DataPipeSender>* aResult);
|
||||
|
||||
explicit DataPipeSender(nsresult aError)
|
||||
: data_pipe_detail::DataPipeBase(/* aReceiverSide */ false, aError) {}
|
||||
@ -128,10 +126,9 @@ class DataPipeReceiver final : public nsIAsyncInputStream,
|
||||
private:
|
||||
friend nsresult NewDataPipe(uint32_t, DataPipeSender**, DataPipeReceiver**);
|
||||
friend void data_pipe_detail::DataPipeWrite<DataPipeReceiver>(
|
||||
IPC::Message* aMsg, DataPipeReceiver* aParam);
|
||||
IPC::MessageWriter* aWriter, DataPipeReceiver* aParam);
|
||||
friend bool data_pipe_detail::DataPipeRead<DataPipeReceiver>(
|
||||
const IPC::Message* aMsg, PickleIterator* aIter,
|
||||
RefPtr<DataPipeReceiver>* aResult);
|
||||
IPC::MessageReader* aReader, RefPtr<DataPipeReceiver>* aResult);
|
||||
|
||||
explicit DataPipeReceiver(nsresult aError)
|
||||
: data_pipe_detail::DataPipeBase(/* aReceiverSide */ true, aError) {}
|
||||
@ -164,15 +161,17 @@ namespace IPC {
|
||||
|
||||
template <>
|
||||
struct ParamTraits<mozilla::ipc::DataPipeSender*> {
|
||||
static void Write(Message* aMsg, mozilla::ipc::DataPipeSender* aParam);
|
||||
static bool Read(const Message* aMsg, PickleIterator* aIter,
|
||||
static void Write(MessageWriter* aWriter,
|
||||
mozilla::ipc::DataPipeSender* aParam);
|
||||
static bool Read(MessageReader* aReader,
|
||||
RefPtr<mozilla::ipc::DataPipeSender>* aResult);
|
||||
};
|
||||
|
||||
template <>
|
||||
struct ParamTraits<mozilla::ipc::DataPipeReceiver*> {
|
||||
static void Write(Message* aMsg, mozilla::ipc::DataPipeReceiver* aParam);
|
||||
static bool Read(const Message* aMsg, PickleIterator* aIter,
|
||||
static void Write(MessageWriter* aWriter,
|
||||
mozilla::ipc::DataPipeReceiver* aParam);
|
||||
static bool Read(MessageReader* aReader,
|
||||
RefPtr<mozilla::ipc::DataPipeReceiver>* aResult);
|
||||
};
|
||||
|
||||
|
@ -96,11 +96,11 @@ bool UntypedManagedEndpoint::BindCommon(IProtocol* aActor,
|
||||
}
|
||||
|
||||
/* static */
|
||||
void IPDLParamTraits<UntypedManagedEndpoint>::Write(IPC::Message* aMsg,
|
||||
void IPDLParamTraits<UntypedManagedEndpoint>::Write(IPC::MessageWriter* aWriter,
|
||||
IProtocol* aActor,
|
||||
paramType&& aParam) {
|
||||
bool isValid = aParam.mInner.isSome();
|
||||
WriteIPDLParam(aMsg, aActor, isValid);
|
||||
WriteIPDLParam(aWriter, aActor, isValid);
|
||||
if (!isValid) {
|
||||
return;
|
||||
}
|
||||
@ -116,20 +116,19 @@ void IPDLParamTraits<UntypedManagedEndpoint>::Write(IPC::Message* aMsg,
|
||||
aActor->ToplevelProtocol(),
|
||||
"Must be being sent over the same toplevel protocol");
|
||||
|
||||
WriteIPDLParam(aMsg, aActor, inner.mId);
|
||||
WriteIPDLParam(aMsg, aActor, inner.mType);
|
||||
WriteIPDLParam(aMsg, aActor, inner.mManagerId);
|
||||
WriteIPDLParam(aMsg, aActor, inner.mManagerType);
|
||||
WriteIPDLParam(aWriter, aActor, inner.mId);
|
||||
WriteIPDLParam(aWriter, aActor, inner.mType);
|
||||
WriteIPDLParam(aWriter, aActor, inner.mManagerId);
|
||||
WriteIPDLParam(aWriter, aActor, inner.mManagerType);
|
||||
}
|
||||
|
||||
/* static */
|
||||
bool IPDLParamTraits<UntypedManagedEndpoint>::Read(const IPC::Message* aMsg,
|
||||
PickleIterator* aIter,
|
||||
bool IPDLParamTraits<UntypedManagedEndpoint>::Read(IPC::MessageReader* aReader,
|
||||
IProtocol* aActor,
|
||||
paramType* aResult) {
|
||||
*aResult = UntypedManagedEndpoint{};
|
||||
bool isValid = false;
|
||||
if (!aActor || !ReadIPDLParam(aMsg, aIter, aActor, &isValid)) {
|
||||
if (!aActor || !ReadIPDLParam(aReader, aActor, &isValid)) {
|
||||
return false;
|
||||
}
|
||||
if (!isValid) {
|
||||
@ -139,10 +138,10 @@ bool IPDLParamTraits<UntypedManagedEndpoint>::Read(const IPC::Message* aMsg,
|
||||
aResult->mInner.emplace();
|
||||
auto& inner = *aResult->mInner;
|
||||
inner.mToplevel = aActor->ToplevelProtocol()->GetWeakLifecycleProxy();
|
||||
return ReadIPDLParam(aMsg, aIter, aActor, &inner.mId) &&
|
||||
ReadIPDLParam(aMsg, aIter, aActor, &inner.mType) &&
|
||||
ReadIPDLParam(aMsg, aIter, aActor, &inner.mManagerId) &&
|
||||
ReadIPDLParam(aMsg, aIter, aActor, &inner.mManagerType);
|
||||
return ReadIPDLParam(aReader, aActor, &inner.mId) &&
|
||||
ReadIPDLParam(aReader, aActor, &inner.mType) &&
|
||||
ReadIPDLParam(aReader, aActor, &inner.mManagerId) &&
|
||||
ReadIPDLParam(aReader, aActor, &inner.mManagerType);
|
||||
}
|
||||
|
||||
} // namespace mozilla::ipc
|
||||
|
@ -53,19 +53,18 @@ struct EnumSerializer {
|
||||
typedef typename mozilla::UnsignedStdintTypeForSize<sizeof(paramType)>::Type
|
||||
uintParamType;
|
||||
|
||||
static void Write(Message* aMsg, const paramType& aValue) {
|
||||
static void Write(MessageWriter* aWriter, const paramType& aValue) {
|
||||
// XXX This assertion is somewhat meaningless at least for E that don't have
|
||||
// a fixed underlying type: if aValue weren't a legal value, we would
|
||||
// already have UB where this function is called.
|
||||
MOZ_RELEASE_ASSERT(EnumValidator::IsLegalValue(
|
||||
static_cast<std::underlying_type_t<paramType>>(aValue)));
|
||||
WriteParam(aMsg, uintParamType(aValue));
|
||||
WriteParam(aWriter, uintParamType(aValue));
|
||||
}
|
||||
|
||||
static bool Read(const Message* aMsg, PickleIterator* aIter,
|
||||
paramType* aResult) {
|
||||
static bool Read(MessageReader* aReader, paramType* aResult) {
|
||||
uintParamType value;
|
||||
if (!ReadParam(aMsg, aIter, &value)) {
|
||||
if (!ReadParam(aReader, &value)) {
|
||||
CrashReporter::AnnotateCrashReport(
|
||||
CrashReporter::Annotation::IPCReadErrorReason, "Bad iter"_ns);
|
||||
return false;
|
||||
|
@ -92,18 +92,17 @@ FileDescriptor::UniquePlatformHandle FileDescriptor::Clone(
|
||||
return UniqueFileHandle();
|
||||
}
|
||||
|
||||
void IPDLParamTraits<FileDescriptor>::Write(IPC::Message* aMsg,
|
||||
void IPDLParamTraits<FileDescriptor>::Write(IPC::MessageWriter* aWriter,
|
||||
IProtocol* aActor,
|
||||
const FileDescriptor& aParam) {
|
||||
WriteIPDLParam(aMsg, aActor, aParam.ClonePlatformHandle());
|
||||
WriteIPDLParam(aWriter, aActor, aParam.ClonePlatformHandle());
|
||||
}
|
||||
|
||||
bool IPDLParamTraits<FileDescriptor>::Read(const IPC::Message* aMsg,
|
||||
PickleIterator* aIter,
|
||||
bool IPDLParamTraits<FileDescriptor>::Read(IPC::MessageReader* aReader,
|
||||
IProtocol* aActor,
|
||||
FileDescriptor* aResult) {
|
||||
UniqueFileHandle handle;
|
||||
if (!ReadIPDLParam(aMsg, aIter, aActor, &handle)) {
|
||||
if (!ReadIPDLParam(aReader, aActor, &handle)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -69,13 +69,12 @@ struct PlainOldDataSerializer {
|
||||
|
||||
typedef T paramType;
|
||||
|
||||
static void Write(Message* aMsg, const paramType& aParam) {
|
||||
aMsg->WriteBytes(&aParam, sizeof(aParam));
|
||||
static void Write(MessageWriter* aWriter, const paramType& aParam) {
|
||||
aWriter->WriteBytes(&aParam, sizeof(aParam));
|
||||
}
|
||||
|
||||
static bool Read(const Message* aMsg, PickleIterator* aIter,
|
||||
paramType* aResult) {
|
||||
return aMsg->ReadBytesInto(aIter, aResult, sizeof(paramType));
|
||||
static bool Read(MessageReader* aReader, paramType* aResult) {
|
||||
return aReader->ReadBytesInto(aResult, sizeof(paramType));
|
||||
}
|
||||
};
|
||||
|
||||
@ -87,10 +86,9 @@ template <typename T>
|
||||
struct EmptyStructSerializer {
|
||||
typedef T paramType;
|
||||
|
||||
static void Write(Message* aMsg, const paramType& aParam) {}
|
||||
static void Write(MessageWriter* aWriter, const paramType& aParam) {}
|
||||
|
||||
static bool Read(const Message* aMsg, PickleIterator* aIter,
|
||||
paramType* aResult) {
|
||||
static bool Read(MessageReader* aReader, paramType* aResult) {
|
||||
*aResult = {};
|
||||
return true;
|
||||
}
|
||||
@ -100,13 +98,12 @@ template <>
|
||||
struct ParamTraits<int8_t> {
|
||||
typedef int8_t paramType;
|
||||
|
||||
static void Write(Message* aMsg, const paramType& aParam) {
|
||||
aMsg->WriteBytes(&aParam, sizeof(aParam));
|
||||
static void Write(MessageWriter* aWriter, const paramType& aParam) {
|
||||
aWriter->WriteBytes(&aParam, sizeof(aParam));
|
||||
}
|
||||
|
||||
static bool Read(const Message* aMsg, PickleIterator* aIter,
|
||||
paramType* aResult) {
|
||||
return aMsg->ReadBytesInto(aIter, aResult, sizeof(*aResult));
|
||||
static bool Read(MessageReader* aReader, paramType* aResult) {
|
||||
return aReader->ReadBytesInto(aResult, sizeof(*aResult));
|
||||
}
|
||||
|
||||
static void Log(const paramType& aParam, std::wstring* aLog) {
|
||||
@ -119,13 +116,12 @@ template <>
|
||||
struct ParamTraits<uint8_t> {
|
||||
typedef uint8_t paramType;
|
||||
|
||||
static void Write(Message* aMsg, const paramType& aParam) {
|
||||
aMsg->WriteBytes(&aParam, sizeof(aParam));
|
||||
static void Write(MessageWriter* aWriter, const paramType& aParam) {
|
||||
aWriter->WriteBytes(&aParam, sizeof(aParam));
|
||||
}
|
||||
|
||||
static bool Read(const Message* aMsg, PickleIterator* aIter,
|
||||
paramType* aResult) {
|
||||
return aMsg->ReadBytesInto(aIter, aResult, sizeof(*aResult));
|
||||
static bool Read(MessageReader* aReader, paramType* aResult) {
|
||||
return aReader->ReadBytesInto(aResult, sizeof(*aResult));
|
||||
}
|
||||
|
||||
static void Log(const paramType& aParam, std::wstring* aLog) {
|
||||
@ -138,11 +134,10 @@ struct ParamTraits<uint8_t> {
|
||||
template <>
|
||||
struct ParamTraits<base::FileDescriptor> {
|
||||
typedef base::FileDescriptor paramType;
|
||||
static void Write(Message* aMsg, const paramType& aParam) {
|
||||
static void Write(MessageWriter* aWriter, const paramType& aParam) {
|
||||
MOZ_CRASH("FileDescriptor isn't meaningful on this platform");
|
||||
}
|
||||
static bool Read(const Message* aMsg, PickleIterator* aIter,
|
||||
paramType* aResult) {
|
||||
static bool Read(MessageReader* aReader, paramType* aResult) {
|
||||
MOZ_CRASH("FileDescriptor isn't meaningful on this platform");
|
||||
return false;
|
||||
}
|
||||
@ -152,9 +147,8 @@ struct ParamTraits<base::FileDescriptor> {
|
||||
template <>
|
||||
struct ParamTraits<mozilla::void_t> {
|
||||
typedef mozilla::void_t paramType;
|
||||
static void Write(Message* aMsg, const paramType& aParam) {}
|
||||
static bool Read(const Message* aMsg, PickleIterator* aIter,
|
||||
paramType* aResult) {
|
||||
static void Write(MessageWriter* aWriter, const paramType& aParam) {}
|
||||
static bool Read(MessageReader* aReader, paramType* aResult) {
|
||||
*aResult = paramType();
|
||||
return true;
|
||||
}
|
||||
@ -163,9 +157,8 @@ struct ParamTraits<mozilla::void_t> {
|
||||
template <>
|
||||
struct ParamTraits<mozilla::null_t> {
|
||||
typedef mozilla::null_t paramType;
|
||||
static void Write(Message* aMsg, const paramType& aParam) {}
|
||||
static bool Read(const Message* aMsg, PickleIterator* aIter,
|
||||
paramType* aResult) {
|
||||
static void Write(MessageWriter* aWriter, const paramType& aParam) {}
|
||||
static bool Read(MessageReader* aReader, paramType* aResult) {
|
||||
*aResult = paramType();
|
||||
return true;
|
||||
}
|
||||
@ -178,11 +171,10 @@ struct BitfieldHelper {
|
||||
// We need this helper because we can't get the address of a bitfield to
|
||||
// pass directly to ReadParam. So instead we read it into a temporary bool
|
||||
// and set the bitfield using a setter function
|
||||
static bool ReadBoolForBitfield(const Message* aMsg, PickleIterator* aIter,
|
||||
ParamType* aResult,
|
||||
static bool ReadBoolForBitfield(MessageReader* aReader, ParamType* aResult,
|
||||
void (ParamType::*aSetter)(bool)) {
|
||||
bool value;
|
||||
if (ReadParam(aMsg, aIter, &value)) {
|
||||
if (ReadParam(aReader, &value)) {
|
||||
(aResult->*aSetter)(value);
|
||||
return true;
|
||||
}
|
||||
@ -195,14 +187,13 @@ struct BitfieldHelper {
|
||||
// ReadParams(aMsg, aIter, aParam.foo, aParam.bar, aParam.baz)
|
||||
|
||||
template <typename... Ts>
|
||||
static void WriteParams(Message* aMsg, const Ts&... aArgs) {
|
||||
(WriteParam(aMsg, aArgs), ...);
|
||||
static void WriteParams(MessageWriter* aWriter, const Ts&... aArgs) {
|
||||
(WriteParam(aWriter, aArgs), ...);
|
||||
}
|
||||
|
||||
template <typename... Ts>
|
||||
static bool ReadParams(const Message* aMsg, PickleIterator* aIter,
|
||||
Ts&... aArgs) {
|
||||
return (ReadParam(aMsg, aIter, &aArgs) && ...);
|
||||
static bool ReadParams(MessageReader* aReader, Ts&... aArgs) {
|
||||
return (ReadParam(aReader, &aArgs) && ...);
|
||||
}
|
||||
|
||||
// Macros that allow syntax like:
|
||||
@ -215,15 +206,14 @@ static bool ReadParams(const Message* aMsg, PickleIterator* aIter,
|
||||
template <> \
|
||||
struct ParamTraits<Type> { \
|
||||
typedef Type paramType; \
|
||||
static void Write(Message* aMsg, const paramType& aParam) { \
|
||||
WriteParams(aMsg, MOZ_FOR_EACH_SEPARATED(ACCESS_PARAM_FIELD, (, ), (), \
|
||||
(__VA_ARGS__))); \
|
||||
static void Write(MessageWriter* aWriter, const paramType& aParam) { \
|
||||
WriteParams(aWriter, MOZ_FOR_EACH_SEPARATED(ACCESS_PARAM_FIELD, (, ), \
|
||||
(), (__VA_ARGS__))); \
|
||||
} \
|
||||
\
|
||||
static bool Read(const Message* aMsg, PickleIterator* aIter, \
|
||||
paramType* aResult) { \
|
||||
static bool Read(MessageReader* aReader, paramType* aResult) { \
|
||||
paramType& aParam = *aResult; \
|
||||
return ReadParams(aMsg, aIter, \
|
||||
return ReadParams(aReader, \
|
||||
MOZ_FOR_EACH_SEPARATED(ACCESS_PARAM_FIELD, (, ), (), \
|
||||
(__VA_ARGS__))); \
|
||||
} \
|
||||
@ -239,17 +229,16 @@ static bool ReadParams(const Message* aMsg, PickleIterator* aIter,
|
||||
template <> \
|
||||
struct ParamTraits<Type> { \
|
||||
typedef Type paramType; \
|
||||
static void Write(Message* aMsg, const paramType& aParam) { \
|
||||
WriteParam(aMsg, static_cast<const Super&>(aParam)); \
|
||||
WriteParams(aMsg, MOZ_FOR_EACH_SEPARATED(ACCESS_PARAM_FIELD, (, ), (), \
|
||||
(__VA_ARGS__))); \
|
||||
static void Write(MessageWriter* aWriter, const paramType& aParam) { \
|
||||
WriteParam(aWriter, static_cast<const Super&>(aParam)); \
|
||||
WriteParams(aWriter, MOZ_FOR_EACH_SEPARATED(ACCESS_PARAM_FIELD, (, ), \
|
||||
(), (__VA_ARGS__))); \
|
||||
} \
|
||||
\
|
||||
static bool Read(const Message* aMsg, PickleIterator* aIter, \
|
||||
paramType* aResult) { \
|
||||
static bool Read(MessageReader* aReader, paramType* aResult) { \
|
||||
paramType& aParam = *aResult; \
|
||||
return ReadParam(aMsg, aIter, static_cast<Super*>(aResult)) && \
|
||||
ReadParams(aMsg, aIter, \
|
||||
return ReadParam(aReader, static_cast<Super*>(aResult)) && \
|
||||
ReadParams(aReader, \
|
||||
MOZ_FOR_EACH_SEPARATED(ACCESS_PARAM_FIELD, (, ), (), \
|
||||
(__VA_ARGS__))); \
|
||||
} \
|
||||
|
@ -21,29 +21,29 @@ static_assert(kDynamicAtomToken >= kAtomsCount,
|
||||
"Exceeded supported number of static atoms");
|
||||
|
||||
/* static */
|
||||
void ParamTraits<nsAtom*>::Write(Message* aMsg, const nsAtom* aParam) {
|
||||
void ParamTraits<nsAtom*>::Write(MessageWriter* aWriter, const nsAtom* aParam) {
|
||||
MOZ_ASSERT(aParam);
|
||||
|
||||
if (aParam->IsStatic()) {
|
||||
const nsStaticAtom* atom = aParam->AsStatic();
|
||||
uint16_t index = static_cast<uint16_t>(nsGkAtoms::IndexOf(atom));
|
||||
MOZ_ASSERT(index < kAtomsCount);
|
||||
WriteParam(aMsg, index);
|
||||
WriteParam(aWriter, index);
|
||||
return;
|
||||
}
|
||||
WriteParam(aMsg, kDynamicAtomToken);
|
||||
WriteParam(aWriter, kDynamicAtomToken);
|
||||
nsDependentAtomString atomStr(aParam);
|
||||
// nsDependentAtomString is serialized as its base, nsString, but we
|
||||
// can be explicit about it.
|
||||
nsString& str = atomStr;
|
||||
WriteParam(aMsg, str);
|
||||
WriteParam(aWriter, str);
|
||||
}
|
||||
|
||||
/* static */
|
||||
bool ParamTraits<nsAtom*>::Read(const Message* aMsg, PickleIterator* aIter,
|
||||
bool ParamTraits<nsAtom*>::Read(MessageReader* aReader,
|
||||
RefPtr<nsAtom>* aResult) {
|
||||
uint16_t token;
|
||||
if (!ReadParam(aMsg, aIter, &token)) {
|
||||
if (!ReadParam(aReader, &token)) {
|
||||
return false;
|
||||
}
|
||||
if (token != kDynamicAtomToken) {
|
||||
@ -55,7 +55,7 @@ bool ParamTraits<nsAtom*>::Read(const Message* aMsg, PickleIterator* aIter,
|
||||
}
|
||||
|
||||
nsAutoString str;
|
||||
if (!ReadParam(aMsg, aIter, static_cast<nsString*>(&str))) {
|
||||
if (!ReadParam(aReader, static_cast<nsString*>(&str))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -77,23 +77,22 @@ template <>
|
||||
struct ParamTraits<nsACString> {
|
||||
typedef nsACString paramType;
|
||||
|
||||
static void Write(Message* aMsg, const paramType& aParam) {
|
||||
static void Write(MessageWriter* aWriter, const paramType& aParam) {
|
||||
bool isVoid = aParam.IsVoid();
|
||||
aMsg->WriteBool(isVoid);
|
||||
aWriter->WriteBool(isVoid);
|
||||
|
||||
if (isVoid)
|
||||
// represents a nullptr pointer
|
||||
return;
|
||||
|
||||
uint32_t length = aParam.Length();
|
||||
WriteParam(aMsg, length);
|
||||
aMsg->WriteBytes(aParam.BeginReading(), length);
|
||||
WriteParam(aWriter, length);
|
||||
aWriter->WriteBytes(aParam.BeginReading(), length);
|
||||
}
|
||||
|
||||
static bool Read(const Message* aMsg, PickleIterator* aIter,
|
||||
paramType* aResult) {
|
||||
static bool Read(MessageReader* aReader, paramType* aResult) {
|
||||
bool isVoid;
|
||||
if (!aMsg->ReadBool(aIter, &isVoid)) return false;
|
||||
if (!aReader->ReadBool(&isVoid)) return false;
|
||||
|
||||
if (isVoid) {
|
||||
aResult->SetIsVoid(true);
|
||||
@ -101,15 +100,15 @@ struct ParamTraits<nsACString> {
|
||||
}
|
||||
|
||||
uint32_t length;
|
||||
if (!ReadParam(aMsg, aIter, &length)) {
|
||||
if (!ReadParam(aReader, &length)) {
|
||||
return false;
|
||||
}
|
||||
if (!aMsg->HasBytesAvailable(aIter, length)) {
|
||||
if (!aReader->HasBytesAvailable(length)) {
|
||||
return false;
|
||||
}
|
||||
aResult->SetLength(length);
|
||||
|
||||
return aMsg->ReadBytesInto(aIter, aResult->BeginWriting(), length);
|
||||
return aReader->ReadBytesInto(aResult->BeginWriting(), length);
|
||||
}
|
||||
|
||||
static void Log(const paramType& aParam, std::wstring* aLog) {
|
||||
@ -124,23 +123,22 @@ template <>
|
||||
struct ParamTraits<nsAString> {
|
||||
typedef nsAString paramType;
|
||||
|
||||
static void Write(Message* aMsg, const paramType& aParam) {
|
||||
static void Write(MessageWriter* aWriter, const paramType& aParam) {
|
||||
bool isVoid = aParam.IsVoid();
|
||||
aMsg->WriteBool(isVoid);
|
||||
aWriter->WriteBool(isVoid);
|
||||
|
||||
if (isVoid)
|
||||
// represents a nullptr pointer
|
||||
return;
|
||||
|
||||
uint32_t length = aParam.Length();
|
||||
WriteParam(aMsg, length);
|
||||
aMsg->WriteBytes(aParam.BeginReading(), length * sizeof(char16_t));
|
||||
WriteParam(aWriter, length);
|
||||
aWriter->WriteBytes(aParam.BeginReading(), length * sizeof(char16_t));
|
||||
}
|
||||
|
||||
static bool Read(const Message* aMsg, PickleIterator* aIter,
|
||||
paramType* aResult) {
|
||||
static bool Read(MessageReader* aReader, paramType* aResult) {
|
||||
bool isVoid;
|
||||
if (!aMsg->ReadBool(aIter, &isVoid)) return false;
|
||||
if (!aReader->ReadBool(&isVoid)) return false;
|
||||
|
||||
if (isVoid) {
|
||||
aResult->SetIsVoid(true);
|
||||
@ -148,21 +146,20 @@ struct ParamTraits<nsAString> {
|
||||
}
|
||||
|
||||
uint32_t length;
|
||||
if (!ReadParam(aMsg, aIter, &length)) {
|
||||
if (!ReadParam(aReader, &length)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
mozilla::CheckedInt<uint32_t> byteLength =
|
||||
mozilla::CheckedInt<uint32_t>(length) * sizeof(char16_t);
|
||||
if (!byteLength.isValid() ||
|
||||
!aMsg->HasBytesAvailable(aIter, byteLength.value())) {
|
||||
!aReader->HasBytesAvailable(byteLength.value())) {
|
||||
return false;
|
||||
}
|
||||
|
||||
aResult->SetLength(length);
|
||||
|
||||
return aMsg->ReadBytesInto(aIter, aResult->BeginWriting(),
|
||||
byteLength.value());
|
||||
return aReader->ReadBytesInto(aResult->BeginWriting(), byteLength.value());
|
||||
}
|
||||
|
||||
static void Log(const paramType& aParam, std::wstring* aLog) {
|
||||
@ -236,24 +233,23 @@ template <>
|
||||
struct ParamTraits<nsTHashSet<uint64_t>> {
|
||||
typedef nsTHashSet<uint64_t> paramType;
|
||||
|
||||
static void Write(Message* aMsg, const paramType& aParam) {
|
||||
static void Write(MessageWriter* aWriter, const paramType& aParam) {
|
||||
uint32_t count = aParam.Count();
|
||||
WriteParam(aMsg, count);
|
||||
WriteParam(aWriter, count);
|
||||
for (const auto& key : aParam) {
|
||||
WriteParam(aMsg, key);
|
||||
WriteParam(aWriter, key);
|
||||
}
|
||||
}
|
||||
|
||||
static bool Read(const Message* aMsg, PickleIterator* aIter,
|
||||
paramType* aResult) {
|
||||
static bool Read(MessageReader* aReader, paramType* aResult) {
|
||||
uint32_t count;
|
||||
if (!ReadParam(aMsg, aIter, &count)) {
|
||||
if (!ReadParam(aReader, &count)) {
|
||||
return false;
|
||||
}
|
||||
paramType table(count);
|
||||
for (uint32_t i = 0; i < count; ++i) {
|
||||
uint64_t key;
|
||||
if (!ReadParam(aMsg, aIter, &key)) {
|
||||
if (!ReadParam(aReader, &key)) {
|
||||
return false;
|
||||
}
|
||||
table.Insert(key);
|
||||
@ -285,28 +281,27 @@ struct ParamTraits<nsTArray<E>> {
|
||||
static const bool sUseWriteBytes =
|
||||
(std::is_integral_v<E> || std::is_floating_point_v<E>);
|
||||
|
||||
static void Write(Message* aMsg, const paramType& aParam) {
|
||||
static void Write(MessageWriter* aWriter, const paramType& aParam) {
|
||||
uint32_t length = aParam.Length();
|
||||
WriteParam(aMsg, length);
|
||||
WriteParam(aWriter, length);
|
||||
|
||||
if (sUseWriteBytes) {
|
||||
int pickledLength = 0;
|
||||
MOZ_RELEASE_ASSERT(ByteLengthIsValid(length, sizeof(E), &pickledLength));
|
||||
aMsg->WriteBytes(aParam.Elements(), pickledLength);
|
||||
aWriter->WriteBytes(aParam.Elements(), pickledLength);
|
||||
} else {
|
||||
const E* elems = aParam.Elements();
|
||||
for (uint32_t index = 0; index < length; index++) {
|
||||
WriteParam(aMsg, elems[index]);
|
||||
WriteParam(aWriter, elems[index]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// This method uses infallible allocation so that an OOM failure will
|
||||
// show up as an OOM crash rather than an IPC FatalError.
|
||||
static bool Read(const Message* aMsg, PickleIterator* aIter,
|
||||
paramType* aResult) {
|
||||
static bool Read(MessageReader* aReader, paramType* aResult) {
|
||||
uint32_t length;
|
||||
if (!ReadParam(aMsg, aIter, &length)) {
|
||||
if (!ReadParam(aReader, &length)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -317,12 +312,12 @@ struct ParamTraits<nsTArray<E>> {
|
||||
}
|
||||
|
||||
E* elements = aResult->AppendElements(length);
|
||||
return aMsg->ReadBytesInto(aIter, elements, pickledLength);
|
||||
return aReader->ReadBytesInto(elements, pickledLength);
|
||||
} else {
|
||||
// Each ReadParam<E> may read more than 1 byte each; this is an attempt
|
||||
// to minimally validate that the length isn't much larger than what's
|
||||
// actually available in aMsg.
|
||||
if (!aMsg->HasBytesAvailable(aIter, length)) {
|
||||
// actually available in aReader.
|
||||
if (!aReader->HasBytesAvailable(length)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -330,7 +325,7 @@ struct ParamTraits<nsTArray<E>> {
|
||||
|
||||
for (uint32_t index = 0; index < length; index++) {
|
||||
E* element = aResult->AppendElement();
|
||||
if (!ReadParam(aMsg, aIter, element)) {
|
||||
if (!ReadParam(aReader, element)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -355,15 +350,14 @@ template <typename E>
|
||||
struct ParamTraits<FallibleTArray<E>> {
|
||||
typedef FallibleTArray<E> paramType;
|
||||
|
||||
static void Write(Message* aMsg, const paramType& aParam) {
|
||||
WriteParam(aMsg, static_cast<const nsTArray<E>&>(aParam));
|
||||
static void Write(MessageWriter* aWriter, const paramType& aParam) {
|
||||
WriteParam(aWriter, static_cast<const nsTArray<E>&>(aParam));
|
||||
}
|
||||
|
||||
// Deserialize the array infallibly, but return a FallibleTArray.
|
||||
static bool Read(const Message* aMsg, PickleIterator* aIter,
|
||||
paramType* aResult) {
|
||||
static bool Read(MessageReader* aReader, paramType* aResult) {
|
||||
nsTArray<E> temp;
|
||||
if (!ReadParam(aMsg, aIter, &temp)) return false;
|
||||
if (!ReadParam(aReader, &temp)) return false;
|
||||
|
||||
*aResult = std::move(temp);
|
||||
return true;
|
||||
@ -398,26 +392,25 @@ struct ParamTraits<mozilla::Vector<E, N, AP>> {
|
||||
static const bool sUseWriteBytes =
|
||||
(std::is_integral_v<E> || std::is_floating_point_v<E>);
|
||||
|
||||
static void Write(Message* aMsg, const paramType& aParam) {
|
||||
static void Write(MessageWriter* aWriter, const paramType& aParam) {
|
||||
uint32_t length = aParam.length();
|
||||
WriteParam(aMsg, length);
|
||||
WriteParam(aWriter, length);
|
||||
|
||||
if (sUseWriteBytes) {
|
||||
int pickledLength = 0;
|
||||
MOZ_RELEASE_ASSERT(ByteLengthIsValid(length, sizeof(E), &pickledLength));
|
||||
aMsg->WriteBytes(aParam.begin(), pickledLength);
|
||||
aWriter->WriteBytes(aParam.begin(), pickledLength);
|
||||
return;
|
||||
}
|
||||
|
||||
for (const E& elem : aParam) {
|
||||
WriteParam(aMsg, elem);
|
||||
WriteParam(aWriter, elem);
|
||||
}
|
||||
}
|
||||
|
||||
static bool Read(const Message* aMsg, PickleIterator* aIter,
|
||||
paramType* aResult) {
|
||||
static bool Read(MessageReader* aReader, paramType* aResult) {
|
||||
uint32_t length;
|
||||
if (!ReadParam(aMsg, aIter, &length)) {
|
||||
if (!ReadParam(aReader, &length)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -433,13 +426,13 @@ struct ParamTraits<mozilla::Vector<E, N, AP>> {
|
||||
}
|
||||
|
||||
E* elements = aResult->begin();
|
||||
return aMsg->ReadBytesInto(aIter, elements, pickledLength);
|
||||
return aReader->ReadBytesInto(elements, pickledLength);
|
||||
}
|
||||
|
||||
// Each ReadParam<E> may read more than 1 byte each; this is an attempt
|
||||
// to minimally validate that the length isn't much larger than what's
|
||||
// actually available in aMsg.
|
||||
if (!aMsg->HasBytesAvailable(aIter, length)) {
|
||||
// actually available in aReader.
|
||||
if (!aReader->HasBytesAvailable(length)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -449,7 +442,7 @@ struct ParamTraits<mozilla::Vector<E, N, AP>> {
|
||||
}
|
||||
|
||||
for (uint32_t index = 0; index < length; ++index) {
|
||||
if (!ReadParam(aMsg, aIter, &((*aResult)[index]))) {
|
||||
if (!ReadParam(aReader, &((*aResult)[index]))) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -479,26 +472,25 @@ struct ParamTraits<std::vector<E>> {
|
||||
static const bool sUseWriteBytes =
|
||||
(std::is_integral_v<E> || std::is_floating_point_v<E>);
|
||||
|
||||
static void Write(Message* aMsg, const paramType& aParam) {
|
||||
static void Write(MessageWriter* aWriter, const paramType& aParam) {
|
||||
uint32_t length = aParam.size();
|
||||
WriteParam(aMsg, length);
|
||||
WriteParam(aWriter, length);
|
||||
|
||||
if (sUseWriteBytes) {
|
||||
int pickledLength = 0;
|
||||
MOZ_RELEASE_ASSERT(ByteLengthIsValid(length, sizeof(E), &pickledLength));
|
||||
aMsg->WriteBytes(aParam.data(), pickledLength);
|
||||
aWriter->WriteBytes(aParam.data(), pickledLength);
|
||||
return;
|
||||
}
|
||||
|
||||
for (const E& elem : aParam) {
|
||||
WriteParam(aMsg, elem);
|
||||
WriteParam(aWriter, elem);
|
||||
}
|
||||
}
|
||||
|
||||
static bool Read(const Message* aMsg, PickleIterator* aIter,
|
||||
paramType* aResult) {
|
||||
static bool Read(MessageReader* aReader, paramType* aResult) {
|
||||
uint32_t length;
|
||||
if (!ReadParam(aMsg, aIter, &length)) {
|
||||
if (!ReadParam(aReader, &length)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -511,20 +503,20 @@ struct ParamTraits<std::vector<E>> {
|
||||
aResult->resize(length);
|
||||
|
||||
E* elements = aResult->data();
|
||||
return aMsg->ReadBytesInto(aIter, elements, pickledLength);
|
||||
return aReader->ReadBytesInto(elements, pickledLength);
|
||||
}
|
||||
|
||||
// Each ReadParam<E> may read more than 1 byte each; this is an attempt
|
||||
// to minimally validate that the length isn't much larger than what's
|
||||
// actually available in aMsg.
|
||||
if (!aMsg->HasBytesAvailable(aIter, length)) {
|
||||
// actually available in aReader.
|
||||
if (!aReader->HasBytesAvailable(length)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
aResult->resize(length);
|
||||
|
||||
for (uint32_t index = 0; index < length; ++index) {
|
||||
if (!ReadParam(aMsg, aIter, &((*aResult)[index]))) {
|
||||
if (!ReadParam(aReader, &((*aResult)[index]))) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -546,25 +538,24 @@ template <typename K, typename V>
|
||||
struct ParamTraits<std::unordered_map<K, V>> final {
|
||||
using T = std::unordered_map<K, V>;
|
||||
|
||||
static void Write(Message* const msg, const T& in) {
|
||||
WriteParam(msg, in.size());
|
||||
static void Write(MessageWriter* const writer, const T& in) {
|
||||
WriteParam(writer, in.size());
|
||||
for (const auto& pair : in) {
|
||||
WriteParam(msg, pair.first);
|
||||
WriteParam(msg, pair.second);
|
||||
WriteParam(writer, pair.first);
|
||||
WriteParam(writer, pair.second);
|
||||
}
|
||||
}
|
||||
|
||||
static bool Read(const Message* const msg, PickleIterator* const itr,
|
||||
T* const out) {
|
||||
static bool Read(MessageReader* const reader, T* const out) {
|
||||
size_t size = 0;
|
||||
if (!ReadParam(msg, itr, &size)) return false;
|
||||
if (!ReadParam(reader, &size)) return false;
|
||||
T map;
|
||||
map.reserve(size);
|
||||
for (const auto i : mozilla::IntegerRange(size)) {
|
||||
std::pair<K, V> pair;
|
||||
mozilla::Unused << i;
|
||||
if (!ReadParam(msg, itr, &(pair.first)) ||
|
||||
!ReadParam(msg, itr, &(pair.second))) {
|
||||
if (!ReadParam(reader, &(pair.first)) ||
|
||||
!ReadParam(reader, &(pair.second))) {
|
||||
return false;
|
||||
}
|
||||
map.insert(std::move(pair));
|
||||
@ -578,13 +569,12 @@ template <>
|
||||
struct ParamTraits<float> {
|
||||
typedef float paramType;
|
||||
|
||||
static void Write(Message* aMsg, const paramType& aParam) {
|
||||
aMsg->WriteBytes(&aParam, sizeof(paramType));
|
||||
static void Write(MessageWriter* aWriter, const paramType& aParam) {
|
||||
aWriter->WriteBytes(&aParam, sizeof(paramType));
|
||||
}
|
||||
|
||||
static bool Read(const Message* aMsg, PickleIterator* aIter,
|
||||
paramType* aResult) {
|
||||
return aMsg->ReadBytesInto(aIter, aResult, sizeof(*aResult));
|
||||
static bool Read(MessageReader* aReader, paramType* aResult) {
|
||||
return aReader->ReadBytesInto(aResult, sizeof(*aResult));
|
||||
}
|
||||
|
||||
static void Log(const paramType& aParam, std::wstring* aLog) {
|
||||
@ -601,24 +591,23 @@ template <>
|
||||
struct ParamTraits<nsID> {
|
||||
typedef nsID paramType;
|
||||
|
||||
static void Write(Message* aMsg, const paramType& aParam) {
|
||||
WriteParam(aMsg, aParam.m0);
|
||||
WriteParam(aMsg, aParam.m1);
|
||||
WriteParam(aMsg, aParam.m2);
|
||||
static void Write(MessageWriter* aWriter, const paramType& aParam) {
|
||||
WriteParam(aWriter, aParam.m0);
|
||||
WriteParam(aWriter, aParam.m1);
|
||||
WriteParam(aWriter, aParam.m2);
|
||||
for (unsigned int i = 0; i < mozilla::ArrayLength(aParam.m3); i++) {
|
||||
WriteParam(aMsg, aParam.m3[i]);
|
||||
WriteParam(aWriter, aParam.m3[i]);
|
||||
}
|
||||
}
|
||||
|
||||
static bool Read(const Message* aMsg, PickleIterator* aIter,
|
||||
paramType* aResult) {
|
||||
if (!ReadParam(aMsg, aIter, &(aResult->m0)) ||
|
||||
!ReadParam(aMsg, aIter, &(aResult->m1)) ||
|
||||
!ReadParam(aMsg, aIter, &(aResult->m2)))
|
||||
static bool Read(MessageReader* aReader, paramType* aResult) {
|
||||
if (!ReadParam(aReader, &(aResult->m0)) ||
|
||||
!ReadParam(aReader, &(aResult->m1)) ||
|
||||
!ReadParam(aReader, &(aResult->m2)))
|
||||
return false;
|
||||
|
||||
for (unsigned int i = 0; i < mozilla::ArrayLength(aResult->m3); i++)
|
||||
if (!ReadParam(aMsg, aIter, &(aResult->m3[i]))) return false;
|
||||
if (!ReadParam(aReader, &(aResult->m3[i]))) return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -642,24 +631,22 @@ struct ParamTraits<nsContentPolicyType>
|
||||
template <>
|
||||
struct ParamTraits<mozilla::TimeDuration> {
|
||||
typedef mozilla::TimeDuration paramType;
|
||||
static void Write(Message* aMsg, const paramType& aParam) {
|
||||
WriteParam(aMsg, aParam.mValue);
|
||||
static void Write(MessageWriter* aWriter, const paramType& aParam) {
|
||||
WriteParam(aWriter, aParam.mValue);
|
||||
}
|
||||
static bool Read(const Message* aMsg, PickleIterator* aIter,
|
||||
paramType* aResult) {
|
||||
return ReadParam(aMsg, aIter, &aResult->mValue);
|
||||
static bool Read(MessageReader* aReader, paramType* aResult) {
|
||||
return ReadParam(aReader, &aResult->mValue);
|
||||
};
|
||||
};
|
||||
|
||||
template <>
|
||||
struct ParamTraits<mozilla::TimeStamp> {
|
||||
typedef mozilla::TimeStamp paramType;
|
||||
static void Write(Message* aMsg, const paramType& aParam) {
|
||||
WriteParam(aMsg, aParam.mValue);
|
||||
static void Write(MessageWriter* aWriter, const paramType& aParam) {
|
||||
WriteParam(aWriter, aParam.mValue);
|
||||
}
|
||||
static bool Read(const Message* aMsg, PickleIterator* aIter,
|
||||
paramType* aResult) {
|
||||
return ReadParam(aMsg, aIter, &aResult->mValue);
|
||||
static bool Read(MessageReader* aReader, paramType* aResult) {
|
||||
return ReadParam(aReader, &aResult->mValue);
|
||||
};
|
||||
};
|
||||
|
||||
@ -668,18 +655,17 @@ struct ParamTraits<mozilla::TimeStamp> {
|
||||
template <>
|
||||
struct ParamTraits<mozilla::TimeStampValue> {
|
||||
typedef mozilla::TimeStampValue paramType;
|
||||
static void Write(Message* aMsg, const paramType& aParam) {
|
||||
WriteParam(aMsg, aParam.mGTC);
|
||||
WriteParam(aMsg, aParam.mQPC);
|
||||
WriteParam(aMsg, aParam.mIsNull);
|
||||
WriteParam(aMsg, aParam.mHasQPC);
|
||||
static void Write(MessageWriter* aWriter, const paramType& aParam) {
|
||||
WriteParam(aWriter, aParam.mGTC);
|
||||
WriteParam(aWriter, aParam.mQPC);
|
||||
WriteParam(aWriter, aParam.mIsNull);
|
||||
WriteParam(aWriter, aParam.mHasQPC);
|
||||
}
|
||||
static bool Read(const Message* aMsg, PickleIterator* aIter,
|
||||
paramType* aResult) {
|
||||
return (ReadParam(aMsg, aIter, &aResult->mGTC) &&
|
||||
ReadParam(aMsg, aIter, &aResult->mQPC) &&
|
||||
ReadParam(aMsg, aIter, &aResult->mIsNull) &&
|
||||
ReadParam(aMsg, aIter, &aResult->mHasQPC));
|
||||
static bool Read(MessageReader* aReader, paramType* aResult) {
|
||||
return (ReadParam(aReader, &aResult->mGTC) &&
|
||||
ReadParam(aReader, &aResult->mQPC) &&
|
||||
ReadParam(aReader, &aResult->mIsNull) &&
|
||||
ReadParam(aReader, &aResult->mHasQPC));
|
||||
}
|
||||
};
|
||||
|
||||
@ -689,13 +675,12 @@ template <>
|
||||
struct ParamTraits<mozilla::dom::ipc::StructuredCloneData> {
|
||||
typedef mozilla::dom::ipc::StructuredCloneData paramType;
|
||||
|
||||
static void Write(Message* aMsg, const paramType& aParam) {
|
||||
aParam.WriteIPCParams(aMsg);
|
||||
static void Write(MessageWriter* aWriter, const paramType& aParam) {
|
||||
aParam.WriteIPCParams(aWriter);
|
||||
}
|
||||
|
||||
static bool Read(const Message* aMsg, PickleIterator* aIter,
|
||||
paramType* aResult) {
|
||||
return aResult->ReadIPCParams(aMsg, aIter);
|
||||
static bool Read(MessageReader* aReader, paramType* aResult) {
|
||||
return aResult->ReadIPCParams(aReader);
|
||||
}
|
||||
|
||||
static void Log(const paramType& aParam, std::wstring* aLog) {
|
||||
@ -707,24 +692,23 @@ template <class T>
|
||||
struct ParamTraits<mozilla::Maybe<T>> {
|
||||
typedef mozilla::Maybe<T> paramType;
|
||||
|
||||
static void Write(Message* msg, const paramType& param) {
|
||||
static void Write(MessageWriter* writer, const paramType& param) {
|
||||
if (param.isSome()) {
|
||||
WriteParam(msg, true);
|
||||
WriteParam(msg, param.value());
|
||||
WriteParam(writer, true);
|
||||
WriteParam(writer, param.value());
|
||||
} else {
|
||||
WriteParam(msg, false);
|
||||
WriteParam(writer, false);
|
||||
}
|
||||
}
|
||||
|
||||
static bool Read(const Message* msg, PickleIterator* iter,
|
||||
paramType* result) {
|
||||
static bool Read(MessageReader* reader, paramType* result) {
|
||||
bool isSome;
|
||||
if (!ReadParam(msg, iter, &isSome)) {
|
||||
if (!ReadParam(reader, &isSome)) {
|
||||
return false;
|
||||
}
|
||||
if (isSome) {
|
||||
T tmp;
|
||||
if (!ReadParam(msg, iter, &tmp)) {
|
||||
if (!ReadParam(reader, &tmp)) {
|
||||
return false;
|
||||
}
|
||||
*result = mozilla::Some(std::move(tmp));
|
||||
@ -740,16 +724,15 @@ struct ParamTraits<mozilla::EnumSet<T, U>> {
|
||||
typedef mozilla::EnumSet<T, U> paramType;
|
||||
typedef U serializedType;
|
||||
|
||||
static void Write(Message* msg, const paramType& param) {
|
||||
static void Write(MessageWriter* writer, const paramType& param) {
|
||||
MOZ_RELEASE_ASSERT(IsLegalValue(param.serialize()));
|
||||
WriteParam(msg, param.serialize());
|
||||
WriteParam(writer, param.serialize());
|
||||
}
|
||||
|
||||
static bool Read(const Message* msg, PickleIterator* iter,
|
||||
paramType* result) {
|
||||
static bool Read(MessageReader* reader, paramType* result) {
|
||||
serializedType tmp;
|
||||
|
||||
if (ReadParam(msg, iter, &tmp)) {
|
||||
if (ReadParam(reader, &tmp)) {
|
||||
if (IsLegalValue(tmp)) {
|
||||
result->deserialize(tmp);
|
||||
return true;
|
||||
@ -781,9 +764,9 @@ struct ParamTraits<mozilla::Variant<Ts...>> {
|
||||
typedef mozilla::Variant<Ts...> paramType;
|
||||
using Tag = typename mozilla::detail::VariantTag<Ts...>::Type;
|
||||
|
||||
static void Write(Message* msg, const paramType& param) {
|
||||
WriteParam(msg, param.tag);
|
||||
param.match([msg](const auto& t) { WriteParam(msg, t); });
|
||||
static void Write(MessageWriter* writer, const paramType& param) {
|
||||
WriteParam(writer, param.tag);
|
||||
param.match([writer](const auto& t) { WriteParam(writer, t); });
|
||||
}
|
||||
|
||||
// Because VariantReader is a nested struct, we need the dummy template
|
||||
@ -793,8 +776,7 @@ struct ParamTraits<mozilla::Variant<Ts...>> {
|
||||
struct VariantReader {
|
||||
using Next = VariantReader<N - 1>;
|
||||
|
||||
static bool Read(const Message* msg, PickleIterator* iter, Tag tag,
|
||||
paramType* result) {
|
||||
static bool Read(MessageReader* reader, Tag tag, paramType* result) {
|
||||
// Since the VariantReader specializations start at N , we need to
|
||||
// subtract one to look at N - 1, the first valid tag. This means our
|
||||
// comparisons are off by 1. If we get to N = 0 then we have failed to
|
||||
@ -805,9 +787,9 @@ struct ParamTraits<mozilla::Variant<Ts...>> {
|
||||
// Default construct our field within the result outparameter and
|
||||
// directly deserialize into the variant. Note that this means that
|
||||
// every type in Ts needs to be default constructible
|
||||
return ReadParam(msg, iter, &result->template emplace<N - 1>());
|
||||
return ReadParam(reader, &result->template emplace<N - 1>());
|
||||
} else {
|
||||
return Next::Read(msg, iter, tag, result);
|
||||
return Next::Read(reader, tag, result);
|
||||
}
|
||||
}
|
||||
|
||||
@ -818,17 +800,15 @@ struct ParamTraits<mozilla::Variant<Ts...>> {
|
||||
// a matching tag.
|
||||
template <typename dummy>
|
||||
struct VariantReader<0, dummy> {
|
||||
static bool Read(const Message* msg, PickleIterator* iter, Tag tag,
|
||||
paramType* result) {
|
||||
static bool Read(MessageReader* reader, Tag tag, paramType* result) {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
static bool Read(const Message* msg, PickleIterator* iter,
|
||||
paramType* result) {
|
||||
static bool Read(MessageReader* reader, paramType* result) {
|
||||
Tag tag;
|
||||
if (ReadParam(msg, iter, &tag)) {
|
||||
return VariantReader<sizeof...(Ts)>::Read(msg, iter, tag, result);
|
||||
if (ReadParam(reader, &tag)) {
|
||||
return VariantReader<sizeof...(Ts)>::Read(reader, tag, result);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@ -838,28 +818,27 @@ template <typename T>
|
||||
struct ParamTraits<mozilla::dom::Optional<T>> {
|
||||
typedef mozilla::dom::Optional<T> paramType;
|
||||
|
||||
static void Write(Message* aMsg, const paramType& aParam) {
|
||||
static void Write(MessageWriter* aWriter, const paramType& aParam) {
|
||||
if (aParam.WasPassed()) {
|
||||
WriteParam(aMsg, true);
|
||||
WriteParam(aMsg, aParam.Value());
|
||||
WriteParam(aWriter, true);
|
||||
WriteParam(aWriter, aParam.Value());
|
||||
return;
|
||||
}
|
||||
|
||||
WriteParam(aMsg, false);
|
||||
WriteParam(aWriter, false);
|
||||
}
|
||||
|
||||
static bool Read(const Message* aMsg, PickleIterator* aIter,
|
||||
paramType* aResult) {
|
||||
static bool Read(MessageReader* aReader, paramType* aResult) {
|
||||
bool wasPassed = false;
|
||||
|
||||
if (!ReadParam(aMsg, aIter, &wasPassed)) {
|
||||
if (!ReadParam(aReader, &wasPassed)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
aResult->Reset();
|
||||
|
||||
if (wasPassed) {
|
||||
if (!ReadParam(aMsg, aIter, &aResult->Construct())) {
|
||||
if (!ReadParam(aReader, &aResult->Construct())) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -872,9 +851,8 @@ template <>
|
||||
struct ParamTraits<nsAtom*> {
|
||||
typedef nsAtom paramType;
|
||||
|
||||
static void Write(Message* aMsg, const paramType* aParam);
|
||||
static bool Read(const Message* aMsg, PickleIterator* aIter,
|
||||
RefPtr<paramType>* aResult);
|
||||
static void Write(MessageWriter* aWriter, const paramType* aParam);
|
||||
static bool Read(MessageReader* aReader, RefPtr<paramType>* aResult);
|
||||
};
|
||||
|
||||
struct CrossOriginOpenerPolicyValidator {
|
||||
@ -930,16 +908,15 @@ template <size_t N, typename Word>
|
||||
struct ParamTraits<mozilla::BitSet<N, Word>> {
|
||||
typedef mozilla::BitSet<N, Word> paramType;
|
||||
|
||||
static void Write(Message* aMsg, const paramType& aParam) {
|
||||
static void Write(MessageWriter* aWriter, const paramType& aParam) {
|
||||
for (Word word : aParam.Storage()) {
|
||||
WriteParam(aMsg, word);
|
||||
WriteParam(aWriter, word);
|
||||
}
|
||||
}
|
||||
|
||||
static bool Read(const Message* aMsg, PickleIterator* aIter,
|
||||
paramType* aResult) {
|
||||
static bool Read(MessageReader* aReader, paramType* aResult) {
|
||||
for (Word& word : aResult->Storage()) {
|
||||
if (!ReadParam(aMsg, aIter, &word)) {
|
||||
if (!ReadParam(aReader, &word)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -951,19 +928,18 @@ template <typename T>
|
||||
struct ParamTraits<mozilla::UniquePtr<T>> {
|
||||
typedef mozilla::UniquePtr<T> paramType;
|
||||
|
||||
static void Write(Message* aMsg, const paramType& aParam) {
|
||||
static void Write(MessageWriter* aWriter, const paramType& aParam) {
|
||||
bool isNull = aParam == nullptr;
|
||||
WriteParam(aMsg, isNull);
|
||||
WriteParam(aWriter, isNull);
|
||||
|
||||
if (!isNull) {
|
||||
WriteParam(aMsg, *aParam.get());
|
||||
WriteParam(aWriter, *aParam.get());
|
||||
}
|
||||
}
|
||||
|
||||
static bool Read(const IPC::Message* aMsg, PickleIterator* aIter,
|
||||
paramType* aResult) {
|
||||
static bool Read(IPC::MessageReader* aReader, paramType* aResult) {
|
||||
bool isNull = true;
|
||||
if (!ReadParam(aMsg, aIter, &isNull)) {
|
||||
if (!ReadParam(aReader, &isNull)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -971,7 +947,7 @@ struct ParamTraits<mozilla::UniquePtr<T>> {
|
||||
aResult->reset();
|
||||
} else {
|
||||
*aResult = mozilla::MakeUnique<T>();
|
||||
if (!ReadParam(aMsg, aIter, aResult->get())) {
|
||||
if (!ReadParam(aReader, aResult->get())) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -548,7 +548,7 @@ Maybe<IPCStream>& AutoIPCStream::TakeOptionalValue() {
|
||||
return *mOptionalValue;
|
||||
}
|
||||
|
||||
void IPDLParamTraits<nsIInputStream*>::Write(IPC::Message* aMsg,
|
||||
void IPDLParamTraits<nsIInputStream*>::Write(IPC::MessageWriter* aWriter,
|
||||
IProtocol* aActor,
|
||||
nsIInputStream* aParam) {
|
||||
auto autoStream = MakeRefPtr<HoldIPCStream>(/* aDelayedStart */ true);
|
||||
@ -598,7 +598,7 @@ void IPDLParamTraits<nsIInputStream*>::Write(IPC::Message* aMsg,
|
||||
}
|
||||
MOZ_RELEASE_ASSERT(ok, "Failed to serialize nsIInputStream");
|
||||
|
||||
WriteIPDLParam(aMsg, aActor, autoStream->TakeOptionalValue());
|
||||
WriteIPDLParam(aWriter, aActor, autoStream->TakeOptionalValue());
|
||||
|
||||
// Dispatch the autoStream to an async runnable, so that we guarantee it
|
||||
// outlives this callstack, and doesn't shut down any actors we created
|
||||
@ -607,12 +607,11 @@ void IPDLParamTraits<nsIInputStream*>::Write(IPC::Message* aMsg,
|
||||
NS_GetCurrentThread(), autoStream.forget(), true);
|
||||
}
|
||||
|
||||
bool IPDLParamTraits<nsIInputStream*>::Read(const IPC::Message* aMsg,
|
||||
PickleIterator* aIter,
|
||||
bool IPDLParamTraits<nsIInputStream*>::Read(IPC::MessageReader* aReader,
|
||||
IProtocol* aActor,
|
||||
RefPtr<nsIInputStream>* aResult) {
|
||||
mozilla::Maybe<mozilla::ipc::IPCStream> ipcStream;
|
||||
if (!ReadIPDLParam(aMsg, aIter, aActor, &ipcStream)) {
|
||||
if (!ReadIPDLParam(aReader, aActor, &ipcStream)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -208,10 +208,10 @@ class HoldIPCStream final : public AutoIPCStream {
|
||||
|
||||
template <>
|
||||
struct IPDLParamTraits<nsIInputStream*> {
|
||||
static void Write(IPC::Message* aMsg, IProtocol* aActor,
|
||||
static void Write(IPC::MessageWriter* aWriter, IProtocol* aActor,
|
||||
nsIInputStream* aParam);
|
||||
static bool Read(const IPC::Message* aMsg, PickleIterator* aIter,
|
||||
IProtocol* aActor, RefPtr<nsIInputStream>* aResult);
|
||||
static bool Read(IPC::MessageReader* aReader, IProtocol* aActor,
|
||||
RefPtr<nsIInputStream>* aResult);
|
||||
};
|
||||
|
||||
} // namespace ipc
|
||||
|
@ -37,14 +37,14 @@ struct IPDLParamTraits {
|
||||
// ParamTraits. Types which want to use the actor parameter must specialize
|
||||
// IPDLParamTraits.
|
||||
template <typename R>
|
||||
static inline void Write(IPC::Message* aMsg, IProtocol*, R&& aParam) {
|
||||
IPC::ParamTraits<P>::Write(aMsg, std::forward<R>(aParam));
|
||||
static inline void Write(IPC::MessageWriter* aWriter, IProtocol*,
|
||||
R&& aParam) {
|
||||
IPC::ParamTraits<P>::Write(aWriter, std::forward<R>(aParam));
|
||||
}
|
||||
|
||||
template <typename R>
|
||||
static inline bool Read(const IPC::Message* aMsg, PickleIterator* aIter,
|
||||
IProtocol*, R* aResult) {
|
||||
return IPC::ParamTraits<P>::Read(aMsg, aIter, aResult);
|
||||
static inline bool Read(IPC::MessageReader* aReader, IProtocol*, R* aResult) {
|
||||
return IPC::ParamTraits<P>::Read(aReader, aResult);
|
||||
}
|
||||
};
|
||||
|
||||
@ -59,49 +59,47 @@ struct IPDLParamTraits {
|
||||
// more information.
|
||||
//
|
||||
template <typename P>
|
||||
static MOZ_NEVER_INLINE void WriteIPDLParam(IPC::Message* aMsg,
|
||||
static MOZ_NEVER_INLINE void WriteIPDLParam(IPC::MessageWriter* aWriter,
|
||||
IProtocol* aActor, P&& aParam) {
|
||||
IPDLParamTraits<std::decay_t<P>>::Write(aMsg, aActor,
|
||||
IPDLParamTraits<std::decay_t<P>>::Write(aWriter, aActor,
|
||||
std::forward<P>(aParam));
|
||||
}
|
||||
|
||||
template <typename P>
|
||||
static MOZ_NEVER_INLINE bool ReadIPDLParam(const IPC::Message* aMsg,
|
||||
PickleIterator* aIter,
|
||||
static MOZ_NEVER_INLINE bool ReadIPDLParam(IPC::MessageReader* aReader,
|
||||
IProtocol* aActor, P* aResult) {
|
||||
return IPDLParamTraits<P>::Read(aMsg, aIter, aActor, aResult);
|
||||
return IPDLParamTraits<P>::Read(aReader, aActor, aResult);
|
||||
}
|
||||
|
||||
template <typename P>
|
||||
static MOZ_NEVER_INLINE bool ReadIPDLParamInfallible(
|
||||
const IPC::Message* aMsg, PickleIterator* aIter, IProtocol* aActor,
|
||||
P* aResult, const char* aCrashMessage) {
|
||||
bool ok = ReadIPDLParam(aMsg, aIter, aActor, aResult);
|
||||
IPC::MessageReader* aReader, IProtocol* aActor, P* aResult,
|
||||
const char* aCrashMessage) {
|
||||
bool ok = ReadIPDLParam(aReader, aActor, aResult);
|
||||
if (!ok) {
|
||||
MOZ_CRASH_UNSAFE(aCrashMessage);
|
||||
}
|
||||
return ok;
|
||||
}
|
||||
|
||||
constexpr void WriteIPDLParamList(IPC::Message*, IProtocol*) {}
|
||||
constexpr void WriteIPDLParamList(IPC::MessageWriter*, IProtocol*) {}
|
||||
|
||||
template <typename P, typename... Ps>
|
||||
static void WriteIPDLParamList(IPC::Message* aMsg, IProtocol* aActor,
|
||||
static void WriteIPDLParamList(IPC::MessageWriter* aWriter, IProtocol* aActor,
|
||||
P&& aParam, Ps&&... aParams) {
|
||||
WriteIPDLParam(aMsg, aActor, std::forward<P>(aParam));
|
||||
WriteIPDLParamList(aMsg, aActor, std::forward<Ps>(aParams)...);
|
||||
WriteIPDLParam(aWriter, aActor, std::forward<P>(aParam));
|
||||
WriteIPDLParamList(aWriter, aActor, std::forward<Ps>(aParams)...);
|
||||
}
|
||||
|
||||
constexpr bool ReadIPDLParamList(const IPC::Message*, PickleIterator*,
|
||||
IProtocol*) {
|
||||
constexpr bool ReadIPDLParamList(IPC::MessageReader*, IProtocol*) {
|
||||
return true;
|
||||
}
|
||||
|
||||
template <typename P, typename... Ps>
|
||||
static bool ReadIPDLParamList(const IPC::Message* aMsg, PickleIterator* aIter,
|
||||
IProtocol* aActor, P* aResult, Ps*... aResults) {
|
||||
return ReadIPDLParam(aMsg, aIter, aActor, aResult) &&
|
||||
ReadIPDLParamList(aMsg, aIter, aActor, aResults...);
|
||||
static bool ReadIPDLParamList(IPC::MessageReader* aReader, IProtocol* aActor,
|
||||
P* aResult, Ps*... aResults) {
|
||||
return ReadIPDLParam(aReader, aActor, aResult) &&
|
||||
ReadIPDLParamList(aReader, aActor, aResults...);
|
||||
}
|
||||
|
||||
// When being passed `RefPtr<T>` or `nsCOMPtr<T>`, forward to a specialization
|
||||
@ -113,28 +111,28 @@ static bool ReadIPDLParamList(const IPC::Message* aMsg, PickleIterator* aIter,
|
||||
// deserializing into `nsCOMPtr<T>`.
|
||||
template <typename T>
|
||||
struct IPDLParamTraits<RefPtr<T>> {
|
||||
static void Write(IPC::Message* aMsg, IProtocol* aActor,
|
||||
static void Write(IPC::MessageWriter* aWriter, IProtocol* aActor,
|
||||
const RefPtr<T>& aParam) {
|
||||
IPDLParamTraits<T*>::Write(aMsg, aActor, aParam.get());
|
||||
IPDLParamTraits<T*>::Write(aWriter, aActor, aParam.get());
|
||||
}
|
||||
|
||||
static bool Read(const IPC::Message* aMsg, PickleIterator* aIter,
|
||||
IProtocol* aActor, RefPtr<T>* aResult) {
|
||||
return IPDLParamTraits<T*>::Read(aMsg, aIter, aActor, aResult);
|
||||
static bool Read(IPC::MessageReader* aReader, IProtocol* aActor,
|
||||
RefPtr<T>* aResult) {
|
||||
return IPDLParamTraits<T*>::Read(aReader, aActor, aResult);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct IPDLParamTraits<nsCOMPtr<T>> {
|
||||
static void Write(IPC::Message* aMsg, IProtocol* aActor,
|
||||
static void Write(IPC::MessageWriter* aWriter, IProtocol* aActor,
|
||||
const nsCOMPtr<T>& aParam) {
|
||||
IPDLParamTraits<T*>::Write(aMsg, aActor, aParam.get());
|
||||
IPDLParamTraits<T*>::Write(aWriter, aActor, aParam.get());
|
||||
}
|
||||
|
||||
static bool Read(const IPC::Message* aMsg, PickleIterator* aIter,
|
||||
IProtocol* aActor, nsCOMPtr<T>* aResult) {
|
||||
static bool Read(IPC::MessageReader* aReader, IProtocol* aActor,
|
||||
nsCOMPtr<T>* aResult) {
|
||||
RefPtr<T> refptr;
|
||||
if (!IPDLParamTraits<T*>::Read(aMsg, aIter, aActor, &refptr)) {
|
||||
if (!IPDLParamTraits<T*>::Read(aReader, aActor, &refptr)) {
|
||||
return false;
|
||||
}
|
||||
*aResult = refptr.forget();
|
||||
@ -151,32 +149,33 @@ struct IPDLParamTraits<nsTArray<T>> {
|
||||
// forwarding reference as occasionally these types appear inside of IPDL
|
||||
// arrays.
|
||||
template <typename U>
|
||||
static void Write(IPC::Message* aMsg, IProtocol* aActor, U&& aParam) {
|
||||
static void Write(IPC::MessageWriter* aWriter, IProtocol* aActor,
|
||||
U&& aParam) {
|
||||
uint32_t length = aParam.Length();
|
||||
WriteIPDLParam(aMsg, aActor, length);
|
||||
WriteIPDLParam(aWriter, aActor, length);
|
||||
|
||||
if (sUseWriteBytes) {
|
||||
auto pickledLength = CheckedInt<int>(length) * sizeof(T);
|
||||
MOZ_RELEASE_ASSERT(pickledLength.isValid());
|
||||
aMsg->WriteBytes(aParam.Elements(), pickledLength.value());
|
||||
aWriter->WriteBytes(aParam.Elements(), pickledLength.value());
|
||||
} else {
|
||||
WriteValues(aMsg, aActor, std::forward<U>(aParam));
|
||||
WriteValues(aWriter, aActor, std::forward<U>(aParam));
|
||||
}
|
||||
}
|
||||
|
||||
// This method uses infallible allocation so that an OOM failure will
|
||||
// show up as an OOM crash rather than an IPC FatalError.
|
||||
static bool Read(const IPC::Message* aMsg, PickleIterator* aIter,
|
||||
IProtocol* aActor, nsTArray<T>* aResult) {
|
||||
static bool Read(IPC::MessageReader* aReader, IProtocol* aActor,
|
||||
nsTArray<T>* aResult) {
|
||||
uint32_t length;
|
||||
if (!ReadIPDLParam(aMsg, aIter, aActor, &length)) {
|
||||
if (!ReadIPDLParam(aReader, aActor, &length)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (sUseWriteBytes) {
|
||||
auto pickledLength = CheckedInt<int>(length) * sizeof(T);
|
||||
if (!pickledLength.isValid() ||
|
||||
!aMsg->HasBytesAvailable(aIter, pickledLength.value())) {
|
||||
!aReader->HasBytesAvailable(pickledLength.value())) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -185,15 +184,15 @@ struct IPDLParamTraits<nsTArray<T>> {
|
||||
// Perhaps we should consider using an API which doesn't initialize the
|
||||
// elements?
|
||||
T* elements = aResult->AppendElements(length);
|
||||
return aMsg->ReadBytesInto(aIter, elements, pickledLength.value());
|
||||
return aReader->ReadBytesInto(elements, pickledLength.value());
|
||||
}
|
||||
|
||||
// Each ReadIPDLParam<E> may read more than 1 byte each; this is an attempt
|
||||
// to minimally validate that the length isn't much larger than what's
|
||||
// actually available in aMsg. We cannot use |pickledLength|, like in the
|
||||
// actually available in aReader. We cannot use |pickledLength|, like in the
|
||||
// codepath above, because ReadIPDLParam can read variable amounts of data
|
||||
// from aMsg.
|
||||
if (!aMsg->HasBytesAvailable(aIter, length)) {
|
||||
// from aReader.
|
||||
if (!aReader->HasBytesAvailable(length)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -201,7 +200,7 @@ struct IPDLParamTraits<nsTArray<T>> {
|
||||
|
||||
for (uint32_t index = 0; index < length; index++) {
|
||||
T* element = aResult->AppendElement();
|
||||
if (!ReadIPDLParam(aMsg, aIter, aActor, element)) {
|
||||
if (!ReadIPDLParam(aReader, aActor, element)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -210,18 +209,18 @@ struct IPDLParamTraits<nsTArray<T>> {
|
||||
|
||||
private:
|
||||
// Length has already been written. Const overload.
|
||||
static void WriteValues(IPC::Message* aMsg, IProtocol* aActor,
|
||||
static void WriteValues(IPC::MessageWriter* aWriter, IProtocol* aActor,
|
||||
const nsTArray<T>& aParam) {
|
||||
for (auto& elt : aParam) {
|
||||
WriteIPDLParam(aMsg, aActor, elt);
|
||||
WriteIPDLParam(aWriter, aActor, elt);
|
||||
}
|
||||
}
|
||||
|
||||
// Length has already been written. Rvalue overload.
|
||||
static void WriteValues(IPC::Message* aMsg, IProtocol* aActor,
|
||||
static void WriteValues(IPC::MessageWriter* aWriter, IProtocol* aActor,
|
||||
nsTArray<T>&& aParam) {
|
||||
for (auto& elt : aParam) {
|
||||
WriteIPDLParam(aMsg, aActor, std::move(elt));
|
||||
WriteIPDLParam(aWriter, aActor, std::move(elt));
|
||||
}
|
||||
|
||||
// As we just moved all of our values out, let's clean up after ourselves &
|
||||
@ -247,35 +246,36 @@ template <typename T>
|
||||
struct IPDLParamTraits<Maybe<T>> {
|
||||
typedef Maybe<T> paramType;
|
||||
|
||||
static void Write(IPC::Message* aMsg, IProtocol* aActor,
|
||||
static void Write(IPC::MessageWriter* aWriter, IProtocol* aActor,
|
||||
const Maybe<T>& aParam) {
|
||||
bool isSome = aParam.isSome();
|
||||
WriteIPDLParam(aMsg, aActor, isSome);
|
||||
WriteIPDLParam(aWriter, aActor, isSome);
|
||||
|
||||
if (isSome) {
|
||||
WriteIPDLParam(aMsg, aActor, aParam.ref());
|
||||
WriteIPDLParam(aWriter, aActor, aParam.ref());
|
||||
}
|
||||
}
|
||||
|
||||
static void Write(IPC::Message* aMsg, IProtocol* aActor, Maybe<T>&& aParam) {
|
||||
static void Write(IPC::MessageWriter* aWriter, IProtocol* aActor,
|
||||
Maybe<T>&& aParam) {
|
||||
bool isSome = aParam.isSome();
|
||||
WriteIPDLParam(aMsg, aActor, isSome);
|
||||
WriteIPDLParam(aWriter, aActor, isSome);
|
||||
|
||||
if (isSome) {
|
||||
WriteIPDLParam(aMsg, aActor, std::move(aParam.ref()));
|
||||
WriteIPDLParam(aWriter, aActor, std::move(aParam.ref()));
|
||||
}
|
||||
}
|
||||
|
||||
static bool Read(const IPC::Message* aMsg, PickleIterator* aIter,
|
||||
IProtocol* aActor, Maybe<T>* aResult) {
|
||||
static bool Read(IPC::MessageReader* aReader, IProtocol* aActor,
|
||||
Maybe<T>* aResult) {
|
||||
bool isSome;
|
||||
if (!ReadIPDLParam(aMsg, aIter, aActor, &isSome)) {
|
||||
if (!ReadIPDLParam(aReader, aActor, &isSome)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (isSome) {
|
||||
aResult->emplace();
|
||||
if (!ReadIPDLParam(aMsg, aIter, aActor, aResult->ptr())) {
|
||||
if (!ReadIPDLParam(aReader, aActor, aResult->ptr())) {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
@ -290,19 +290,20 @@ struct IPDLParamTraits<UniquePtr<T>> {
|
||||
typedef UniquePtr<T> paramType;
|
||||
|
||||
template <typename U>
|
||||
static void Write(IPC::Message* aMsg, IProtocol* aActor, U&& aParam) {
|
||||
static void Write(IPC::MessageWriter* aWriter, IProtocol* aActor,
|
||||
U&& aParam) {
|
||||
bool isNull = aParam == nullptr;
|
||||
WriteIPDLParam(aMsg, aActor, isNull);
|
||||
WriteIPDLParam(aWriter, aActor, isNull);
|
||||
|
||||
if (!isNull) {
|
||||
WriteValue(aMsg, aActor, std::forward<U>(aParam));
|
||||
WriteValue(aWriter, aActor, std::forward<U>(aParam));
|
||||
}
|
||||
}
|
||||
|
||||
static bool Read(const IPC::Message* aMsg, PickleIterator* aIter,
|
||||
IProtocol* aActor, UniquePtr<T>* aResult) {
|
||||
static bool Read(IPC::MessageReader* aReader, IProtocol* aActor,
|
||||
UniquePtr<T>* aResult) {
|
||||
bool isNull = true;
|
||||
if (!ReadParam(aMsg, aIter, &isNull)) {
|
||||
if (!ReadParam(aReader, &isNull)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -310,7 +311,7 @@ struct IPDLParamTraits<UniquePtr<T>> {
|
||||
aResult->reset();
|
||||
} else {
|
||||
*aResult = MakeUnique<T>();
|
||||
if (!ReadIPDLParam(aMsg, aIter, aActor, aResult->get())) {
|
||||
if (!ReadIPDLParam(aReader, aActor, aResult->get())) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -319,15 +320,15 @@ struct IPDLParamTraits<UniquePtr<T>> {
|
||||
|
||||
private:
|
||||
// If we have an rvalue, clear out our passed-in parameter.
|
||||
static void WriteValue(IPC::Message* aMsg, IProtocol* aActor,
|
||||
static void WriteValue(IPC::MessageWriter* aWriter, IProtocol* aActor,
|
||||
UniquePtr<T>&& aParam) {
|
||||
WriteIPDLParam(aMsg, aActor, std::move(*aParam.get()));
|
||||
WriteIPDLParam(aWriter, aActor, std::move(*aParam.get()));
|
||||
aParam = nullptr;
|
||||
}
|
||||
|
||||
static void WriteValue(IPC::Message* aMsg, IProtocol* aActor,
|
||||
static void WriteValue(IPC::MessageWriter* aWriter, IProtocol* aActor,
|
||||
const UniquePtr<T>& aParam) {
|
||||
WriteIPDLParam(aMsg, aActor, *aParam.get());
|
||||
WriteIPDLParam(aWriter, aActor, *aParam.get());
|
||||
}
|
||||
};
|
||||
|
||||
@ -336,36 +337,36 @@ struct IPDLParamTraits<Tuple<Ts...>> {
|
||||
typedef Tuple<Ts...> paramType;
|
||||
|
||||
template <typename U>
|
||||
static void Write(IPC::Message* aMsg, IProtocol* aActor, U&& aParam) {
|
||||
WriteInternal(aMsg, aActor, std::forward<U>(aParam),
|
||||
static void Write(IPC::MessageWriter* aWriter, IProtocol* aActor,
|
||||
U&& aParam) {
|
||||
WriteInternal(aWriter, aActor, std::forward<U>(aParam),
|
||||
std::index_sequence_for<Ts...>{});
|
||||
}
|
||||
|
||||
static bool Read(const IPC::Message* aMsg, PickleIterator* aIter,
|
||||
IProtocol* aActor, Tuple<Ts...>* aResult) {
|
||||
return ReadInternal(aMsg, aIter, aActor, *aResult,
|
||||
static bool Read(IPC::MessageReader* aReader, IProtocol* aActor,
|
||||
Tuple<Ts...>* aResult) {
|
||||
return ReadInternal(aReader, aActor, *aResult,
|
||||
std::index_sequence_for<Ts...>{});
|
||||
}
|
||||
|
||||
private:
|
||||
template <size_t... Is>
|
||||
static void WriteInternal(IPC::Message* aMsg, IProtocol* aActor,
|
||||
static void WriteInternal(IPC::MessageWriter* aWriter, IProtocol* aActor,
|
||||
const Tuple<Ts...>& aParam,
|
||||
std::index_sequence<Is...>) {
|
||||
WriteIPDLParamList(aMsg, aActor, Get<Is>(aParam)...);
|
||||
WriteIPDLParamList(aWriter, aActor, Get<Is>(aParam)...);
|
||||
}
|
||||
|
||||
template <size_t... Is>
|
||||
static void WriteInternal(IPC::Message* aMsg, IProtocol* aActor,
|
||||
static void WriteInternal(IPC::MessageWriter* aWriter, IProtocol* aActor,
|
||||
Tuple<Ts...>&& aParam, std::index_sequence<Is...>) {
|
||||
WriteIPDLParamList(aMsg, aActor, std::move(Get<Is>(aParam))...);
|
||||
WriteIPDLParamList(aWriter, aActor, std::move(Get<Is>(aParam))...);
|
||||
}
|
||||
|
||||
template <size_t... Is>
|
||||
static bool ReadInternal(const IPC::Message* aMsg, PickleIterator* aIter,
|
||||
IProtocol* aActor, Tuple<Ts...>& aResult,
|
||||
std::index_sequence<Is...>) {
|
||||
return ReadIPDLParamList(aMsg, aIter, aActor, &Get<Is>(aResult)...);
|
||||
static bool ReadInternal(IPC::MessageReader* aReader, IProtocol* aActor,
|
||||
Tuple<Ts...>& aResult, std::index_sequence<Is...>) {
|
||||
return ReadIPDLParamList(aReader, aActor, &Get<Is>(aResult)...);
|
||||
}
|
||||
};
|
||||
|
||||
@ -374,17 +375,19 @@ struct IPDLParamTraits<mozilla::Variant<Ts...>> {
|
||||
typedef mozilla::Variant<Ts...> paramType;
|
||||
using Tag = typename mozilla::detail::VariantTag<Ts...>::Type;
|
||||
|
||||
static void Write(IPC::Message* aMsg, IProtocol* aActor,
|
||||
static void Write(IPC::MessageWriter* aWriter, IProtocol* aActor,
|
||||
const paramType& aParam) {
|
||||
WriteIPDLParam(aMsg, aActor, aParam.tag);
|
||||
aParam.match(
|
||||
[aMsg, aActor](const auto& t) { WriteIPDLParam(aMsg, aActor, t); });
|
||||
WriteIPDLParam(aWriter, aActor, aParam.tag);
|
||||
aParam.match([aWriter, aActor](const auto& t) {
|
||||
WriteIPDLParam(aWriter, aActor, t);
|
||||
});
|
||||
}
|
||||
|
||||
static void Write(IPC::Message* aMsg, IProtocol* aActor, paramType&& aParam) {
|
||||
WriteIPDLParam(aMsg, aActor, aParam.tag);
|
||||
aParam.match([aMsg, aActor](auto& t) {
|
||||
WriteIPDLParam(aMsg, aActor, std::move(t));
|
||||
static void Write(IPC::MessageWriter* aWriter, IProtocol* aActor,
|
||||
paramType&& aParam) {
|
||||
WriteIPDLParam(aWriter, aActor, aParam.tag);
|
||||
aParam.match([aWriter, aActor](auto& t) {
|
||||
WriteIPDLParam(aWriter, aActor, std::move(t));
|
||||
});
|
||||
}
|
||||
|
||||
@ -395,8 +398,8 @@ struct IPDLParamTraits<mozilla::Variant<Ts...>> {
|
||||
struct VariantReader {
|
||||
using Next = VariantReader<N - 1>;
|
||||
|
||||
static bool Read(const IPC::Message* aMsg, PickleIterator* aIter,
|
||||
IProtocol* aActor, Tag aTag, paramType* aResult) {
|
||||
static bool Read(IPC::MessageReader* aReader, IProtocol* aActor, Tag aTag,
|
||||
paramType* aResult) {
|
||||
// Since the VariantReader specializations start at N , we need to
|
||||
// subtract one to look at N - 1, the first valid tag. This means our
|
||||
// comparisons are off by 1. If we get to N = 0 then we have failed to
|
||||
@ -407,10 +410,10 @@ struct IPDLParamTraits<mozilla::Variant<Ts...>> {
|
||||
// Default construct our field within the result outparameter and
|
||||
// directly deserialize into the variant. Note that this means that
|
||||
// every type in Ts needs to be default constructible.
|
||||
return ReadIPDLParam(aMsg, aIter, aActor,
|
||||
return ReadIPDLParam(aReader, aActor,
|
||||
&aResult->template emplace<N - 1>());
|
||||
}
|
||||
return Next::Read(aMsg, aIter, aActor, aTag, aResult);
|
||||
return Next::Read(aReader, aActor, aTag, aResult);
|
||||
}
|
||||
|
||||
}; // VariantReader<N>
|
||||
@ -420,21 +423,20 @@ struct IPDLParamTraits<mozilla::Variant<Ts...>> {
|
||||
// a matching tag.
|
||||
template <typename dummy>
|
||||
struct VariantReader<0, dummy> {
|
||||
static bool Read(const IPC::Message* aMsg, PickleIterator* aIter,
|
||||
IProtocol* aActor, Tag aTag, paramType* aResult) {
|
||||
static bool Read(IPC::MessageReader* aReader, IProtocol* aActor, Tag aTag,
|
||||
paramType* aResult) {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
static bool Read(const IPC::Message* aMsg, PickleIterator* aIter,
|
||||
IProtocol* aActor, paramType* aResult) {
|
||||
static bool Read(IPC::MessageReader* aReader, IProtocol* aActor,
|
||||
paramType* aResult) {
|
||||
Tag tag;
|
||||
if (!ReadIPDLParam(aMsg, aIter, aActor, &tag)) {
|
||||
if (!ReadIPDLParam(aReader, aActor, &tag)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return VariantReader<sizeof...(Ts)>::Read(aMsg, aIter, aActor, tag,
|
||||
aResult);
|
||||
return VariantReader<sizeof...(Ts)>::Read(aReader, aActor, tag, aResult);
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -17,20 +17,19 @@
|
||||
template <>
|
||||
struct IPC::ParamTraits<mozilla::ipc::NodeChannel::Introduction> {
|
||||
using paramType = mozilla::ipc::NodeChannel::Introduction;
|
||||
static void Write(Message* aMsg, paramType&& aParam) {
|
||||
WriteParam(aMsg, aParam.mName);
|
||||
WriteParam(aMsg, std::move(aParam.mHandle));
|
||||
WriteParam(aMsg, aParam.mMode);
|
||||
WriteParam(aMsg, aParam.mMyPid);
|
||||
WriteParam(aMsg, aParam.mOtherPid);
|
||||
static void Write(MessageWriter* aWriter, paramType&& aParam) {
|
||||
WriteParam(aWriter, aParam.mName);
|
||||
WriteParam(aWriter, std::move(aParam.mHandle));
|
||||
WriteParam(aWriter, aParam.mMode);
|
||||
WriteParam(aWriter, aParam.mMyPid);
|
||||
WriteParam(aWriter, aParam.mOtherPid);
|
||||
}
|
||||
static bool Read(const Message* aMsg, PickleIterator* aIter,
|
||||
paramType* aResult) {
|
||||
return ReadParam(aMsg, aIter, &aResult->mName) &&
|
||||
ReadParam(aMsg, aIter, &aResult->mHandle) &&
|
||||
ReadParam(aMsg, aIter, &aResult->mMode) &&
|
||||
ReadParam(aMsg, aIter, &aResult->mMyPid) &&
|
||||
ReadParam(aMsg, aIter, &aResult->mOtherPid);
|
||||
static bool Read(MessageReader* aReader, paramType* aResult) {
|
||||
return ReadParam(aReader, &aResult->mName) &&
|
||||
ReadParam(aReader, &aResult->mHandle) &&
|
||||
ReadParam(aReader, &aResult->mMode) &&
|
||||
ReadParam(aReader, &aResult->mMyPid) &&
|
||||
ReadParam(aReader, &aResult->mOtherPid);
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -49,14 +49,13 @@ template <>
|
||||
struct ParamTraits<mozilla::ipc::ActorHandle> {
|
||||
typedef mozilla::ipc::ActorHandle paramType;
|
||||
|
||||
static void Write(Message* aMsg, const paramType& aParam) {
|
||||
IPC::WriteParam(aMsg, aParam.mId);
|
||||
static void Write(MessageWriter* aWriter, const paramType& aParam) {
|
||||
IPC::WriteParam(aWriter, aParam.mId);
|
||||
}
|
||||
|
||||
static bool Read(const Message* aMsg, PickleIterator* aIter,
|
||||
paramType* aResult) {
|
||||
static bool Read(MessageReader* aReader, paramType* aResult) {
|
||||
int id;
|
||||
if (IPC::ReadParam(aMsg, aIter, &id)) {
|
||||
if (IPC::ReadParam(aReader, &id)) {
|
||||
aResult->mId = id;
|
||||
return true;
|
||||
}
|
||||
@ -72,17 +71,16 @@ template <class PFooSide>
|
||||
struct ParamTraits<mozilla::ipc::Endpoint<PFooSide>> {
|
||||
typedef mozilla::ipc::Endpoint<PFooSide> paramType;
|
||||
|
||||
static void Write(Message* aMsg, paramType&& aParam) {
|
||||
IPC::WriteParam(aMsg, std::move(aParam.mPort));
|
||||
IPC::WriteParam(aMsg, aParam.mMyPid);
|
||||
IPC::WriteParam(aMsg, aParam.mOtherPid);
|
||||
static void Write(MessageWriter* aWriter, paramType&& aParam) {
|
||||
IPC::WriteParam(aWriter, std::move(aParam.mPort));
|
||||
IPC::WriteParam(aWriter, aParam.mMyPid);
|
||||
IPC::WriteParam(aWriter, aParam.mOtherPid);
|
||||
}
|
||||
|
||||
static bool Read(const Message* aMsg, PickleIterator* aIter,
|
||||
paramType* aResult) {
|
||||
return IPC::ReadParam(aMsg, aIter, &aResult->mPort) &&
|
||||
IPC::ReadParam(aMsg, aIter, &aResult->mMyPid) &&
|
||||
IPC::ReadParam(aMsg, aIter, &aResult->mOtherPid);
|
||||
static bool Read(MessageReader* aReader, paramType* aResult) {
|
||||
return IPC::ReadParam(aReader, &aResult->mPort) &&
|
||||
IPC::ReadParam(aReader, &aResult->mMyPid) &&
|
||||
IPC::ReadParam(aReader, &aResult->mOtherPid);
|
||||
}
|
||||
|
||||
static void Log(const paramType& aParam, std::wstring* aLog) {
|
||||
@ -98,23 +96,25 @@ template <>
|
||||
struct IPDLParamTraits<UntypedManagedEndpoint> {
|
||||
using paramType = UntypedManagedEndpoint;
|
||||
|
||||
static void Write(IPC::Message* aMsg, IProtocol* aActor, paramType&& aParam);
|
||||
static bool Read(const IPC::Message* aMsg, PickleIterator* aIter,
|
||||
IProtocol* aActor, paramType* aResult);
|
||||
static void Write(IPC::MessageWriter* aWriter, IProtocol* aActor,
|
||||
paramType&& aParam);
|
||||
static bool Read(IPC::MessageReader* aReader, IProtocol* aActor,
|
||||
paramType* aResult);
|
||||
};
|
||||
|
||||
template <class PFooSide>
|
||||
struct IPDLParamTraits<ManagedEndpoint<PFooSide>> {
|
||||
using paramType = ManagedEndpoint<PFooSide>;
|
||||
|
||||
static void Write(IPC::Message* aMsg, IProtocol* aActor, paramType&& aParam) {
|
||||
IPDLParamTraits<UntypedManagedEndpoint>::Write(aMsg, aActor,
|
||||
static void Write(IPC::MessageWriter* aWriter, IProtocol* aActor,
|
||||
paramType&& aParam) {
|
||||
IPDLParamTraits<UntypedManagedEndpoint>::Write(aWriter, aActor,
|
||||
std::move(aParam));
|
||||
}
|
||||
|
||||
static bool Read(const IPC::Message* aMsg, PickleIterator* aIter,
|
||||
IProtocol* aActor, paramType* aResult) {
|
||||
return IPDLParamTraits<UntypedManagedEndpoint>::Read(aMsg, aIter, aActor,
|
||||
static bool Read(IPC::MessageReader* aReader, IProtocol* aActor,
|
||||
paramType* aResult) {
|
||||
return IPDLParamTraits<UntypedManagedEndpoint>::Read(aReader, aActor,
|
||||
aResult);
|
||||
}
|
||||
};
|
||||
@ -123,10 +123,10 @@ template <>
|
||||
struct IPDLParamTraits<FileDescriptor> {
|
||||
typedef FileDescriptor paramType;
|
||||
|
||||
static void Write(IPC::Message* aMsg, IProtocol* aActor,
|
||||
static void Write(IPC::MessageWriter* aWriter, IProtocol* aActor,
|
||||
const paramType& aParam);
|
||||
static bool Read(const IPC::Message* aMsg, PickleIterator* aIter,
|
||||
IProtocol* aActor, paramType* aResult);
|
||||
static bool Read(IPC::MessageReader* aReader, IProtocol* aActor,
|
||||
paramType* aResult);
|
||||
};
|
||||
} // namespace mozilla::ipc
|
||||
|
||||
|
@ -54,25 +54,24 @@ ScopedPort& ScopedPort::operator=(ScopedPort&& aOther) {
|
||||
|
||||
} // namespace mozilla::ipc
|
||||
|
||||
void IPC::ParamTraits<mozilla::ipc::ScopedPort>::Write(Message* aMsg,
|
||||
void IPC::ParamTraits<mozilla::ipc::ScopedPort>::Write(MessageWriter* aWriter,
|
||||
paramType&& aParam) {
|
||||
aMsg->WriteBool(aParam.IsValid());
|
||||
aWriter->WriteBool(aParam.IsValid());
|
||||
if (!aParam.IsValid()) {
|
||||
return;
|
||||
}
|
||||
aMsg->WritePort(std::move(aParam));
|
||||
aWriter->WritePort(std::move(aParam));
|
||||
}
|
||||
|
||||
bool IPC::ParamTraits<mozilla::ipc::ScopedPort>::Read(const Message* aMsg,
|
||||
PickleIterator* aIter,
|
||||
bool IPC::ParamTraits<mozilla::ipc::ScopedPort>::Read(MessageReader* aReader,
|
||||
paramType* aResult) {
|
||||
bool isValid = false;
|
||||
if (!aMsg->ReadBool(aIter, &isValid)) {
|
||||
if (!aReader->ReadBool(&isValid)) {
|
||||
return false;
|
||||
}
|
||||
if (!isValid) {
|
||||
*aResult = {};
|
||||
return true;
|
||||
}
|
||||
return aMsg->ConsumePort(aIter, aResult);
|
||||
return aReader->ConsumePort(aResult);
|
||||
}
|
||||
|
@ -70,9 +70,8 @@ template <>
|
||||
struct ParamTraits<mozilla::ipc::ScopedPort> {
|
||||
using paramType = mozilla::ipc::ScopedPort;
|
||||
|
||||
static void Write(Message* aMsg, paramType&& aParam);
|
||||
static bool Read(const Message* aMsg, PickleIterator* aIter,
|
||||
paramType* aResult);
|
||||
static void Write(MessageWriter* aWriter, paramType&& aParam);
|
||||
static bool Read(MessageReader* aReader, paramType* aResult);
|
||||
};
|
||||
|
||||
} // namespace IPC
|
||||
|
@ -64,18 +64,17 @@ template <>
|
||||
struct ParamTraits<JSStructuredCloneData> {
|
||||
typedef JSStructuredCloneData paramType;
|
||||
|
||||
static void Write(Message* aMsg, const paramType& aParam) {
|
||||
static void Write(MessageWriter* aWriter, const paramType& aParam) {
|
||||
MOZ_ASSERT(!(aParam.Size() % sizeof(uint64_t)));
|
||||
WriteParam(aMsg, aParam.Size());
|
||||
WriteParam(aWriter, aParam.Size());
|
||||
aParam.ForEachDataChunk([&](const char* aData, size_t aSize) {
|
||||
return aMsg->WriteBytes(aData, aSize, sizeof(uint64_t));
|
||||
return aWriter->WriteBytes(aData, aSize, sizeof(uint64_t));
|
||||
});
|
||||
}
|
||||
|
||||
static bool Read(const Message* aMsg, PickleIterator* aIter,
|
||||
paramType* aResult) {
|
||||
static bool Read(MessageReader* aReader, paramType* aResult) {
|
||||
size_t length = 0;
|
||||
if (!ReadParam(aMsg, aIter, &length)) {
|
||||
if (!ReadParam(aReader, &length)) {
|
||||
return false;
|
||||
}
|
||||
MOZ_ASSERT(!(length % sizeof(uint64_t)));
|
||||
@ -89,7 +88,7 @@ struct ParamTraits<JSStructuredCloneData> {
|
||||
// return a borrowed buffer because the out param outlives the
|
||||
// IPDL callback.
|
||||
if (length &&
|
||||
!aMsg->ExtractBuffers(aIter, length, &buffers, sizeof(uint64_t))) {
|
||||
!aReader->ExtractBuffers(length, &buffers, sizeof(uint64_t))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -111,13 +110,12 @@ template <>
|
||||
struct ParamTraits<mozilla::SerializedStructuredCloneBuffer> {
|
||||
typedef mozilla::SerializedStructuredCloneBuffer paramType;
|
||||
|
||||
static void Write(Message* aMsg, const paramType& aParam) {
|
||||
WriteParam(aMsg, aParam.data);
|
||||
static void Write(MessageWriter* aWriter, const paramType& aParam) {
|
||||
WriteParam(aWriter, aParam.data);
|
||||
}
|
||||
|
||||
static bool Read(const Message* aMsg, PickleIterator* aIter,
|
||||
paramType* aResult) {
|
||||
return ReadParam(aMsg, aIter, &aResult->data);
|
||||
static bool Read(MessageReader* aReader, paramType* aResult) {
|
||||
return ReadParam(aReader, &aResult->data);
|
||||
}
|
||||
|
||||
static void Log(const paramType& aParam, std::wstring* aLog) {
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user