Backed out 7 changesets (bug 1942424) for causing frequent crashes. a=backout
[gecko.git] / dom / media / mediacontrol / MediaControlIPC.h
blob71082dc1385e8fc6974ffad32d619f4f1f649abc
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #ifndef ipc_MediaControlIPC_h
8 #define ipc_MediaControlIPC_h
10 #include "ipc/EnumSerializer.h"
12 #include "mozilla/dom/MediaControllerBinding.h"
13 #include "mozilla/dom/MediaControlKeySource.h"
14 #include "mozilla/dom/MediaPlaybackStatus.h"
16 namespace IPC {
17 template <>
18 struct ParamTraits<mozilla::dom::MediaControlKey>
19 : public ContiguousEnumSerializerInclusive<
20 mozilla::dom::MediaControlKey, mozilla::dom::MediaControlKey::Focus,
21 mozilla::dom::MediaControlKey::Stop> {};
23 template <>
24 struct ParamTraits<mozilla::dom::MediaPlaybackState>
25 : public ContiguousEnumSerializerInclusive<
26 mozilla::dom::MediaPlaybackState,
27 mozilla::dom::MediaPlaybackState::eStarted,
28 mozilla::dom::MediaPlaybackState::eStopped> {};
30 template <>
31 struct ParamTraits<mozilla::dom::MediaAudibleState>
32 : public ContiguousEnumSerializerInclusive<
33 mozilla::dom::MediaAudibleState,
34 mozilla::dom::MediaAudibleState::eInaudible,
35 mozilla::dom::MediaAudibleState::eAudible> {};
37 template <>
38 struct ParamTraits<mozilla::dom::AbsoluteSeek> {
39 typedef mozilla::dom::AbsoluteSeek paramType;
41 static void Write(MessageWriter* aWriter, const paramType& aParam) {
42 WriteParam(aWriter, aParam.mSeekTime);
43 WriteParam(aWriter, aParam.mFastSeek);
46 static bool Read(MessageReader* aReader, paramType* aResult) {
47 if (!ReadParam(aReader, &aResult->mSeekTime) ||
48 !ReadParam(aReader, &aResult->mFastSeek)) {
49 return false;
51 return true;
55 template <>
56 struct ParamTraits<mozilla::dom::SeekDetails> {
57 typedef mozilla::dom::SeekDetails paramType;
59 static void Write(MessageWriter* aWriter, const paramType& aParam) {
60 WriteParam(aWriter, aParam.mAbsolute);
61 WriteParam(aWriter, aParam.mRelativeSeekOffset);
64 static bool Read(MessageReader* aReader, paramType* aResult) {
65 if (!ReadParam(aReader, &aResult->mAbsolute) ||
66 !ReadParam(aReader, &aResult->mRelativeSeekOffset)) {
67 return false;
69 return true;
73 template <>
74 struct ParamTraits<mozilla::dom::MediaControlAction> {
75 typedef mozilla::dom::MediaControlAction paramType;
77 static void Write(MessageWriter* aWriter, const paramType& aParam) {
78 WriteParam(aWriter, aParam.mKey);
79 WriteParam(aWriter, aParam.mDetails);
82 static bool Read(MessageReader* aReader, paramType* aResult) {
83 if (!ReadParam(aReader, &aResult->mKey) ||
84 !ReadParam(aReader, &aResult->mDetails)) {
85 return false;
87 return true;
91 } // namespace IPC
93 #endif // mozilla_MediaControlIPC_hh