[webkit-dev] Atomic Strings and static vars

Darin Adler darin at apple.com
Mon Jun 5 11:50:43 PDT 2006


On Jun 5, 2006, at 7:49 AM, Geoffrey Garen wrote:

> FYI, a static AtomicString would be a Bad Thing (TM) anyway, since  
> it would require WebKit to have a static initialization routine for  
> that string. Such a routine increases the start-up time and memory  
> footprint of anything that links against WebKit, which includes  
> just about everything that ships with OS X. (In fact, we have some  
> open bugs about that.)

You can use a static AtomicString inside a function. These types of  
global variables are initialized the first time the function is called.

As Geoff says, because of requirements for the WebKit framework on OS  
X, global variables outside functions with constructors are not  
allowed in JavaScriptCore, WebCore, or WebKit. That's why you'll see  
a lot of globals with, say, a HashMap* type instead of just a HashMap.

     -- Darin




More information about the webkit-dev mailing list