[webkit-dev] Simplifying "hub" classes (was Cleaning up directories in WebCore)
Adam Barth
abarth at webkit.org
Fri Nov 18 14:55:35 PST 2011
On Fri, Nov 18, 2011 at 2:38 PM, Ryosuke Niwa <rniwa at webkit.org> wrote:
> On Fri, Nov 18, 2011 at 2:27 PM, Adam Barth <abarth at webkit.org> wrote:
>> I've done some analysis of header inclusion dependencies, and they're
>> actually pretty good for these directories. The main issues at the
>> moment are "hub" classes like Page, Frame, and Document, which need to
>> be touched by many features.
>
> One thing I wanted to do is separate those "hub" part of Page, Frame, and
> Document into PageBase, FrameBase, and DocumentBase. (Or use Hub that the
> word has been coined). This has a nice side-effect of reducing the header
> file dependency and possibly reducing the compilation time.
That was has already largely been done for Frame, which is (mostly!)
just a holder for various components.
One interesting case I've been look at is ENABLE(SQL_DATABASE). In
principle, there's no reason WebCore proper should have any
ENABLE(SQL_DATABASE) ifdefs. Yet, here's one in
ScriptExecutionContext:
http://trac.webkit.org/browser/trunk/Source/WebCore/dom/ScriptExecutionContext.h#L74
As far as I can tell, the state for those functions don't interact
with any other state on ScriptExecutionContext or Document. Really,
SQL_DATABASE just wants to store some state per
ScriptExecutionContext. It seems like there should be a way to do
that without making a mess of ScriptExecutionContext.
IMHO, we want something like the C++ equivalent of Objective-C
categories. I'm not sure how best to achieve that.
Adam
More information about the webkit-dev
mailing list