[webkit-dev] Understanding WebKit layering and layering violations

Adam Barth abarth at webkit.org
Fri Jan 6 13:36:41 PST 2012


On Fri, Jan 6, 2012 at 8:08 AM, Fady Samuel <fsamuel at chromium.org> wrote:
> Your diagram is a start. I don't recall all my layering violation confusions
> but the latest confusion I had was in regards to what goes in the
> Source/WebCore/platform directory?
>
> Why are things like ScrollView ScrollableArea, Timer, or even NotImplemented
> or Length in that directory? A lot of these things don't look like
> platform-specific code.

Platform isn't about platform-specific code.  It's an abstraction of
the platform upon which WebCore runs.  Code generally goes there
because it's not specific to a web rendering engine (e.g., it doesn't
refer to DOM or CSS concepts) but it's not something that would be
used by every program (e.g., RefPtr).

> They're also not necessarily interfaces to
> platform-specific code. So what are they? How does one decide something
> belongs in Source/WebCore/platform.

Something should go into Platform if it's an abstraction of a facility
provided by the underlying platform.  For example, ScrollableArea is
an abstraction of a concept provided by most platforms.  Something
should not go in Platform if it refers to web concepts (e.g., a Frame,
which belongs in WebCore proper) or if it's something that might be
used by every program (e.g., RefPtr, which belongs in WTF).

> What can things in this directory depend on and what can they not depend on?

That's described by the diagram earlier in this thread.  Platform can
depend on third-party libraries (e.g., SQLite) or on operating system
facilities.  Platform can depend on WTF, but no other code in the
WebKit project.

Adam


> On Thu, Jan 5, 2012 at 7:39 PM, Adam Barth <abarth at webkit.org> wrote:
>>
>> On Thu, Jan 5, 2012 at 4:18 PM, Fady Samuel <fsamuel at chromium.org> wrote:
>> > I've been working on WebKit off and on for a while now but I must admit
>> > that, up to this point, I still don't have a firm grasp of all the
>> > layering
>> > in WebKit. What depends on what, and what cannot depend on what? What is
>> > the
>> > motivation of each of these individual layers? I understand the need to
>> > have
>> > WebKit supported under multiple platforms and with any embedder, and but
>> > I
>> > often don't fully understand what constitues a layering violation or
>> > why.
>> >
>> > Could someone please summarize or provide a link that explains all this?
>> > I
>> > think this would be beneficial to the entire WebKit community!
>>
>> There's one diagram:
>>
>>
>> https://docs.google.com/drawings/d/10WlCj2J3arxf4cDGRKteNinaP755iFnmYtYtnNSCQOY/edit?authkey=CP6plYAI&hl=en_US
>>
>> It's not perfectly accurate because it's something of a proposal, but
>> it should give you a high-level view.  Do you have specific questions?
>>  I'm happy to draw more pictures if that would be helpful.
>>
>> Adam
>
>


More information about the webkit-dev mailing list