[webkit-dev] WebCore/platform directory

Darin Adler darin at apple.com
Tue Dec 5 13:14:01 PST 2006


Recently, we discussed the platform directory a bit in a bug <http:// 
bugs.webkit.org/show_bug.cgi?id=11596>.

I thought I'd say a few things on this point to the entire list.

The "platform" directory is where we have the platform that the rest  
of WebCore is built on top of. The primary focus is platform- 
independent wrappers for platform specific services, like events,  
graphics systems, as well as some basic data structures.

The platform independent interfaces and implementation are at the top  
level, and platform-specific implementations go into directories  
named with the nickname for each platform (e.g. "mac" for Macintosh,  
"qt" for Qt, "win" for Windows). Since most headers are shared, some  
platform-specific code is in the headers guarded by appropriate #if  
statements.

We also expect to have platform-specific implementations in some  
other places in the source tree. What goes into the platform  
directory is a platform abstraction that the rest of the library is  
built on. But in some cases, you can't build the platform specifics  
into a platform abstraction -- you need platform specifics in the  
higher level code.

At the moment, a couple of directories that are have this kind of  
platform-specific code are page and loader. (Much of the code  
currently in bridge/mac belongs in page/mac.) While we'd like to keep  
from doing this all over the code, we will need platform specifics  
outside the platform directory when they can't easily be abstracted  
into a generic cross-platform concept.

I see signs that people are misunderstanding this approach a bit. For  
example, FrameQt and PageQt absolutely do not belong in platform/qt.  
They should be in page/qt instead.

I'm sorry that this wasn't explained clearly enough in the past.

     -- Darin



More information about the webkit-dev mailing list