summaryrefslogtreecommitdiff
path: root/Source/WebKit2/WebProcess/WebPage/DecoderAdapter.cpp
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@digia.com>2012-10-18 10:55:06 +0200
committerSimon Hausmann <simon.hausmann@digia.com>2012-10-18 10:55:06 +0200
commitee4c86d1990a9e26277a6948e7027ad8d525ebfa (patch)
tree1e2d3408cd097606571f40ab63353c27bcb7dd5c /Source/WebKit2/WebProcess/WebPage/DecoderAdapter.cpp
parentd882bec96d0d30aeeda2141bfadfca7f038ee862 (diff)
downloadqtwebkit-ee4c86d1990a9e26277a6948e7027ad8d525ebfa.tar.gz
Imported WebKit commit 795dcd25a9649fccaf1c9b685f6e2ffedaf7e620 (http://svn.webkit.org/repository/webkit/trunk@131718)
New snapshot that includes the return of -fkeep-memory at link time to reduce memory pressure as well as modularized documentation
Diffstat (limited to 'Source/WebKit2/WebProcess/WebPage/DecoderAdapter.cpp')
-rw-r--r--Source/WebKit2/WebProcess/WebPage/DecoderAdapter.cpp37
1 files changed, 21 insertions, 16 deletions
diff --git a/Source/WebKit2/WebProcess/WebPage/DecoderAdapter.cpp b/Source/WebKit2/WebProcess/WebPage/DecoderAdapter.cpp
index 763305cbe..63417720c 100644
--- a/Source/WebKit2/WebProcess/WebPage/DecoderAdapter.cpp
+++ b/Source/WebKit2/WebProcess/WebPage/DecoderAdapter.cpp
@@ -33,14 +33,19 @@
namespace WebKit {
DecoderAdapter::DecoderAdapter(const uint8_t* buffer, size_t bufferSize)
- : m_decoder(buffer, bufferSize)
+ : m_decoder(CoreIPC::ArgumentDecoder::create(buffer, bufferSize))
{
+ // Keep format compatibility by decoding an unused uint64_t value
+ // that used to be encoded by the argument encoder.
+ uint64_t value;
+ m_decoder->decode(value);
+ ASSERT(!value);
}
bool DecoderAdapter::decodeBytes(Vector<uint8_t>& bytes)
{
CoreIPC::DataReference dataReference;
- if (!m_decoder.decodeVariableLengthByteArray(dataReference))
+ if (!m_decoder->decodeVariableLengthByteArray(dataReference))
return false;
bytes = dataReference.vector();
@@ -49,42 +54,42 @@ bool DecoderAdapter::decodeBytes(Vector<uint8_t>& bytes)
bool DecoderAdapter::decodeBool(bool& value)
{
- return m_decoder.decodeBool(value);
+ return m_decoder->decodeBool(value);
}
bool DecoderAdapter::decodeUInt16(uint16_t& value)
{
- return m_decoder.decodeUInt16(value);
+ return m_decoder->decodeUInt16(value);
}
bool DecoderAdapter::decodeUInt32(uint32_t& value)
{
- return m_decoder.decodeUInt32(value);
+ return m_decoder->decodeUInt32(value);
}
bool DecoderAdapter::decodeUInt64(uint64_t& value)
{
- return m_decoder.decodeUInt64(value);
+ return m_decoder->decodeUInt64(value);
}
bool DecoderAdapter::decodeInt32(int32_t& value)
{
- return m_decoder.decodeInt32(value);
+ return m_decoder->decodeInt32(value);
}
bool DecoderAdapter::decodeInt64(int64_t& value)
{
- return m_decoder.decodeInt64(value);
+ return m_decoder->decodeInt64(value);
}
bool DecoderAdapter::decodeFloat(float& value)
{
- return m_decoder.decodeFloat(value);
+ return m_decoder->decodeFloat(value);
}
bool DecoderAdapter::decodeDouble(double& value)
{
- return m_decoder.decodeDouble(value);
+ return m_decoder->decodeDouble(value);
}
bool DecoderAdapter::decodeString(String& value)
@@ -96,7 +101,7 @@ bool DecoderAdapter::decodeString(String& value)
// without breaking encoding/decoding of the history tree.
uint32_t length;
- if (!m_decoder.decode(length))
+ if (!m_decoder->decode(length))
return false;
if (length == std::numeric_limits<uint32_t>::max()) {
@@ -106,22 +111,22 @@ bool DecoderAdapter::decodeString(String& value)
}
uint64_t lengthInBytes;
- if (!m_decoder.decode(lengthInBytes))
+ if (!m_decoder->decode(lengthInBytes))
return false;
if (lengthInBytes % sizeof(UChar) || lengthInBytes / sizeof(UChar) != length) {
- m_decoder.markInvalid();
+ m_decoder->markInvalid();
return false;
}
- if (!m_decoder.bufferIsLargeEnoughToContain<UChar>(length)) {
- m_decoder.markInvalid();
+ if (!m_decoder->bufferIsLargeEnoughToContain<UChar>(length)) {
+ m_decoder->markInvalid();
return false;
}
UChar* buffer;
String string = String::createUninitialized(length, buffer);
- if (!m_decoder.decodeFixedLengthData(reinterpret_cast<uint8_t*>(buffer), length * sizeof(UChar), __alignof(UChar)))
+ if (!m_decoder->decodeFixedLengthData(reinterpret_cast<uint8_t*>(buffer), length * sizeof(UChar), __alignof(UChar)))
return false;
value = string;