[webkit-dev] null clients of Page

Darin Fisher darin at chromium.org
Mon Aug 16 23:35:44 PDT 2010


On Mon, Aug 16, 2010 at 9:43 PM, Dean Jackson <dino at apple.com> wrote:

> It was suggested I bring this to webkit-dev.
>
> There was some recent work to move the many parameters passed to the Page
> constructor into a single PageClients structure. The current assumption is
> that if a feature is enabled (at runtime or compile time) then Page will
> always get a non-null client for that feature.
>
> This allows the Page constructor to have something like this:
>
> , m_deviceMotionController(RuntimeEnabledFeatures::deviceMotionEnabled() ?
> n
> ew DeviceMotionController(pageClients.deviceMotionClient) : 0)
>
> and DeviceMotionController's constructor has an ASSERT(m_client).
>
> The problem is that not every Page needs every client. SVGImage, for
> example, creates a Page without all clients. Some platform ports branch
> around this code. The current solution is to create EmptyClient
> implementations.
>
> https://bugs.webkit.org/show_bug.cgi?id=43848
> https://bugs.webkit.org/show_bug.cgi?id=43533
>
> Related discussion:
> https://lists.webkit.org/pipermail/webkit-dev/2010-July/013597.html
>
> Wouldn't it be easier to allow null clients than to have these EmptyClient
> implementations?
>
> Dean
>
>
I think that'd be a lot of null checks.  It seems like it could add a fair
bit of code throughout WebCore, and folks would have to be careful not to
forget any null checks.

EmptyClients seems like a fairly isolated solution, which only requires
maintenance when a client interface changes.

-Darin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-dev/attachments/20100816/3412a1c1/attachment.html>


More information about the webkit-dev mailing list