mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-25 05:41:12 +00:00
Bug 1582353 - P1. Add MediaResult serializer. r=mjf
Differential Revision: https://phabricator.services.mozilla.com/D47038 --HG-- extra : moz-landing-system : lando
This commit is contained in:
parent
47f4838fa0
commit
301e1cb659
@ -21,6 +21,7 @@ namespace mozilla {
|
||||
|
||||
class MediaResult {
|
||||
public:
|
||||
MediaResult() : mCode(NS_OK) {}
|
||||
MOZ_IMPLICIT MediaResult(nsresult aResult) : mCode(aResult) {}
|
||||
MediaResult(nsresult aResult, const nsACString& aMessage)
|
||||
: mCode(aResult), mMessage(aMessage) {}
|
||||
|
@ -166,6 +166,31 @@ struct ParamTraits<mozilla::media::TimeInterval> {
|
||||
}
|
||||
};
|
||||
|
||||
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());
|
||||
WriteParam(aMsg, aParam.GPUCrashTimeStamp());
|
||||
}
|
||||
|
||||
static bool Read(const Message* aMsg, PickleIterator* aIter,
|
||||
paramType* aResult) {
|
||||
nsresult result;
|
||||
nsCString message;
|
||||
mozilla::TimeStamp timeStamp;
|
||||
if (ReadParam(aMsg, aIter, &result) && ReadParam(aMsg, aIter, &message) &&
|
||||
ReadParam(aMsg, aIter, &timeStamp)) {
|
||||
*aResult = paramType(result, std::move(message));
|
||||
aResult->SetGPUCrashTimeStamp(timeStamp);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
};
|
||||
};
|
||||
|
||||
} // namespace IPC
|
||||
|
||||
#endif // mozilla_dom_media_MediaIPCUtils_h
|
||||
|
Loading…
Reference in New Issue
Block a user