Bug 1627646 - Avoid creating a Port object when there are no listeners r=mixedpuppy
[gecko.git] / widget / WidgetMessageUtils.h
blobc5d7904f01ccaf9adc80b376f25f42f5660f02f5
1 /* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5 #ifndef mozilla_WidgetMessageUtils_h
6 #define mozilla_WidgetMessageUtils_h
8 #include "ipc/IPCMessageUtils.h"
9 #include "mozilla/LookAndFeel.h"
10 #include "nsIWidget.h"
12 namespace IPC {
14 template <>
15 struct ParamTraits<LookAndFeelInt> {
16 typedef LookAndFeelInt paramType;
18 static void Write(Message* aMsg, const paramType& aParam) {
19 WriteParam(aMsg, aParam.id);
20 WriteParam(aMsg, aParam.value);
23 static bool Read(const Message* aMsg, PickleIterator* aIter,
24 paramType* aResult) {
25 int32_t id, value;
26 if (ReadParam(aMsg, aIter, &id) && ReadParam(aMsg, aIter, &value)) {
27 aResult->id = id;
28 aResult->value = value;
29 return true;
31 return false;
35 template <>
36 struct ParamTraits<nsTransparencyMode>
37 : public ContiguousEnumSerializerInclusive<nsTransparencyMode,
38 eTransparencyOpaque,
39 eTransparencyBorderlessGlass> {};
41 template <>
42 struct ParamTraits<nsCursor>
43 : public ContiguousEnumSerializer<nsCursor, eCursor_standard,
44 eCursorCount> {};
46 } // namespace IPC
48 #endif // WidgetMessageUtils_h