2009-09-22 02:02:15 +00:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* vim: set sw=2 ts=8 et tw=80 : */
|
2012-05-21 11:12:37 +00: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-06-29 18:38:29 +00:00
|
|
|
|
|
|
|
#ifndef __IPC_GLUE_IPCMESSAGEUTILS_H__
|
|
|
|
#define __IPC_GLUE_IPCMESSAGEUTILS_H__
|
|
|
|
|
2013-01-17 20:06:36 +00:00
|
|
|
#include "base/process_util.h"
|
2009-06-29 18:38:29 +00:00
|
|
|
#include "chrome/common/ipc_message_utils.h"
|
|
|
|
|
2012-07-31 17:28:20 +00:00
|
|
|
#include "mozilla/TimeStamp.h"
|
2013-02-11 21:56:58 +00:00
|
|
|
#ifdef XP_WIN
|
|
|
|
#include "mozilla/TimeStamp_windows.h"
|
|
|
|
#endif
|
2011-10-11 05:50:08 +00:00
|
|
|
#include "mozilla/Util.h"
|
2012-04-12 19:55:26 +00:00
|
|
|
#include "mozilla/gfx/2D.h"
|
2012-09-22 15:49:58 +00:00
|
|
|
#include "mozilla/StandardInteger.h"
|
2011-10-11 05:50:08 +00:00
|
|
|
|
2011-06-24 14:19:56 +00:00
|
|
|
#include "nsID.h"
|
|
|
|
#include "nsMemory.h"
|
2009-06-29 18:38:29 +00:00
|
|
|
#include "nsStringGlue.h"
|
|
|
|
#include "nsTArray.h"
|
2010-06-21 20:35:48 +00:00
|
|
|
#include "gfx3DMatrix.h"
|
|
|
|
#include "gfxColor.h"
|
2010-03-22 20:04:37 +00:00
|
|
|
#include "gfxMatrix.h"
|
2010-06-21 20:35:48 +00:00
|
|
|
#include "gfxPattern.h"
|
2012-04-25 02:48:33 +00:00
|
|
|
#include "gfxPoint.h"
|
2012-08-09 04:39:02 +00:00
|
|
|
#include "gfxRect.h"
|
2010-06-21 20:35:48 +00:00
|
|
|
#include "nsRect.h"
|
|
|
|
#include "nsRegion.h"
|
2010-09-15 16:02:44 +00:00
|
|
|
#include "gfxASurface.h"
|
2012-08-02 06:02:29 +00:00
|
|
|
#include "jsapi.h"
|
Bug 825928: Land layers refactoring. r=jrmuizel,bas,nical,mattwoodrow,roc,nrc,benwa,bjacob,jgilbert,kchen CLOSED TREE
Please contact Bas Schouten <bschouten@mozilla.com>, Nicolas Silva <nsilva@mozilla.com> or Nicholas Cameron <ncameron@mozilla.com> with general questions. Below is a rough list of authors to contact with specific questions.
Authors:
gfx/layers/Compositor.* gfx/layers/Effects.h - Compositor Interface - bas,nrc,nical
gfx/layers/d3d* - D3D9/D3D10 - bas
gfx/layers/ThebesLayer* - ThebesLayers - nrc,bas
gfx/layers/composite/* - CompositeLayers - nrc,nical
gfx/layers/client/* - Client - nrc,nical,bas
gfx/layers/*Image* - nical
gfx/layers/ipc ipc - IPC - nical
gfx/layers/opengl - CompositorOGL - nrc,nical
gfx/2d - bas,nrc
gfx/gl - GLContext - bjacob
dom/* layout/* - DOM - mattwoodrow
2013-04-10 09:20:52 +00:00
|
|
|
#include "mozilla/layers/LayersTypes.h"
|
|
|
|
#include "mozilla/layers/CompositorTypes.h"
|
2012-08-09 04:39:02 +00:00
|
|
|
#include "FrameMetrics.h"
|
2012-08-20 13:35:41 +00:00
|
|
|
#include "nsCSSProperty.h"
|
2013-05-09 21:02:50 +00:00
|
|
|
#include "ImageLayers.h"
|
2009-06-29 18:38:29 +00:00
|
|
|
|
2010-01-22 15:06:13 +00:00
|
|
|
#ifdef _MSC_VER
|
|
|
|
#pragma warning( disable : 4800 )
|
|
|
|
#endif
|
|
|
|
|
2010-11-09 02:48:59 +00:00
|
|
|
#if !defined(OS_POSIX)
|
|
|
|
// This condition must be kept in sync with the one in
|
|
|
|
// ipc_message_utils.h, but this dummy definition of
|
|
|
|
// base::FileDescriptor acts as a static assert that we only get one
|
|
|
|
// def or the other (or neither, in which case code using
|
|
|
|
// FileDescriptor fails to build)
|
2012-01-18 02:01:51 +00:00
|
|
|
namespace base { struct FileDescriptor { }; }
|
2010-11-09 02:48:59 +00:00
|
|
|
#endif
|
2010-05-22 19:35:40 +00:00
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
|
2012-07-12 12:51:57 +00:00
|
|
|
typedef gfxASurface::gfxContentType gfxContentType;
|
|
|
|
typedef gfxASurface::gfxImageFormat PixelFormat;
|
2010-09-15 16:02:44 +00:00
|
|
|
typedef gfxASurface::gfxSurfaceType gfxSurfaceType;
|
2012-07-12 12:51:57 +00:00
|
|
|
typedef gfxPattern::GraphicsFilter GraphicsFilterType;
|
2012-07-18 16:31:40 +00:00
|
|
|
typedef layers::LayersBackend LayersBackend;
|
2013-05-09 21:02:50 +00:00
|
|
|
typedef layers::ImageLayer::ScaleMode ScaleMode;
|
2010-06-21 20:35:48 +00:00
|
|
|
|
2011-07-22 00:49:35 +00:00
|
|
|
// This is a cross-platform approximation to HANDLE, which we expect
|
|
|
|
// to be typedef'd to void* or thereabouts.
|
|
|
|
typedef uintptr_t WindowsHandle;
|
|
|
|
|
2010-05-22 19:35:40 +00:00
|
|
|
// XXX there are out of place and might be generally useful. Could
|
|
|
|
// move to nscore.h or something.
|
2010-05-22 19:35:42 +00:00
|
|
|
struct void_t {
|
|
|
|
bool operator==(const void_t&) const { return true; }
|
|
|
|
};
|
|
|
|
struct null_t {
|
|
|
|
bool operator==(const null_t&) const { return true; }
|
|
|
|
};
|
2010-05-22 19:35:40 +00:00
|
|
|
|
2012-08-02 06:02:29 +00:00
|
|
|
struct SerializedStructuredCloneBuffer
|
|
|
|
{
|
|
|
|
SerializedStructuredCloneBuffer()
|
|
|
|
: data(nullptr), dataLength(0)
|
|
|
|
{ }
|
|
|
|
|
|
|
|
SerializedStructuredCloneBuffer(const JSAutoStructuredCloneBuffer& aOther)
|
|
|
|
{
|
|
|
|
*this = aOther;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
|
|
|
operator==(const SerializedStructuredCloneBuffer& aOther) const
|
|
|
|
{
|
|
|
|
return this->data == aOther.data &&
|
|
|
|
this->dataLength == aOther.dataLength;
|
|
|
|
}
|
|
|
|
|
|
|
|
SerializedStructuredCloneBuffer&
|
|
|
|
operator=(const JSAutoStructuredCloneBuffer& aOther)
|
|
|
|
{
|
|
|
|
data = aOther.data();
|
|
|
|
dataLength = aOther.nbytes();
|
|
|
|
return *this;
|
|
|
|
}
|
|
|
|
|
|
|
|
uint64_t* data;
|
|
|
|
size_t dataLength;
|
|
|
|
};
|
|
|
|
|
2010-05-22 19:35:40 +00:00
|
|
|
} // namespace mozilla
|
|
|
|
|
2009-06-29 18:38:29 +00:00
|
|
|
namespace IPC {
|
|
|
|
|
2011-11-24 11:45:55 +00:00
|
|
|
/**
|
|
|
|
* Generic enum serializer.
|
2012-02-05 19:51:06 +00:00
|
|
|
*
|
|
|
|
* This is a generic serializer for any enum type used in IPDL.
|
|
|
|
* Programmers can define ParamTraits<E> for enum type E by deriving
|
|
|
|
* EnumSerializer<E, smallestLegal, highGuard>.
|
|
|
|
*
|
|
|
|
* The serializer would check value againts a range specified by
|
|
|
|
* smallestLegal and highGuard. Only values from smallestLegal to
|
|
|
|
* highGuard are valid, include smallestLegal but highGuard.
|
|
|
|
*
|
|
|
|
* For example, following is definition of serializer for enum type FOO.
|
|
|
|
* \code
|
|
|
|
* enum FOO { FOO_FIRST, FOO_SECOND, FOO_LAST, NUM_FOO };
|
|
|
|
*
|
|
|
|
* template <>
|
|
|
|
* struct ParamTraits<FOO>:
|
|
|
|
* public EnumSerializer<FOO, FOO_FIRST, NUM_FOO> {};
|
|
|
|
* \endcode
|
|
|
|
* FOO_FIRST, FOO_SECOND, and FOO_LAST are valid value.
|
|
|
|
*
|
|
|
|
* \sa https://developer.mozilla.org/en/IPDL/Type_Serialization
|
2011-11-24 11:45:55 +00:00
|
|
|
*/
|
2012-02-05 19:51:06 +00:00
|
|
|
template <typename E, E smallestLegal, E highBound>
|
2011-11-24 11:45:55 +00:00
|
|
|
struct EnumSerializer {
|
|
|
|
typedef E paramType;
|
|
|
|
|
|
|
|
static bool IsLegalValue(const paramType &aValue) {
|
2012-02-05 19:51:06 +00:00
|
|
|
return smallestLegal <= aValue && aValue < highBound;
|
2011-11-24 11:45:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void Write(Message* aMsg, const paramType& aValue) {
|
|
|
|
MOZ_ASSERT(IsLegalValue(aValue));
|
2012-09-17 08:37:20 +00:00
|
|
|
WriteParam(aMsg, (int32_t)aValue);
|
2011-11-24 11:45:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static bool Read(const Message* aMsg, void** aIter, paramType* aResult) {
|
2012-09-17 08:37:20 +00:00
|
|
|
int32_t value;
|
2011-11-24 11:45:55 +00:00
|
|
|
if(!ReadParam(aMsg, aIter, &value) ||
|
|
|
|
!IsLegalValue(paramType(value))) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
*aResult = paramType(value);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2013-01-17 20:06:36 +00:00
|
|
|
template <>
|
|
|
|
struct ParamTraits<base::ChildPrivileges>
|
|
|
|
: public EnumSerializer<base::ChildPrivileges,
|
|
|
|
base::PRIVILEGES_DEFAULT,
|
|
|
|
base::PRIVILEGES_LAST>
|
|
|
|
{ };
|
|
|
|
|
2010-01-25 22:47:39 +00:00
|
|
|
template<>
|
2012-08-22 15:56:38 +00:00
|
|
|
struct ParamTraits<int8_t>
|
2010-01-25 22:47:39 +00:00
|
|
|
{
|
2012-08-22 15:56:38 +00:00
|
|
|
typedef int8_t paramType;
|
2010-01-25 22:47:39 +00:00
|
|
|
|
|
|
|
static void Write(Message* aMsg, const paramType& aParam)
|
|
|
|
{
|
|
|
|
aMsg->WriteBytes(&aParam, sizeof(aParam));
|
|
|
|
}
|
|
|
|
|
|
|
|
static bool Read(const Message* aMsg, void** aIter, paramType* aResult)
|
|
|
|
{
|
|
|
|
const char* outp;
|
|
|
|
if (!aMsg->ReadBytes(aIter, &outp, sizeof(*aResult)))
|
|
|
|
return false;
|
|
|
|
|
|
|
|
*aResult = *reinterpret_cast<const paramType*>(outp);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
template<>
|
2012-08-22 15:56:38 +00:00
|
|
|
struct ParamTraits<uint8_t>
|
2010-01-25 22:47:39 +00:00
|
|
|
{
|
2012-08-22 15:56:38 +00:00
|
|
|
typedef uint8_t paramType;
|
2010-01-25 22:47:39 +00:00
|
|
|
|
|
|
|
static void Write(Message* aMsg, const paramType& aParam)
|
|
|
|
{
|
|
|
|
aMsg->WriteBytes(&aParam, sizeof(aParam));
|
|
|
|
}
|
|
|
|
|
|
|
|
static bool Read(const Message* aMsg, void** aIter, paramType* aResult)
|
|
|
|
{
|
|
|
|
const char* outp;
|
|
|
|
if (!aMsg->ReadBytes(aIter, &outp, sizeof(*aResult)))
|
|
|
|
return false;
|
|
|
|
|
|
|
|
*aResult = *reinterpret_cast<const paramType*>(outp);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2010-11-09 02:48:59 +00:00
|
|
|
#if !defined(OS_POSIX)
|
|
|
|
// See above re: keeping definitions in sync
|
|
|
|
template<>
|
|
|
|
struct ParamTraits<base::FileDescriptor>
|
|
|
|
{
|
|
|
|
typedef base::FileDescriptor paramType;
|
|
|
|
static void Write(Message* aMsg, const paramType& aParam) {
|
|
|
|
NS_RUNTIMEABORT("FileDescriptor isn't meaningful on this platform");
|
|
|
|
}
|
|
|
|
static bool Read(const Message* aMsg, void** aIter, paramType* aResult) {
|
|
|
|
NS_RUNTIMEABORT("FileDescriptor isn't meaningful on this platform");
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
#endif // !defined(OS_POSIX)
|
|
|
|
|
2009-06-29 18:38:29 +00:00
|
|
|
template <>
|
|
|
|
struct ParamTraits<nsACString>
|
|
|
|
{
|
|
|
|
typedef nsACString paramType;
|
|
|
|
|
|
|
|
static void Write(Message* aMsg, const paramType& aParam)
|
|
|
|
{
|
2009-09-22 02:02:15 +00:00
|
|
|
bool isVoid = aParam.IsVoid();
|
|
|
|
aMsg->WriteBool(isVoid);
|
|
|
|
|
|
|
|
if (isVoid)
|
|
|
|
// represents a NULL pointer
|
|
|
|
return;
|
|
|
|
|
2012-08-22 15:56:38 +00:00
|
|
|
uint32_t length = aParam.Length();
|
2009-06-29 18:38:29 +00:00
|
|
|
WriteParam(aMsg, length);
|
|
|
|
aMsg->WriteBytes(aParam.BeginReading(), length);
|
|
|
|
}
|
|
|
|
|
2009-07-29 21:12:15 +00:00
|
|
|
static bool Read(const Message* aMsg, void** aIter, paramType* aResult)
|
2009-06-29 18:38:29 +00:00
|
|
|
{
|
2009-09-22 02:02:15 +00:00
|
|
|
bool isVoid;
|
|
|
|
if (!aMsg->ReadBool(aIter, &isVoid))
|
|
|
|
return false;
|
|
|
|
|
|
|
|
if (isVoid) {
|
2011-10-17 14:59:28 +00:00
|
|
|
aResult->SetIsVoid(true);
|
2009-09-22 02:02:15 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2012-08-22 15:56:38 +00:00
|
|
|
uint32_t length;
|
2009-06-29 18:38:29 +00:00
|
|
|
if (ReadParam(aMsg, aIter, &length)) {
|
|
|
|
const char* buf;
|
|
|
|
if (aMsg->ReadBytes(aIter, &buf, length)) {
|
2009-07-29 21:12:15 +00:00
|
|
|
aResult->Assign(buf, length);
|
2009-06-29 18:38:29 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void Log(const paramType& aParam, std::wstring* aLog)
|
|
|
|
{
|
2009-09-22 02:02:15 +00:00
|
|
|
if (aParam.IsVoid())
|
|
|
|
aLog->append(L"(NULL)");
|
|
|
|
else
|
|
|
|
aLog->append(UTF8ToWide(aParam.BeginReading()));
|
2009-06-29 18:38:29 +00:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
template <>
|
|
|
|
struct ParamTraits<nsAString>
|
|
|
|
{
|
|
|
|
typedef nsAString paramType;
|
|
|
|
|
|
|
|
static void Write(Message* aMsg, const paramType& aParam)
|
|
|
|
{
|
2009-09-22 02:02:15 +00:00
|
|
|
bool isVoid = aParam.IsVoid();
|
|
|
|
aMsg->WriteBool(isVoid);
|
|
|
|
|
|
|
|
if (isVoid)
|
|
|
|
// represents a NULL pointer
|
|
|
|
return;
|
|
|
|
|
2012-08-22 15:56:38 +00:00
|
|
|
uint32_t length = aParam.Length();
|
2009-06-29 18:38:29 +00:00
|
|
|
WriteParam(aMsg, length);
|
|
|
|
aMsg->WriteBytes(aParam.BeginReading(), length * sizeof(PRUnichar));
|
|
|
|
}
|
|
|
|
|
2009-07-29 21:12:15 +00:00
|
|
|
static bool Read(const Message* aMsg, void** aIter, paramType* aResult)
|
2009-06-29 18:38:29 +00:00
|
|
|
{
|
2009-09-22 02:02:15 +00:00
|
|
|
bool isVoid;
|
|
|
|
if (!aMsg->ReadBool(aIter, &isVoid))
|
|
|
|
return false;
|
|
|
|
|
|
|
|
if (isVoid) {
|
2011-10-17 14:59:28 +00:00
|
|
|
aResult->SetIsVoid(true);
|
2009-09-22 02:02:15 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2012-08-22 15:56:38 +00:00
|
|
|
uint32_t length;
|
2009-06-29 18:38:29 +00:00
|
|
|
if (ReadParam(aMsg, aIter, &length)) {
|
|
|
|
const PRUnichar* buf;
|
|
|
|
if (aMsg->ReadBytes(aIter, reinterpret_cast<const char**>(&buf),
|
|
|
|
length * sizeof(PRUnichar))) {
|
2009-07-29 21:12:15 +00:00
|
|
|
aResult->Assign(buf, length);
|
2009-06-29 18:38:29 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void Log(const paramType& aParam, std::wstring* aLog)
|
|
|
|
{
|
2009-09-22 02:02:15 +00:00
|
|
|
if (aParam.IsVoid())
|
|
|
|
aLog->append(L"(NULL)");
|
|
|
|
else {
|
2009-06-29 18:38:29 +00:00
|
|
|
#ifdef WCHAR_T_IS_UTF16
|
2009-09-22 02:02:15 +00:00
|
|
|
aLog->append(reinterpret_cast<const wchar_t*>(aParam.BeginReading()));
|
2009-06-29 18:38:29 +00:00
|
|
|
#else
|
2012-08-22 15:56:38 +00:00
|
|
|
uint32_t length = aParam.Length();
|
|
|
|
for (uint32_t index = 0; index < length; index++) {
|
2009-09-22 02:02:15 +00:00
|
|
|
aLog->push_back(std::wstring::value_type(aParam[index]));
|
|
|
|
}
|
2009-06-29 18:38:29 +00:00
|
|
|
#endif
|
2009-09-22 02:02:15 +00:00
|
|
|
}
|
2009-06-29 18:38:29 +00:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2009-07-29 21:12:15 +00:00
|
|
|
template <>
|
|
|
|
struct ParamTraits<nsCString> : ParamTraits<nsACString>
|
|
|
|
{
|
|
|
|
typedef nsCString paramType;
|
|
|
|
};
|
|
|
|
|
2010-03-23 15:14:36 +00:00
|
|
|
#ifdef MOZILLA_INTERNAL_API
|
|
|
|
|
|
|
|
template<>
|
2012-09-02 02:35:17 +00:00
|
|
|
struct ParamTraits<nsAutoCString> : ParamTraits<nsCString>
|
2010-03-23 15:14:36 +00:00
|
|
|
{
|
2012-09-02 02:35:17 +00:00
|
|
|
typedef nsAutoCString paramType;
|
2010-03-23 15:14:36 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // MOZILLA_INTERNAL_API
|
|
|
|
|
2009-07-29 21:12:15 +00:00
|
|
|
template <>
|
|
|
|
struct ParamTraits<nsString> : ParamTraits<nsAString>
|
|
|
|
{
|
|
|
|
typedef nsString paramType;
|
|
|
|
};
|
|
|
|
|
2012-12-19 01:16:06 +00:00
|
|
|
template <typename E>
|
|
|
|
struct ParamTraits<FallibleTArray<E> >
|
2009-06-29 18:38:29 +00:00
|
|
|
{
|
2012-12-19 01:16:06 +00:00
|
|
|
typedef FallibleTArray<E> paramType;
|
2009-06-29 18:38:29 +00:00
|
|
|
|
|
|
|
static void Write(Message* aMsg, const paramType& aParam)
|
|
|
|
{
|
2012-08-22 15:56:38 +00:00
|
|
|
uint32_t length = aParam.Length();
|
2009-06-29 18:38:29 +00:00
|
|
|
WriteParam(aMsg, length);
|
2012-08-22 15:56:38 +00:00
|
|
|
for (uint32_t index = 0; index < length; index++) {
|
2009-06-29 18:38:29 +00:00
|
|
|
WriteParam(aMsg, aParam[index]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-07-29 21:12:15 +00:00
|
|
|
static bool Read(const Message* aMsg, void** aIter, paramType* aResult)
|
2009-06-29 18:38:29 +00:00
|
|
|
{
|
2012-08-22 15:56:38 +00:00
|
|
|
uint32_t length;
|
2009-06-29 18:38:29 +00:00
|
|
|
if (!ReadParam(aMsg, aIter, &length)) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2010-06-21 20:35:48 +00:00
|
|
|
aResult->SetCapacity(length);
|
2012-08-22 15:56:38 +00:00
|
|
|
for (uint32_t index = 0; index < length; index++) {
|
2009-10-19 21:06:13 +00:00
|
|
|
E* element = aResult->AppendElement();
|
|
|
|
if (!(element && ReadParam(aMsg, aIter, element))) {
|
2009-08-05 22:36:33 +00:00
|
|
|
return false;
|
2009-06-29 18:38:29 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void Log(const paramType& aParam, std::wstring* aLog)
|
|
|
|
{
|
2012-08-22 15:56:38 +00:00
|
|
|
for (uint32_t index = 0; index < aParam.Length(); index++) {
|
2009-06-29 18:38:29 +00:00
|
|
|
if (index) {
|
|
|
|
aLog->append(L" ");
|
|
|
|
}
|
|
|
|
LogParam(aParam[index], aLog);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2010-11-09 02:49:00 +00:00
|
|
|
template<typename E>
|
2012-12-19 01:16:06 +00:00
|
|
|
struct ParamTraits<InfallibleTArray<E> >
|
2010-11-09 02:49:00 +00:00
|
|
|
{
|
|
|
|
typedef InfallibleTArray<E> paramType;
|
|
|
|
|
2012-12-19 01:16:06 +00:00
|
|
|
static void Write(Message* aMsg, const paramType& aParam)
|
|
|
|
{
|
|
|
|
WriteParam(aMsg, static_cast<const FallibleTArray<E>&>(aParam));
|
|
|
|
}
|
2010-11-09 02:49:00 +00:00
|
|
|
|
|
|
|
// deserialize the array fallibly, but return an InfallibleTArray
|
|
|
|
static bool Read(const Message* aMsg, void** aIter, paramType* aResult)
|
|
|
|
{
|
2012-12-19 01:16:06 +00:00
|
|
|
FallibleTArray<E> temp;
|
2010-11-09 02:49:00 +00:00
|
|
|
if (!ReadParam(aMsg, aIter, &temp))
|
|
|
|
return false;
|
|
|
|
|
|
|
|
aResult->SwapElements(temp);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2012-12-19 01:16:06 +00:00
|
|
|
static void Log(const paramType& aParam, std::wstring* aLog)
|
|
|
|
{
|
|
|
|
LogParam(static_cast<const FallibleTArray<E>&>(aParam), aLog);
|
|
|
|
}
|
2010-11-09 02:49:00 +00:00
|
|
|
};
|
|
|
|
|
2009-11-06 20:24:35 +00:00
|
|
|
template<>
|
|
|
|
struct ParamTraits<float>
|
|
|
|
{
|
|
|
|
typedef float paramType;
|
|
|
|
|
|
|
|
static void Write(Message* aMsg, const paramType& aParam)
|
|
|
|
{
|
|
|
|
aMsg->WriteBytes(&aParam, sizeof(paramType));
|
|
|
|
}
|
|
|
|
|
|
|
|
static bool Read(const Message* aMsg, void** aIter, paramType* aResult)
|
|
|
|
{
|
|
|
|
const char* outFloat;
|
|
|
|
if (!aMsg->ReadBytes(aIter, &outFloat, sizeof(float)))
|
|
|
|
return false;
|
|
|
|
*aResult = *reinterpret_cast<const float*>(outFloat);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void Log(const paramType& aParam, std::wstring* aLog)
|
|
|
|
{
|
|
|
|
aLog->append(StringPrintf(L"%g", aParam));
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2010-03-22 20:04:37 +00:00
|
|
|
template<>
|
|
|
|
struct ParamTraits<gfxMatrix>
|
|
|
|
{
|
|
|
|
typedef gfxMatrix paramType;
|
|
|
|
|
|
|
|
static void Write(Message* aMsg, const paramType& aParam)
|
|
|
|
{
|
|
|
|
WriteParam(aMsg, aParam.xx);
|
|
|
|
WriteParam(aMsg, aParam.xy);
|
|
|
|
WriteParam(aMsg, aParam.yx);
|
|
|
|
WriteParam(aMsg, aParam.yy);
|
|
|
|
WriteParam(aMsg, aParam.x0);
|
|
|
|
WriteParam(aMsg, aParam.y0);
|
|
|
|
}
|
|
|
|
|
|
|
|
static bool Read(const Message* aMsg, void** aIter, paramType* aResult)
|
|
|
|
{
|
|
|
|
if (ReadParam(aMsg, aIter, &aResult->xx) &&
|
|
|
|
ReadParam(aMsg, aIter, &aResult->xy) &&
|
|
|
|
ReadParam(aMsg, aIter, &aResult->yx) &&
|
|
|
|
ReadParam(aMsg, aIter, &aResult->yy) &&
|
|
|
|
ReadParam(aMsg, aIter, &aResult->x0) &&
|
|
|
|
ReadParam(aMsg, aIter, &aResult->y0))
|
|
|
|
return true;
|
|
|
|
|
2010-03-24 16:20:36 +00:00
|
|
|
return false;
|
2010-03-22 20:04:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void Log(const paramType& aParam, std::wstring* aLog)
|
|
|
|
{
|
|
|
|
aLog->append(StringPrintf(L"[[%g %g] [%g %g] [%g %g]]", aParam.xx, aParam.xy, aParam.yx, aParam.yy,
|
|
|
|
aParam.x0, aParam.y0));
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2012-06-27 15:43:57 +00:00
|
|
|
template<>
|
|
|
|
struct ParamTraits<gfxPoint>
|
|
|
|
{
|
|
|
|
typedef gfxPoint paramType;
|
|
|
|
|
|
|
|
static void Write(Message* aMsg, const paramType& aParam)
|
|
|
|
{
|
|
|
|
WriteParam(aMsg, aParam.x);
|
|
|
|
WriteParam(aMsg, aParam.y);
|
|
|
|
}
|
|
|
|
|
|
|
|
static bool Read(const Message* aMsg, void** aIter, paramType* aResult)
|
|
|
|
{
|
2012-07-31 17:28:20 +00:00
|
|
|
return (ReadParam(aMsg, aIter, &aResult->x) &&
|
|
|
|
ReadParam(aMsg, aIter, &aResult->y));
|
|
|
|
}
|
|
|
|
};
|
2012-07-27 20:23:44 +00:00
|
|
|
|
2012-07-31 17:28:20 +00:00
|
|
|
template<>
|
|
|
|
struct ParamTraits<gfxPoint3D>
|
|
|
|
{
|
|
|
|
typedef gfxPoint3D paramType;
|
|
|
|
|
|
|
|
static void Write(Message* aMsg, const paramType& aParam)
|
|
|
|
{
|
|
|
|
WriteParam(aMsg, aParam.x);
|
|
|
|
WriteParam(aMsg, aParam.y);
|
|
|
|
WriteParam(aMsg, aParam.z);
|
|
|
|
}
|
|
|
|
|
|
|
|
static bool Read(const Message* aMsg, void** aIter, paramType* aResult)
|
|
|
|
{
|
|
|
|
return (ReadParam(aMsg, aIter, &aResult->x) &&
|
|
|
|
ReadParam(aMsg, aIter, &aResult->y) &&
|
|
|
|
ReadParam(aMsg, aIter, &aResult->z));
|
2012-06-27 15:43:57 +00:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2012-04-25 02:48:33 +00:00
|
|
|
template<>
|
|
|
|
struct ParamTraits<gfxSize>
|
|
|
|
{
|
|
|
|
typedef gfxSize paramType;
|
|
|
|
|
|
|
|
static void Write(Message* aMsg, const paramType& aParam)
|
|
|
|
{
|
|
|
|
WriteParam(aMsg, aParam.width);
|
|
|
|
WriteParam(aMsg, aParam.height);
|
|
|
|
}
|
|
|
|
|
|
|
|
static bool Read(const Message* aMsg, void** aIter, paramType* aResult)
|
|
|
|
{
|
|
|
|
if (ReadParam(aMsg, aIter, &aResult->width) &&
|
|
|
|
ReadParam(aMsg, aIter, &aResult->height))
|
|
|
|
return true;
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2012-08-09 04:39:02 +00:00
|
|
|
template<>
|
|
|
|
struct ParamTraits<gfxRect>
|
|
|
|
{
|
|
|
|
typedef gfxRect paramType;
|
|
|
|
|
|
|
|
static void Write(Message* aMsg, const paramType& aParam)
|
|
|
|
{
|
|
|
|
WriteParam(aMsg, aParam.x);
|
|
|
|
WriteParam(aMsg, aParam.y);
|
|
|
|
WriteParam(aMsg, aParam.width);
|
|
|
|
WriteParam(aMsg, aParam.height);
|
|
|
|
}
|
|
|
|
|
|
|
|
static bool Read(const Message* aMsg, void** aIter, paramType* aResult)
|
|
|
|
{
|
|
|
|
return ReadParam(aMsg, aIter, &aResult->x) &&
|
|
|
|
ReadParam(aMsg, aIter, &aResult->y) &&
|
|
|
|
ReadParam(aMsg, aIter, &aResult->width) &&
|
|
|
|
ReadParam(aMsg, aIter, &aResult->height);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2010-06-21 20:35:48 +00:00
|
|
|
template<>
|
|
|
|
struct ParamTraits<gfx3DMatrix>
|
|
|
|
{
|
|
|
|
typedef gfx3DMatrix paramType;
|
|
|
|
|
|
|
|
static void Write(Message* msg, const paramType& param)
|
|
|
|
{
|
|
|
|
#define Wr(_f) WriteParam(msg, param. _f)
|
|
|
|
Wr(_11); Wr(_12); Wr(_13); Wr(_14);
|
|
|
|
Wr(_21); Wr(_22); Wr(_23); Wr(_24);
|
|
|
|
Wr(_31); Wr(_32); Wr(_33); Wr(_34);
|
|
|
|
Wr(_41); Wr(_42); Wr(_43); Wr(_44);
|
|
|
|
#undef Wr
|
|
|
|
}
|
|
|
|
|
|
|
|
static bool Read(const Message* msg, void** iter, paramType* result)
|
|
|
|
{
|
|
|
|
#define Rd(_f) ReadParam(msg, iter, &result-> _f)
|
|
|
|
return (Rd(_11) && Rd(_12) && Rd(_13) && Rd(_14) &&
|
|
|
|
Rd(_21) && Rd(_22) && Rd(_23) && Rd(_24) &&
|
|
|
|
Rd(_31) && Rd(_32) && Rd(_33) && Rd(_34) &&
|
|
|
|
Rd(_41) && Rd(_42) && Rd(_43) && Rd(_44));
|
|
|
|
#undef Rd
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2012-07-12 12:51:57 +00:00
|
|
|
template <>
|
|
|
|
struct ParamTraits<mozilla::gfxContentType>
|
|
|
|
: public EnumSerializer<mozilla::gfxContentType,
|
|
|
|
gfxASurface::CONTENT_COLOR,
|
|
|
|
gfxASurface::CONTENT_SENTINEL>
|
|
|
|
{};
|
2010-09-15 16:02:44 +00:00
|
|
|
|
2012-07-12 12:51:57 +00:00
|
|
|
template <>
|
2010-09-15 16:02:44 +00:00
|
|
|
struct ParamTraits<mozilla::gfxSurfaceType>
|
2012-07-12 12:51:57 +00:00
|
|
|
: public EnumSerializer<gfxASurface::gfxSurfaceType,
|
|
|
|
gfxASurface::SurfaceTypeImage,
|
|
|
|
gfxASurface::SurfaceTypeMax>
|
|
|
|
{};
|
2010-09-15 16:02:44 +00:00
|
|
|
|
2012-07-12 12:51:57 +00:00
|
|
|
template <>
|
|
|
|
struct ParamTraits<mozilla::GraphicsFilterType>
|
|
|
|
: public EnumSerializer<mozilla::GraphicsFilterType,
|
|
|
|
gfxPattern::FILTER_FAST,
|
|
|
|
gfxPattern::FILTER_SENTINEL>
|
|
|
|
{};
|
2010-09-15 16:02:44 +00:00
|
|
|
|
2012-07-12 12:51:57 +00:00
|
|
|
template <>
|
2012-07-18 16:31:40 +00:00
|
|
|
struct ParamTraits<mozilla::layers::LayersBackend>
|
|
|
|
: public EnumSerializer<mozilla::layers::LayersBackend,
|
|
|
|
mozilla::layers::LAYERS_NONE,
|
|
|
|
mozilla::layers::LAYERS_LAST>
|
2012-07-12 12:51:57 +00:00
|
|
|
{};
|
2010-12-31 07:40:19 +00:00
|
|
|
|
2013-05-09 21:02:50 +00:00
|
|
|
template <>
|
|
|
|
struct ParamTraits<mozilla::ScaleMode>
|
|
|
|
: public EnumSerializer<mozilla::ScaleMode,
|
|
|
|
mozilla::layers::ImageLayer::SCALE_NONE,
|
|
|
|
mozilla::layers::ImageLayer::SCALE_SENTINEL>
|
|
|
|
{};
|
|
|
|
|
2012-07-12 12:51:57 +00:00
|
|
|
template <>
|
2011-08-09 19:38:26 +00:00
|
|
|
struct ParamTraits<mozilla::PixelFormat>
|
2012-07-12 12:51:57 +00:00
|
|
|
: public EnumSerializer<mozilla::PixelFormat,
|
|
|
|
gfxASurface::ImageFormatARGB32,
|
|
|
|
gfxASurface::ImageFormatUnknown>
|
|
|
|
{};
|
2011-08-09 19:38:26 +00:00
|
|
|
|
2012-08-20 13:35:41 +00:00
|
|
|
template <>
|
|
|
|
struct ParamTraits<nsCSSProperty>
|
|
|
|
: public EnumSerializer<nsCSSProperty,
|
|
|
|
eCSSProperty_UNKNOWN,
|
|
|
|
eCSSProperty_COUNT>
|
|
|
|
{};
|
|
|
|
|
|
|
|
|
2010-06-21 20:35:48 +00:00
|
|
|
template<>
|
|
|
|
struct ParamTraits<gfxRGBA>
|
|
|
|
{
|
|
|
|
typedef gfxRGBA paramType;
|
|
|
|
|
|
|
|
static void Write(Message* msg, const paramType& param)
|
|
|
|
{
|
|
|
|
WriteParam(msg, param.r);
|
|
|
|
WriteParam(msg, param.g);
|
|
|
|
WriteParam(msg, param.b);
|
|
|
|
WriteParam(msg, param.a);
|
|
|
|
}
|
|
|
|
|
|
|
|
static bool Read(const Message* msg, void** iter, paramType* result)
|
|
|
|
{
|
|
|
|
return (ReadParam(msg, iter, &result->r) &&
|
|
|
|
ReadParam(msg, iter, &result->g) &&
|
|
|
|
ReadParam(msg, iter, &result->b) &&
|
|
|
|
ReadParam(msg, iter, &result->a));
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2010-05-22 19:35:40 +00:00
|
|
|
template<>
|
|
|
|
struct ParamTraits<mozilla::void_t>
|
|
|
|
{
|
|
|
|
typedef mozilla::void_t paramType;
|
|
|
|
static void Write(Message* aMsg, const paramType& aParam) { }
|
|
|
|
static bool
|
|
|
|
Read(const Message* aMsg, void** aIter, paramType* aResult)
|
|
|
|
{
|
|
|
|
*aResult = paramType();
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
template<>
|
|
|
|
struct ParamTraits<mozilla::null_t>
|
|
|
|
{
|
|
|
|
typedef mozilla::null_t paramType;
|
|
|
|
static void Write(Message* aMsg, const paramType& aParam) { }
|
|
|
|
static bool
|
|
|
|
Read(const Message* aMsg, void** aIter, paramType* aResult)
|
|
|
|
{
|
|
|
|
*aResult = paramType();
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2012-07-31 17:28:20 +00:00
|
|
|
template<>
|
|
|
|
struct ParamTraits<nsPoint>
|
|
|
|
{
|
|
|
|
typedef nsPoint paramType;
|
|
|
|
|
|
|
|
static void Write(Message* msg, const paramType& param)
|
|
|
|
{
|
|
|
|
WriteParam(msg, param.x);
|
|
|
|
WriteParam(msg, param.y);
|
|
|
|
}
|
|
|
|
|
|
|
|
static bool Read(const Message* msg, void** iter, paramType* result)
|
|
|
|
{
|
|
|
|
return (ReadParam(msg, iter, &result->x) &&
|
|
|
|
ReadParam(msg, iter, &result->y));
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2010-06-21 20:35:48 +00:00
|
|
|
template<>
|
|
|
|
struct ParamTraits<nsIntPoint>
|
|
|
|
{
|
|
|
|
typedef nsIntPoint paramType;
|
2012-07-31 17:28:20 +00:00
|
|
|
|
2010-06-21 20:35:48 +00:00
|
|
|
static void Write(Message* msg, const paramType& param)
|
|
|
|
{
|
|
|
|
WriteParam(msg, param.x);
|
|
|
|
WriteParam(msg, param.y);
|
|
|
|
}
|
|
|
|
|
|
|
|
static bool Read(const Message* msg, void** iter, paramType* result)
|
|
|
|
{
|
|
|
|
return (ReadParam(msg, iter, &result->x) &&
|
|
|
|
ReadParam(msg, iter, &result->y));
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
template<>
|
|
|
|
struct ParamTraits<nsIntRect>
|
|
|
|
{
|
|
|
|
typedef nsIntRect paramType;
|
2012-07-31 17:28:20 +00:00
|
|
|
|
2010-06-21 20:35:48 +00:00
|
|
|
static void Write(Message* msg, const paramType& param)
|
|
|
|
{
|
|
|
|
WriteParam(msg, param.x);
|
|
|
|
WriteParam(msg, param.y);
|
|
|
|
WriteParam(msg, param.width);
|
|
|
|
WriteParam(msg, param.height);
|
|
|
|
}
|
|
|
|
|
|
|
|
static bool Read(const Message* msg, void** iter, paramType* result)
|
|
|
|
{
|
|
|
|
return (ReadParam(msg, iter, &result->x) &&
|
|
|
|
ReadParam(msg, iter, &result->y) &&
|
|
|
|
ReadParam(msg, iter, &result->width) &&
|
|
|
|
ReadParam(msg, iter, &result->height));
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
template<>
|
|
|
|
struct ParamTraits<nsIntRegion>
|
|
|
|
{
|
|
|
|
typedef nsIntRegion paramType;
|
|
|
|
|
|
|
|
static void Write(Message* msg, const paramType& param)
|
|
|
|
{
|
|
|
|
nsIntRegionRectIterator it(param);
|
|
|
|
while (const nsIntRect* r = it.Next())
|
|
|
|
WriteParam(msg, *r);
|
|
|
|
// empty rects are sentinel values because nsRegions will never
|
|
|
|
// contain them
|
|
|
|
WriteParam(msg, nsIntRect());
|
|
|
|
}
|
|
|
|
|
|
|
|
static bool Read(const Message* msg, void** iter, paramType* result)
|
|
|
|
{
|
|
|
|
nsIntRect rect;
|
|
|
|
while (ReadParam(msg, iter, &rect)) {
|
|
|
|
if (rect.IsEmpty())
|
|
|
|
return true;
|
|
|
|
result->Or(*result, rect);
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
template<>
|
|
|
|
struct ParamTraits<nsIntSize>
|
|
|
|
{
|
|
|
|
typedef nsIntSize paramType;
|
2012-07-31 17:28:20 +00:00
|
|
|
|
2010-06-21 20:35:48 +00:00
|
|
|
static void Write(Message* msg, const paramType& param)
|
|
|
|
{
|
|
|
|
WriteParam(msg, param.width);
|
2012-07-31 17:28:20 +00:00
|
|
|
WriteParam(msg, param.height);
|
2010-06-21 20:35:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static bool Read(const Message* msg, void** iter, paramType* result)
|
|
|
|
{
|
|
|
|
return (ReadParam(msg, iter, &result->width) &&
|
|
|
|
ReadParam(msg, iter, &result->height));
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2013-06-21 21:03:56 +00:00
|
|
|
template<class T, class U>
|
|
|
|
struct ParamTraits< mozilla::gfx::ScaleFactor<T, U> >
|
|
|
|
{
|
|
|
|
typedef mozilla::gfx::ScaleFactor<T, U> paramType;
|
|
|
|
|
|
|
|
static void Write(Message* msg, const paramType& param)
|
|
|
|
{
|
|
|
|
WriteParam(msg, param.scale);
|
|
|
|
}
|
|
|
|
|
|
|
|
static bool Read(const Message* msg, void** iter, paramType* result)
|
|
|
|
{
|
|
|
|
return (ReadParam(msg, iter, &result->scale));
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2013-05-31 01:30:13 +00:00
|
|
|
template<class T>
|
|
|
|
struct ParamTraits< mozilla::gfx::PointTyped<T> >
|
2012-08-22 04:37:15 +00:00
|
|
|
{
|
2013-05-31 01:30:13 +00:00
|
|
|
typedef mozilla::gfx::PointTyped<T> paramType;
|
2012-08-22 04:37:15 +00:00
|
|
|
|
|
|
|
static void Write(Message* msg, const paramType& param)
|
|
|
|
{
|
|
|
|
WriteParam(msg, param.x);
|
|
|
|
WriteParam(msg, param.y);
|
|
|
|
}
|
|
|
|
|
|
|
|
static bool Read(const Message* msg, void** iter, paramType* result)
|
|
|
|
{
|
|
|
|
return (ReadParam(msg, iter, &result->x) &&
|
|
|
|
ReadParam(msg, iter, &result->y));
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2013-06-10 13:05:44 +00:00
|
|
|
template<class T>
|
|
|
|
struct ParamTraits< mozilla::gfx::IntPointTyped<T> >
|
|
|
|
{
|
|
|
|
typedef mozilla::gfx::IntPointTyped<T> paramType;
|
|
|
|
|
|
|
|
static void Write(Message* msg, const paramType& param)
|
|
|
|
{
|
|
|
|
WriteParam(msg, param.x);
|
|
|
|
WriteParam(msg, param.y);
|
|
|
|
}
|
|
|
|
|
|
|
|
static bool Read(const Message* msg, void** iter, paramType* result)
|
|
|
|
{
|
|
|
|
return (ReadParam(msg, iter, &result->x) &&
|
|
|
|
ReadParam(msg, iter, &result->y));
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2012-04-12 19:55:26 +00:00
|
|
|
template<>
|
|
|
|
struct ParamTraits<mozilla::gfx::Size>
|
|
|
|
{
|
|
|
|
typedef mozilla::gfx::Size paramType;
|
2012-07-31 17:28:20 +00:00
|
|
|
|
2012-04-12 19:55:26 +00:00
|
|
|
static void Write(Message* msg, const paramType& param)
|
|
|
|
{
|
|
|
|
WriteParam(msg, param.width);
|
2012-07-31 17:28:20 +00:00
|
|
|
WriteParam(msg, param.height);
|
2012-04-12 19:55:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static bool Read(const Message* msg, void** iter, paramType* result)
|
|
|
|
{
|
|
|
|
return (ReadParam(msg, iter, &result->width) &&
|
|
|
|
ReadParam(msg, iter, &result->height));
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2013-06-03 13:52:44 +00:00
|
|
|
template<class T>
|
|
|
|
struct ParamTraits< mozilla::gfx::RectTyped<T> >
|
|
|
|
{
|
|
|
|
typedef mozilla::gfx::RectTyped<T> paramType;
|
|
|
|
|
|
|
|
static void Write(Message* msg, const paramType& param)
|
|
|
|
{
|
|
|
|
WriteParam(msg, param.x);
|
|
|
|
WriteParam(msg, param.y);
|
|
|
|
WriteParam(msg, param.width);
|
|
|
|
WriteParam(msg, param.height);
|
|
|
|
}
|
|
|
|
|
|
|
|
static bool Read(const Message* msg, void** iter, paramType* result)
|
|
|
|
{
|
|
|
|
return (ReadParam(msg, iter, &result->x) &&
|
|
|
|
ReadParam(msg, iter, &result->y) &&
|
|
|
|
ReadParam(msg, iter, &result->width) &&
|
|
|
|
ReadParam(msg, iter, &result->height));
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
template<class T>
|
|
|
|
struct ParamTraits< mozilla::gfx::IntRectTyped<T> >
|
2012-05-23 14:51:39 +00:00
|
|
|
{
|
2013-06-03 13:52:44 +00:00
|
|
|
typedef mozilla::gfx::IntRectTyped<T> paramType;
|
2012-05-23 14:51:39 +00:00
|
|
|
|
|
|
|
static void Write(Message* msg, const paramType& param)
|
|
|
|
{
|
|
|
|
WriteParam(msg, param.x);
|
|
|
|
WriteParam(msg, param.y);
|
|
|
|
WriteParam(msg, param.width);
|
|
|
|
WriteParam(msg, param.height);
|
|
|
|
}
|
|
|
|
|
|
|
|
static bool Read(const Message* msg, void** iter, paramType* result)
|
|
|
|
{
|
|
|
|
return (ReadParam(msg, iter, &result->x) &&
|
|
|
|
ReadParam(msg, iter, &result->y) &&
|
|
|
|
ReadParam(msg, iter, &result->width) &&
|
|
|
|
ReadParam(msg, iter, &result->height));
|
|
|
|
}
|
|
|
|
};
|
2012-04-12 19:55:26 +00:00
|
|
|
|
2013-03-07 10:17:33 +00:00
|
|
|
template<>
|
|
|
|
struct ParamTraits<mozilla::gfx::Margin>
|
|
|
|
{
|
|
|
|
typedef mozilla::gfx::Margin paramType;
|
|
|
|
|
|
|
|
static void Write(Message* msg, const paramType& param)
|
|
|
|
{
|
|
|
|
WriteParam(msg, param.top);
|
|
|
|
WriteParam(msg, param.right);
|
|
|
|
WriteParam(msg, param.bottom);
|
|
|
|
WriteParam(msg, param.left);
|
|
|
|
}
|
|
|
|
|
|
|
|
static bool Read(const Message* msg, void** iter, paramType* result)
|
|
|
|
{
|
|
|
|
return (ReadParam(msg, iter, &result->top) &&
|
|
|
|
ReadParam(msg, iter, &result->right) &&
|
|
|
|
ReadParam(msg, iter, &result->bottom) &&
|
|
|
|
ReadParam(msg, iter, &result->left));
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2010-10-26 22:20:53 +00:00
|
|
|
template<>
|
|
|
|
struct ParamTraits<nsRect>
|
|
|
|
{
|
|
|
|
typedef nsRect paramType;
|
2012-07-31 17:28:20 +00:00
|
|
|
|
2010-10-26 22:20:53 +00:00
|
|
|
static void Write(Message* msg, const paramType& param)
|
|
|
|
{
|
|
|
|
WriteParam(msg, param.x);
|
|
|
|
WriteParam(msg, param.y);
|
|
|
|
WriteParam(msg, param.width);
|
|
|
|
WriteParam(msg, param.height);
|
|
|
|
}
|
|
|
|
|
|
|
|
static bool Read(const Message* msg, void** iter, paramType* result)
|
|
|
|
{
|
|
|
|
return (ReadParam(msg, iter, &result->x) &&
|
|
|
|
ReadParam(msg, iter, &result->y) &&
|
|
|
|
ReadParam(msg, iter, &result->width) &&
|
|
|
|
ReadParam(msg, iter, &result->height));
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2011-06-24 14:19:56 +00:00
|
|
|
template<>
|
|
|
|
struct ParamTraits<nsID>
|
|
|
|
{
|
|
|
|
typedef nsID paramType;
|
|
|
|
|
|
|
|
static void Write(Message* aMsg, const paramType& aParam)
|
|
|
|
{
|
|
|
|
WriteParam(aMsg, aParam.m0);
|
|
|
|
WriteParam(aMsg, aParam.m1);
|
|
|
|
WriteParam(aMsg, aParam.m2);
|
2011-10-11 05:50:08 +00:00
|
|
|
for (unsigned int i = 0; i < mozilla::ArrayLength(aParam.m3); i++) {
|
2011-06-24 14:19:56 +00:00
|
|
|
WriteParam(aMsg, aParam.m3[i]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static bool Read(const Message* aMsg, void** aIter, paramType* aResult)
|
|
|
|
{
|
|
|
|
if(!ReadParam(aMsg, aIter, &(aResult->m0)) ||
|
|
|
|
!ReadParam(aMsg, aIter, &(aResult->m1)) ||
|
|
|
|
!ReadParam(aMsg, aIter, &(aResult->m2)))
|
|
|
|
return false;
|
|
|
|
|
2011-10-11 05:50:08 +00:00
|
|
|
for (unsigned int i = 0; i < mozilla::ArrayLength(aResult->m3); i++)
|
2011-06-24 14:19:56 +00:00
|
|
|
if (!ReadParam(aMsg, aIter, &(aResult->m3[i])))
|
|
|
|
return false;
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void Log(const paramType& aParam, std::wstring* aLog)
|
|
|
|
{
|
|
|
|
aLog->append(L"{");
|
|
|
|
aLog->append(StringPrintf(L"%8.8X-%4.4X-%4.4X-",
|
|
|
|
aParam.m0,
|
|
|
|
aParam.m1,
|
|
|
|
aParam.m2));
|
2011-10-11 05:50:08 +00:00
|
|
|
for (unsigned int i = 0; i < mozilla::ArrayLength(aParam.m3); i++)
|
2011-06-24 14:19:56 +00:00
|
|
|
aLog->append(StringPrintf(L"%2.2X", aParam.m3[i]));
|
|
|
|
aLog->append(L"}");
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2012-07-31 17:28:20 +00:00
|
|
|
template<>
|
|
|
|
struct ParamTraits<mozilla::TimeDuration>
|
|
|
|
{
|
|
|
|
typedef mozilla::TimeDuration paramType;
|
|
|
|
static void Write(Message* aMsg, const paramType& aParam)
|
|
|
|
{
|
|
|
|
WriteParam(aMsg, aParam.mValue);
|
|
|
|
}
|
|
|
|
static bool Read(const Message* aMsg, void** aIter, paramType* aResult)
|
|
|
|
{
|
|
|
|
return ReadParam(aMsg, aIter, &aResult->mValue);
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
template<>
|
|
|
|
struct ParamTraits<mozilla::TimeStamp>
|
|
|
|
{
|
|
|
|
typedef mozilla::TimeStamp paramType;
|
|
|
|
static void Write(Message* aMsg, const paramType& aParam)
|
|
|
|
{
|
|
|
|
WriteParam(aMsg, aParam.mValue);
|
|
|
|
}
|
|
|
|
static bool Read(const Message* aMsg, void** aIter, paramType* aResult)
|
|
|
|
{
|
|
|
|
return ReadParam(aMsg, aIter, &aResult->mValue);
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2013-02-11 21:56:58 +00:00
|
|
|
#ifdef XP_WIN
|
|
|
|
|
|
|
|
template<>
|
|
|
|
struct ParamTraits<mozilla::TimeStampValue>
|
|
|
|
{
|
|
|
|
typedef mozilla::TimeStampValue paramType;
|
|
|
|
static void Write(Message* aMsg, const paramType& aParam)
|
|
|
|
{
|
|
|
|
WriteParam(aMsg, aParam.mGTC);
|
|
|
|
WriteParam(aMsg, aParam.mQPC);
|
|
|
|
WriteParam(aMsg, aParam.mHasQPC);
|
|
|
|
WriteParam(aMsg, aParam.mIsNull);
|
|
|
|
}
|
|
|
|
static bool Read(const Message* aMsg, void** aIter, paramType* aResult)
|
|
|
|
{
|
|
|
|
return (ReadParam(aMsg, aIter, &aResult->mGTC) &&
|
|
|
|
ReadParam(aMsg, aIter, &aResult->mQPC) &&
|
|
|
|
ReadParam(aMsg, aIter, &aResult->mHasQPC) &&
|
|
|
|
ReadParam(aMsg, aIter, &aResult->mIsNull));
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
2012-08-02 06:02:29 +00:00
|
|
|
template <>
|
|
|
|
struct ParamTraits<mozilla::SerializedStructuredCloneBuffer>
|
|
|
|
{
|
|
|
|
typedef mozilla::SerializedStructuredCloneBuffer paramType;
|
|
|
|
|
|
|
|
static void Write(Message* aMsg, const paramType& aParam)
|
|
|
|
{
|
|
|
|
WriteParam(aMsg, aParam.dataLength);
|
|
|
|
if (aParam.dataLength) {
|
|
|
|
// Structured clone data must be 64-bit aligned.
|
|
|
|
aMsg->WriteBytes(aParam.data, aParam.dataLength, sizeof(uint64_t));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static bool Read(const Message* aMsg, void** aIter, paramType* aResult)
|
|
|
|
{
|
|
|
|
if (!ReadParam(aMsg, aIter, &aResult->dataLength)) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (aResult->dataLength) {
|
|
|
|
const char** buffer =
|
|
|
|
const_cast<const char**>(reinterpret_cast<char**>(&aResult->data));
|
|
|
|
// Structured clone data must be 64-bit aligned.
|
|
|
|
if (!aMsg->ReadBytes(aIter, buffer, aResult->dataLength,
|
|
|
|
sizeof(uint64_t))) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
aResult->data = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void Log(const paramType& aParam, std::wstring* aLog)
|
|
|
|
{
|
|
|
|
LogParam(aParam.dataLength, aLog);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2012-08-09 04:39:02 +00:00
|
|
|
template <>
|
|
|
|
struct ParamTraits<mozilla::layers::FrameMetrics>
|
|
|
|
{
|
|
|
|
typedef mozilla::layers::FrameMetrics paramType;
|
|
|
|
|
|
|
|
static void Write(Message* aMsg, const paramType& aParam)
|
|
|
|
{
|
2012-09-29 02:16:34 +00:00
|
|
|
WriteParam(aMsg, aParam.mScrollableRect);
|
2012-08-09 04:39:02 +00:00
|
|
|
WriteParam(aMsg, aParam.mViewport);
|
2012-09-29 02:16:34 +00:00
|
|
|
WriteParam(aMsg, aParam.mScrollOffset);
|
2012-08-09 04:39:02 +00:00
|
|
|
WriteParam(aMsg, aParam.mDisplayPort);
|
2012-11-21 22:34:18 +00:00
|
|
|
WriteParam(aMsg, aParam.mCriticalDisplayPort);
|
2012-09-29 02:16:34 +00:00
|
|
|
WriteParam(aMsg, aParam.mCompositionBounds);
|
2012-08-09 04:39:02 +00:00
|
|
|
WriteParam(aMsg, aParam.mScrollId);
|
|
|
|
WriteParam(aMsg, aParam.mResolution);
|
2012-09-29 02:16:38 +00:00
|
|
|
WriteParam(aMsg, aParam.mZoom);
|
2012-09-29 02:16:34 +00:00
|
|
|
WriteParam(aMsg, aParam.mDevPixelsPerCSSPixel);
|
2012-08-22 04:37:06 +00:00
|
|
|
WriteParam(aMsg, aParam.mMayHaveTouchListeners);
|
2013-05-24 01:43:36 +00:00
|
|
|
WriteParam(aMsg, aParam.mPresShellId);
|
2012-08-09 04:39:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static bool Read(const Message* aMsg, void** aIter, paramType* aResult)
|
|
|
|
{
|
2012-09-29 02:16:34 +00:00
|
|
|
return (ReadParam(aMsg, aIter, &aResult->mScrollableRect) &&
|
2012-08-09 04:39:02 +00:00
|
|
|
ReadParam(aMsg, aIter, &aResult->mViewport) &&
|
2012-09-29 02:16:34 +00:00
|
|
|
ReadParam(aMsg, aIter, &aResult->mScrollOffset) &&
|
2012-08-09 04:39:02 +00:00
|
|
|
ReadParam(aMsg, aIter, &aResult->mDisplayPort) &&
|
2012-11-21 22:34:18 +00:00
|
|
|
ReadParam(aMsg, aIter, &aResult->mCriticalDisplayPort) &&
|
2012-09-29 02:16:34 +00:00
|
|
|
ReadParam(aMsg, aIter, &aResult->mCompositionBounds) &&
|
2012-08-09 04:39:02 +00:00
|
|
|
ReadParam(aMsg, aIter, &aResult->mScrollId) &&
|
2012-08-22 04:37:06 +00:00
|
|
|
ReadParam(aMsg, aIter, &aResult->mResolution) &&
|
2012-09-29 02:16:38 +00:00
|
|
|
ReadParam(aMsg, aIter, &aResult->mZoom) &&
|
2012-09-29 02:16:34 +00:00
|
|
|
ReadParam(aMsg, aIter, &aResult->mDevPixelsPerCSSPixel) &&
|
2013-05-24 01:43:36 +00:00
|
|
|
ReadParam(aMsg, aIter, &aResult->mMayHaveTouchListeners) &&
|
|
|
|
ReadParam(aMsg, aIter, &aResult->mPresShellId));
|
2012-08-09 04:39:02 +00:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
Bug 825928: Land layers refactoring. r=jrmuizel,bas,nical,mattwoodrow,roc,nrc,benwa,bjacob,jgilbert,kchen CLOSED TREE
Please contact Bas Schouten <bschouten@mozilla.com>, Nicolas Silva <nsilva@mozilla.com> or Nicholas Cameron <ncameron@mozilla.com> with general questions. Below is a rough list of authors to contact with specific questions.
Authors:
gfx/layers/Compositor.* gfx/layers/Effects.h - Compositor Interface - bas,nrc,nical
gfx/layers/d3d* - D3D9/D3D10 - bas
gfx/layers/ThebesLayer* - ThebesLayers - nrc,bas
gfx/layers/composite/* - CompositeLayers - nrc,nical
gfx/layers/client/* - Client - nrc,nical,bas
gfx/layers/*Image* - nical
gfx/layers/ipc ipc - IPC - nical
gfx/layers/opengl - CompositorOGL - nrc,nical
gfx/2d - bas,nrc
gfx/gl - GLContext - bjacob
dom/* layout/* - DOM - mattwoodrow
2013-04-10 09:20:52 +00:00
|
|
|
template<>
|
|
|
|
struct ParamTraits<mozilla::layers::TextureFactoryIdentifier>
|
|
|
|
{
|
|
|
|
typedef mozilla::layers::TextureFactoryIdentifier paramType;
|
|
|
|
|
|
|
|
static void Write(Message* aMsg, const paramType& aParam)
|
|
|
|
{
|
|
|
|
WriteParam(aMsg, aParam.mParentBackend);
|
|
|
|
WriteParam(aMsg, aParam.mMaxTextureSize);
|
2013-05-16 03:45:43 +00:00
|
|
|
WriteParam(aMsg, aParam.mSupportsTextureBlitting);
|
|
|
|
WriteParam(aMsg, aParam.mSupportsPartialUploads);
|
Bug 825928: Land layers refactoring. r=jrmuizel,bas,nical,mattwoodrow,roc,nrc,benwa,bjacob,jgilbert,kchen CLOSED TREE
Please contact Bas Schouten <bschouten@mozilla.com>, Nicolas Silva <nsilva@mozilla.com> or Nicholas Cameron <ncameron@mozilla.com> with general questions. Below is a rough list of authors to contact with specific questions.
Authors:
gfx/layers/Compositor.* gfx/layers/Effects.h - Compositor Interface - bas,nrc,nical
gfx/layers/d3d* - D3D9/D3D10 - bas
gfx/layers/ThebesLayer* - ThebesLayers - nrc,bas
gfx/layers/composite/* - CompositeLayers - nrc,nical
gfx/layers/client/* - Client - nrc,nical,bas
gfx/layers/*Image* - nical
gfx/layers/ipc ipc - IPC - nical
gfx/layers/opengl - CompositorOGL - nrc,nical
gfx/2d - bas,nrc
gfx/gl - GLContext - bjacob
dom/* layout/* - DOM - mattwoodrow
2013-04-10 09:20:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static bool Read(const Message* aMsg, void** aIter, paramType* aResult)
|
|
|
|
{
|
|
|
|
return ReadParam(aMsg, aIter, &aResult->mParentBackend) &&
|
2013-05-16 03:45:43 +00:00
|
|
|
ReadParam(aMsg, aIter, &aResult->mMaxTextureSize) &&
|
|
|
|
ReadParam(aMsg, aIter, &aResult->mSupportsTextureBlitting) &&
|
|
|
|
ReadParam(aMsg, aIter, &aResult->mSupportsPartialUploads);
|
Bug 825928: Land layers refactoring. r=jrmuizel,bas,nical,mattwoodrow,roc,nrc,benwa,bjacob,jgilbert,kchen CLOSED TREE
Please contact Bas Schouten <bschouten@mozilla.com>, Nicolas Silva <nsilva@mozilla.com> or Nicholas Cameron <ncameron@mozilla.com> with general questions. Below is a rough list of authors to contact with specific questions.
Authors:
gfx/layers/Compositor.* gfx/layers/Effects.h - Compositor Interface - bas,nrc,nical
gfx/layers/d3d* - D3D9/D3D10 - bas
gfx/layers/ThebesLayer* - ThebesLayers - nrc,bas
gfx/layers/composite/* - CompositeLayers - nrc,nical
gfx/layers/client/* - Client - nrc,nical,bas
gfx/layers/*Image* - nical
gfx/layers/ipc ipc - IPC - nical
gfx/layers/opengl - CompositorOGL - nrc,nical
gfx/2d - bas,nrc
gfx/gl - GLContext - bjacob
dom/* layout/* - DOM - mattwoodrow
2013-04-10 09:20:52 +00:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
template<>
|
|
|
|
struct ParamTraits<mozilla::layers::TextureInfo>
|
|
|
|
{
|
|
|
|
typedef mozilla::layers::TextureInfo paramType;
|
|
|
|
|
|
|
|
static void Write(Message* aMsg, const paramType& aParam)
|
|
|
|
{
|
|
|
|
WriteParam(aMsg, aParam.mCompositableType);
|
|
|
|
WriteParam(aMsg, aParam.mTextureHostFlags);
|
|
|
|
WriteParam(aMsg, aParam.mTextureFlags);
|
|
|
|
}
|
|
|
|
|
|
|
|
static bool Read(const Message* aMsg, void** aIter, paramType* aResult)
|
|
|
|
{
|
|
|
|
return ReadParam(aMsg, aIter, &aResult->mCompositableType) &&
|
|
|
|
ReadParam(aMsg, aIter, &aResult->mTextureHostFlags) &&
|
|
|
|
ReadParam(aMsg, aIter, &aResult->mTextureFlags);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
template <>
|
|
|
|
struct ParamTraits<mozilla::layers::CompositableType>
|
|
|
|
: public EnumSerializer<mozilla::layers::CompositableType,
|
|
|
|
mozilla::layers::BUFFER_UNKNOWN,
|
|
|
|
mozilla::layers::BUFFER_COUNT>
|
|
|
|
{};
|
|
|
|
|
2009-06-29 18:38:29 +00:00
|
|
|
} /* namespace IPC */
|
|
|
|
|
|
|
|
#endif /* __IPC_GLUE_IPCMESSAGEUTILS_H__ */
|