[webkit-dev] Some thoughts about platform flags

Amanda Walker amanda at chromium.org
Wed Sep 24 22:05:21 PDT 2008

On Wed, Sep 24, 2008 at 7:22 PM, Maciej Stachowiak <mjs at apple.com> wrote:
> Do you guys have cross-process rendering working on Mac yet, even as a
> prototype? I am wondering if these statements about what is required to do
> it have been tested or are just assumptions.

We have working proofs of concept for both rendering into a RAM bitmap
and blitting that into a view within a single process and
cross-process rendering using a shared memory CGBitmapContext.  We
also have validation of this approach from some other projects inside
and outside of Google that have similarly high performance demands, so
we're pretty confident that it's a workable approach, at least for

> I ask because I suspect doing cross-process rendering efficiently on Mac is
> nontrivial and I would be concerned that changes could be made that go in
> the wrong direction, if there isn't a proof of concept done first.

Cross-process rendering itself is a given--the only questions are
details of the mechanism we use to get the bits onto the screen.
There are several possible underlying mechanisms we could use with
varying degrees of fragility.

However, that seems orthogonal to the type of changes we're talking
about here--all cross-process rendering approaches rely on an
application that hosts views that are rendered in a different address
space, and thus require some kind of proxy or delegate to do things
that are done with direct method and function calls in WebKit.

You can see some of this in the Chromium code base already, in classes
like WebViewHost and RenderViewHost--those particular examples are
outside of WebKit, of course, but since there's currently no
well-defined abstraction layer between WebCore and WebKit, our choices
appear to be to either add some feature flags to the current Mac
rendering code or to do what we ended up doing for Windows, which is
to duplicate its functionality--it just seems a shame to end up with
two sets of CG + Cocoa rendering code.

So, to boil it down a little further, a large part of the question
becomes whether it's preferable to add build-time flexibility to save
on code duplication, or to duplicate code to avoid complicating any
single platform.  There's no a priori right answer to that, of course.
 For Windows, since we didn't have the luxury of having a port of CG
available, duplication was the clear way to go.  On the Mac, it's less
clear.  Our first inclination is to alter some of the assumptions with
build-time options, since there actually aren't too many places where
it turns out we'd need to do that.

Sorry for the long essay :-).


More information about the webkit-dev mailing list