Commit a5d01157 authored by alice.liu@apple.com's avatar alice.liu@apple.com

Support encoding /decoding WebData in usermessages

https://bugs.webkit.org/show_bug.cgi?id=56158

Reviewed by Sam Weinig.

Added encoding/decoding for APIObject::TypeData
* Shared/UserMessageCoders.h:
(WebKit::UserMessageEncoder::baseEncode):
(WebKit::UserMessageDecoder::baseDecode):



git-svn-id: svn://svn.chromium.org/blink/trunk@80921 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent 20eb50ca
2011-03-11 Alice Liu <alice.liu@apple.com>
Reviewed by Sam Weinig.
Support encoding /decoding WebData in usermessages
https://bugs.webkit.org/show_bug.cgi?id=56158
Added encoding/decoding for APIObject::TypeData
* Shared/UserMessageCoders.h:
(WebKit::UserMessageEncoder::baseEncode):
(WebKit::UserMessageDecoder::baseDecode):
2011-03-11 Alice Liu <alice.liu@apple.com>
Reviewed by Sam Weinig.
......
......@@ -32,6 +32,7 @@
#include "ImmutableDictionary.h"
#include "ShareableBitmap.h"
#include "WebCoreArgumentCoders.h"
#include "WebData.h"
#include "WebImage.h"
#include "WebNumber.h"
#include "WebSerializedScriptValue.h"
......@@ -47,6 +48,7 @@ namespace WebKit {
// - SerializedScriptValue -> SerializedScriptValue
// - String -> String
// - UserContentURLPattern -> UserContentURLPattern
// - WebData -> WebData
// - WebDouble -> WebDouble
// - WebImage -> WebImage
// - WebUInt64 -> WebUInt64
......@@ -138,6 +140,11 @@ public:
encoder->encode(handle);
return true;
}
case APIObject::TypeData: {
WebData* data = static_cast<WebData*>(m_root);
encoder->encodeBytes(data->bytes(), data->size());
return true;
}
default:
break;
}
......@@ -162,6 +169,7 @@ protected:
// - SerializedScriptValue -> SerializedScriptValue
// - String -> String
// - UserContentURLPattern -> UserContentURLPattern
// - WebData -> WebData
// - WebDouble -> WebDouble
// - WebImage -> WebImage
// - WebUInt64 -> WebUInt64
......@@ -288,6 +296,14 @@ public:
coder.m_root = WebImage::create(ShareableBitmap::create(size, handle));
return true;
}
case APIObject::TypeData: {
Vector<uint8_t> buffer;
if (!decoder->decodeBytes(buffer))
return false;
coder.m_root = WebData::create(buffer);
break;
}
default:
break;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment