[webkit-dev] Arena is crufty?

Kenneth Russell kbr at google.com
Wed Sep 1 17:12:39 PDT 2010


On Wed, Sep 1, 2010 at 5:08 PM, Chris Marrin <cmarrin at apple.com> wrote:
>
> On Sep 1, 2010, at 4:39 PM, Maciej Stachowiak wrote:
>
>>
>> On Sep 1, 2010, at 4:20 PM, Chris Marrin wrote:
>>
>>>
>>> Ken's PODRedBlackTree patch has made me go back and take a closer look at WebKit's Arena "class". Turns out it's not a class at all, just some structs and macros. That seems very un-WebKit-like to me. Ken's patch also has a PODArena class, which uses Arena in its implementation. Sam suggests that PODRedBlackTree should really go into WTF, which means PODArena and Arena would need to go there as well.
>>>
>>> It seems like Arena really needs to be brought into the 21st century and made a proper class. Maybe now is the right time to:
>>>
>>> 1) Make Arena a class
>>>
>>> 2) Integrate Ken's PODArena functionality into this new Arena class (or maybe just make Ken's PODArena the new Arena class).
>>>
>>> 3) Move the new Arena class to WTF
>>>
>>> 4) Put PODRedBlackTree in WTF
>>>
>>> It looks like RenderArena is currently the only client of Arena.h, so this change shouldn't be too hard. Of course, looking at RenderArena, it's a little odd, too. It is not renderer specific at all. It's just an Arena that recycles freed objects. Maybe we should move that functionality into the new Arena class. But RenderArena is used all over the place, so maybe that's going one step too far down this road?
>>
>> Arena was imported from Mozilla and could certainly benefit from modernization. For the rendering use case though, it is essential to handle non-POD types correctly.
>
> But RenderArena doesn't deal with types at all, does it? It just allocs and free's void*'s. It's not even a template class. So maybe we should have an Arena class which deals with void*'s and a PODArena template class which lets you type arena objects? RenderArena would use the Arena class.

RenderArena is used by classes which want to override operator new and
delete in order to be allocated in an arena.

PODArena is designed to be non-intrusive with respect to the POD data
types that are allocated in it; overloaded operator new and delete do
not need to be provided.

-Ken


More information about the webkit-dev mailing list