[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc
andersca at apple.com
andersca at apple.com
Wed Dec 22 15:21:21 UTC 2010
The following commit has been merged in the debian/experimental branch:
commit 734aad70dd8978b8f91c4b91e78760dc596c2a18
Author: andersca at apple.com <andersca at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Mon Nov 1 23:12:55 2010 +0000
Add ArgumentCoder specialization for WTF::CString
https://bugs.webkit.org/show_bug.cgi?id=48796
Reviewed by Sam Weinig.
* Platform/CoreIPC/ArgumentCoders.h:
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@71069 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebKit2/ChangeLog b/WebKit2/ChangeLog
index 114bb2d..3f704a3 100644
--- a/WebKit2/ChangeLog
+++ b/WebKit2/ChangeLog
@@ -1,5 +1,14 @@
2010-11-01 Anders Carlsson <andersca at apple.com>
+ Reviewed by Sam Weinig.
+
+ Add ArgumentCoder specialization for WTF::CString
+ https://bugs.webkit.org/show_bug.cgi?id=48796
+
+ * Platform/CoreIPC/ArgumentCoders.h:
+
+2010-11-01 Anders Carlsson <andersca at apple.com>
+
Fix build.
* WebKit2.xcodeproj/project.pbxproj:
diff --git a/WebKit2/Platform/CoreIPC/ArgumentCoders.h b/WebKit2/Platform/CoreIPC/ArgumentCoders.h
index 2065988..1cc1a7d 100644
--- a/WebKit2/Platform/CoreIPC/ArgumentCoders.h
+++ b/WebKit2/Platform/CoreIPC/ArgumentCoders.h
@@ -33,6 +33,7 @@
#include <wtf/TypeTraits.h>
#include <wtf/Vector.h>
#include <wtf/text/AtomicString.h>
+#include <wtf/text/CString.h>
#include <wtf/text/WTFString.h>
namespace CoreIPC {
@@ -194,6 +195,48 @@ template<typename KeyArg, typename MappedArg, typename HashArg, typename KeyTrai
}
};
+template<> struct ArgumentCoder<CString> {
+ static void encode(ArgumentEncoder* encoder, const CString& string)
+ {
+ // Special case the null string.
+ if (string.isNull()) {
+ encoder->encodeUInt32(std::numeric_limits<uint32_t>::max());
+ return;
+ }
+
+ uint32_t length = string.length();
+ encoder->encode(length);
+ encoder->encodeBytes(reinterpret_cast<const uint8_t*>(string.data()), length);
+ }
+
+ static bool decode(ArgumentDecoder* decoder, CString& result)
+ {
+ uint32_t length;
+ if (!decoder->decode(length))
+ return false;
+
+ if (length == std::numeric_limits<uint32_t>::max()) {
+ // This is the null string.
+ result = CString();
+ return true;
+ }
+
+ // Before allocating the string, make sure that the decoder buffer is big enough.
+ if (!decoder->bufferIsLargeEnoughToContain<char>(length)) {
+ decoder->markInvalid();
+ return false;
+ }
+
+ char* buffer;
+ CString string = CString::newUninitialized(length, buffer);
+ if (!decoder->decodeBytes(reinterpret_cast<uint8_t*>(buffer), length))
+ return false;
+
+ result = string;
+ return true;
+ }
+};
+
template<> struct ArgumentCoder<String> {
static void encode(ArgumentEncoder* encoder, const String& string)
{
@@ -208,7 +251,7 @@ template<> struct ArgumentCoder<String> {
encoder->encodeBytes(reinterpret_cast<const uint8_t*>(string.characters()), length * sizeof(UChar));
}
- static bool decode(ArgumentDecoder* decoder, String& s)
+ static bool decode(ArgumentDecoder* decoder, String& result)
{
uint32_t length;
if (!decoder->decode(length))
@@ -216,7 +259,7 @@ template<> struct ArgumentCoder<String> {
if (length == std::numeric_limits<uint32_t>::max()) {
// This is the null string.
- s = String();
+ result = String();
return true;
}
@@ -231,7 +274,7 @@ template<> struct ArgumentCoder<String> {
if (!decoder->decodeBytes(reinterpret_cast<uint8_t*>(buffer), length * sizeof(UChar)))
return false;
- s = string;
+ result = string;
return true;
}
};
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list