2009-11-17 17:22:23 +03:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
2012-05-21 15:12:37 +04:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
2009-11-17 17:22:23 +03:00
|
|
|
|
|
|
|
#ifndef TABMESSAGE_UTILS_H
|
|
|
|
#define TABMESSAGE_UTILS_H
|
|
|
|
|
2012-12-06 07:01:58 +04:00
|
|
|
#include "AudioChannelCommon.h"
|
2012-08-28 16:41:04 +04:00
|
|
|
#include "ipc/IPCMessageUtils.h"
|
2014-04-10 21:39:20 +04:00
|
|
|
#include "mozilla/dom/AudioChannelBinding.h"
|
2012-06-11 03:44:50 +04:00
|
|
|
#include "nsIDOMEvent.h"
|
2009-11-17 17:22:23 +03:00
|
|
|
#include "nsCOMPtr.h"
|
|
|
|
|
2011-06-08 23:56:31 +04:00
|
|
|
#ifdef MOZ_CRASHREPORTER
|
|
|
|
#include "nsExceptionHandler.h"
|
|
|
|
#endif
|
|
|
|
|
2009-11-17 17:22:23 +03:00
|
|
|
namespace mozilla {
|
|
|
|
namespace dom {
|
|
|
|
struct RemoteDOMEvent
|
|
|
|
{
|
2013-03-09 15:34:29 +04:00
|
|
|
// Make sure to set the owner after deserializing.
|
2012-06-11 03:44:50 +04:00
|
|
|
nsCOMPtr<nsIDOMEvent> mEvent;
|
2009-11-17 17:22:23 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
bool ReadRemoteEvent(const IPC::Message* aMsg, void** aIter,
|
|
|
|
mozilla::dom::RemoteDOMEvent* aResult);
|
|
|
|
|
2011-06-08 23:56:31 +04:00
|
|
|
#ifdef MOZ_CRASHREPORTER
|
|
|
|
typedef CrashReporter::ThreadId NativeThreadId;
|
|
|
|
#else
|
|
|
|
// unused in this case
|
2012-09-17 12:37:20 +04:00
|
|
|
typedef int32_t NativeThreadId;
|
2011-06-08 23:56:31 +04:00
|
|
|
#endif
|
|
|
|
|
2009-11-17 17:22:23 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
namespace IPC {
|
|
|
|
|
|
|
|
template<>
|
|
|
|
struct ParamTraits<mozilla::dom::RemoteDOMEvent>
|
|
|
|
{
|
|
|
|
typedef mozilla::dom::RemoteDOMEvent paramType;
|
|
|
|
|
|
|
|
static void Write(Message* aMsg, const paramType& aParam)
|
|
|
|
{
|
2011-10-17 18:59:28 +04:00
|
|
|
aParam.mEvent->Serialize(aMsg, true);
|
2009-11-17 17:22:23 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
static bool Read(const Message* aMsg, void** aIter, paramType* aResult)
|
|
|
|
{
|
|
|
|
return mozilla::dom::ReadRemoteEvent(aMsg, aIter, aResult);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void Log(const paramType& aParam, std::wstring* aLog)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2014-04-10 21:39:20 +04:00
|
|
|
template<>
|
|
|
|
struct ParamTraits<mozilla::dom::AudioChannel>
|
|
|
|
{
|
|
|
|
typedef mozilla::dom::AudioChannel paramType;
|
|
|
|
|
|
|
|
static bool IsLegalValue(const paramType &aValue) {
|
|
|
|
return aValue <= mozilla::dom::AudioChannel::Publicnotification;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void Write(Message* aMsg, const paramType& aValue) {
|
|
|
|
MOZ_ASSERT(IsLegalValue(aValue));
|
|
|
|
WriteParam(aMsg, (uint32_t)aValue);
|
|
|
|
}
|
|
|
|
|
|
|
|
static bool Read(const Message* aMsg, void** aIter, paramType* aResult) {
|
|
|
|
uint32_t value;
|
|
|
|
if(!ReadParam(aMsg, aIter, &value) ||
|
|
|
|
!IsLegalValue(paramType(value))) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
*aResult = paramType(value);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void Log(const paramType& aParam, std::wstring* aLog)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
};
|
2012-12-06 07:01:58 +04:00
|
|
|
|
2013-09-02 13:45:44 +04:00
|
|
|
template <>
|
|
|
|
struct ParamTraits<mozilla::dom::AudioChannelState>
|
2014-04-14 18:17:40 +04:00
|
|
|
: public ContiguousEnumSerializer<mozilla::dom::AudioChannelState,
|
|
|
|
mozilla::dom::AUDIO_CHANNEL_STATE_NORMAL,
|
|
|
|
mozilla::dom::AUDIO_CHANNEL_STATE_LAST>
|
2013-09-02 13:45:44 +04:00
|
|
|
{ };
|
|
|
|
|
2009-11-17 17:22:23 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#endif
|