2018-11-29 23:49:10 +03:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
|
|
|
/* 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/. */
|
|
|
|
|
|
|
|
#ifndef mozilla_dom_localstorage_SerializationHelpers_h
|
|
|
|
#define mozilla_dom_localstorage_SerializationHelpers_h
|
|
|
|
|
|
|
|
#include "ipc/IPCMessageUtils.h"
|
|
|
|
|
|
|
|
#include "mozilla/dom/LSSnapshot.h"
|
2019-04-29 07:05:56 +03:00
|
|
|
#include "mozilla/dom/LSValue.h"
|
2018-11-29 23:49:10 +03:00
|
|
|
|
|
|
|
namespace IPC {
|
|
|
|
|
|
|
|
template <>
|
|
|
|
struct ParamTraits<mozilla::dom::LSSnapshot::LoadState>
|
|
|
|
: public ContiguousEnumSerializer<
|
|
|
|
mozilla::dom::LSSnapshot::LoadState,
|
|
|
|
mozilla::dom::LSSnapshot::LoadState::Initial,
|
|
|
|
mozilla::dom::LSSnapshot::LoadState::EndGuard> {};
|
|
|
|
|
2019-04-29 07:05:56 +03:00
|
|
|
template <>
|
|
|
|
struct ParamTraits<mozilla::dom::LSValue> {
|
|
|
|
typedef mozilla::dom::LSValue paramType;
|
|
|
|
|
|
|
|
static void Write(Message* aMsg, const paramType& aParam) {
|
|
|
|
WriteParam(aMsg, aParam.mBuffer);
|
2019-04-29 07:09:42 +03:00
|
|
|
WriteParam(aMsg, aParam.mUTF16Length);
|
2019-04-29 07:10:42 +03:00
|
|
|
WriteParam(aMsg, aParam.mCompressed);
|
2019-04-29 07:05:56 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
static bool Read(const Message* aMsg, PickleIterator* aIter,
|
|
|
|
paramType* aResult) {
|
2019-04-29 07:09:42 +03:00
|
|
|
return ReadParam(aMsg, aIter, &aResult->mBuffer) &&
|
2019-04-29 07:10:42 +03:00
|
|
|
ReadParam(aMsg, aIter, &aResult->mUTF16Length) &&
|
|
|
|
ReadParam(aMsg, aIter, &aResult->mCompressed);
|
2019-04-29 07:05:56 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
static void Log(const paramType& aParam, std::wstring* aLog) {
|
|
|
|
LogParam(aParam.mBuffer, aLog);
|
2019-04-29 07:09:42 +03:00
|
|
|
LogParam(aParam.mUTF16Length, aLog);
|
2019-04-29 07:10:42 +03:00
|
|
|
LogParam(aParam.mCompressed, aLog);
|
2019-04-29 07:05:56 +03:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2018-11-29 23:49:10 +03:00
|
|
|
} // namespace IPC
|
|
|
|
|
|
|
|
#endif // mozilla_dom_localstorage_SerializationHelpers_h
|