On Sep 1, 2010, at 5:12 PM, Kenneth Russell wrote:

> On Wed, Sep 1, 2010 at 5:08 PM, Chris Marrin <cmar...@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.

Right, so I think we should have (in WTF) an Arena class which simply does 
arena based alloc and free of void*'s, and a PODArena template class which does 
what your PODArena does today, using the Arena class as its implementation. 
Then RenderArena should be changed to use Arena. This is minimal change and 
doesn't change the functionality of any end-user classes.


webkit-dev mailing list

Reply via email to