SecItemRequestData.cpp [plain text]
#include "config.h"
#include "SecItemRequestData.h"
#include "ArgumentCoders.h"
#include "ArgumentCodersCF.h"
namespace WebKit {
SecItemRequestData::SecItemRequestData()
: m_type(Invalid)
{
}
SecItemRequestData::SecItemRequestData(Type type, CFDictionaryRef query)
: m_type(type)
, m_queryDictionary(query)
{
}
SecItemRequestData::SecItemRequestData(Type type, CFDictionaryRef query, CFDictionaryRef attributesToMatch)
: m_type(type)
, m_queryDictionary(query)
, m_attributesToMatch(attributesToMatch)
{
}
void SecItemRequestData::encode(IPC::ArgumentEncoder& encoder) const
{
encoder.encodeEnum(m_type);
encoder << static_cast<bool>(m_queryDictionary);
if (m_queryDictionary)
IPC::encode(encoder, m_queryDictionary.get());
encoder << static_cast<bool>(m_attributesToMatch);
if (m_attributesToMatch)
IPC::encode(encoder, m_attributesToMatch.get());
}
bool SecItemRequestData::decode(IPC::ArgumentDecoder& decoder, SecItemRequestData& secItemRequestData)
{
if (!decoder.decodeEnum(secItemRequestData.m_type))
return false;
bool expectQuery;
if (!decoder.decode(expectQuery))
return false;
if (expectQuery && !IPC::decode(decoder, secItemRequestData.m_queryDictionary))
return false;
bool expectAttributes;
if (!decoder.decode(expectAttributes))
return false;
if (expectAttributes && !IPC::decode(decoder, secItemRequestData.m_attributesToMatch))
return false;
return true;
}
}