[webkit-dev] SerializedScriptValue: signed vs unsigned char
Alec Flett
alecflett at chromium.org
Mon Feb 4 16:54:07 PST 2013
Well, nobody is explicitly using LChar with SerializedScriptValue (maybe it
should, maybe that's another issue) but I guess this is why I'm asking -
I'm happy to just deal with this in IDB with some ugly reinterpret_casts
here and there (ok maybe not happy, but satisfied enough) if folks prefer
that. I don't personally find uint8_t to be any more intuitive than char,
but it sounds like some do. Nevermind...
(In my own experience I've always found explicit "unsigned" to be more of a
hassle then a tool for good type safely, and I suspect that's why LevelDB
uses it as its lowest-common-denominator, but we don't have to have that
debate here :))
Alec
On Mon, Feb 4, 2013 at 4:43 PM, Benjamin Poulain <benjamin at webkit.org>wrote:
> On Mon, Feb 4, 2013 at 3:51 PM, Alec Flett <alecflett at chromium.org> wrote:
>
>> At the moment, SerializedScriptValue uses Vector<uint8_t> (aka
>> Vector<unsigned char>) for both it's API (createFromWireBytes, toWireBytes)
>> as well as its internal representation. (for both v8 and jsc
>> implementations)
>>
>> The two largest consumers of this aspect of SerializedScriptValue seems
>> to be IndexedDB and postMessage().
>>
>> I'm jumping through some small hoops (i.e. reinterpret_cast and whatnot)
>> in IndexedDB to convert between Vector<uint8_t> and Vector<char> and a
>> 'const char*' buffer in order to write out to LevelDB, who likes 'char' as
>> opposed to unsigned char.
>>
>> postMessage() seems to be pretty agnostic to char vs unsigned char, since
>> it uses SerializedScriptValue to both produce and consume the buffers it
>> sends between windows.
>>
>> Before I did a code cleanup and just fixed up all the implementations to
>> use Vector<char> I wanted to see if anyone had any objections here, on both
>> the V8 and the JSC sides. The ultimate compiled code is going to be
>> identical, but I'll be able to avoid all sorts of reinterpret_cast's at
>> various points in the code.
>>
>> objections?
>>
>
> WTF/WebCore 8bits characters (LChar) are unsigned char.
> Wouldn't you just push the reinterpret_cast<> to the other side of
> the IndexedDB module? I find it a little odd to modify WebCore based on one
> particular dependency (LevelDB) but maybe there is a good reason.
>
> Benjamin
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-dev/attachments/20130204/17d0e44c/attachment.html>
More information about the webkit-dev
mailing list