diff --git a/dom/media/webrtc/WebrtcGlobal.h b/dom/media/webrtc/WebrtcGlobal.h index 09e5f33b5c80..f4f276cd1133 100644 --- a/dom/media/webrtc/WebrtcGlobal.h +++ b/dom/media/webrtc/WebrtcGlobal.h @@ -16,42 +16,6 @@ typedef mozilla::dom::Sequence WebrtcGlobalLog; namespace IPC { -template -struct ParamTraits> -{ - typedef mozilla::dom::Optional paramType; - - static void Write(Message* aMsg, const paramType& aParam) - { - if (aParam.WasPassed()) { - WriteParam(aMsg, true); - WriteParam(aMsg, aParam.Value()); - return; - } - - WriteParam(aMsg, false); - } - - static bool Read(const Message* aMsg, PickleIterator* aIter, paramType* aResult) - { - bool was_passed = false; - - if (!ReadParam(aMsg, aIter, &was_passed)) { - return false; - } - - aResult->Reset(); //XXX Optional_base seems to reach this point with isSome true. - - if (was_passed) { - if (!ReadParam(aMsg, aIter, &(aResult->Construct()))) { - return false; - } - } - - return true; - } -}; - template struct ParamTraits> { diff --git a/ipc/glue/IPCMessageUtils.h b/ipc/glue/IPCMessageUtils.h index 7ed4fd7c0973..135c13193428 100644 --- a/ipc/glue/IPCMessageUtils.h +++ b/ipc/glue/IPCMessageUtils.h @@ -979,6 +979,42 @@ struct ParamTraits> } }; +template +struct ParamTraits> +{ + typedef mozilla::dom::Optional paramType; + + static void Write(Message* aMsg, const paramType& aParam) + { + if (aParam.WasPassed()) { + WriteParam(aMsg, true); + WriteParam(aMsg, aParam.Value()); + return; + } + + WriteParam(aMsg, false); + } + + static bool Read(const Message* aMsg, PickleIterator* aIter, paramType* aResult) + { + bool wasPassed = false; + + if (!ReadParam(aMsg, aIter, &wasPassed)) { + return false; + } + + aResult->Reset(); + + if (wasPassed) { + if (!ReadParam(aMsg, aIter, &aResult->Construct())) { + return false; + } + } + + return true; + } +}; + } /* namespace IPC */ #endif /* __IPC_GLUE_IPCMESSAGEUTILS_H__ */