equal
deleted
inserted
replaced
33 |
33 |
34 #define DEFINE_EVENT_GLOBAL(name) \ |
34 #define DEFINE_EVENT_GLOBAL(name) \ |
35 DEFINE_GLOBAL(AtomicString, name##Event, #name) |
35 DEFINE_GLOBAL(AtomicString, name##Event, #name) |
36 DOM_EVENT_NAMES_FOR_EACH(DEFINE_EVENT_GLOBAL) |
36 DOM_EVENT_NAMES_FOR_EACH(DEFINE_EVENT_GLOBAL) |
37 |
37 |
|
38 static bool initialized = false; |
|
39 |
38 void init() |
40 void init() |
39 { |
41 { |
40 static bool initialized; |
|
41 if (!initialized) { |
42 if (!initialized) { |
42 // Use placement new to initialize the globals. |
43 // Use placement new to initialize the globals. |
43 |
44 |
44 AtomicString::init(); |
45 AtomicString::init(); |
45 #define INITIALIZE_GLOBAL(name) new ((void*)&name##Event) AtomicString(#name); |
46 #define INITIALIZE_GLOBAL(name) new ((void*)&name##Event) AtomicString(#name); |
46 DOM_EVENT_NAMES_FOR_EACH(INITIALIZE_GLOBAL) |
47 DOM_EVENT_NAMES_FOR_EACH(INITIALIZE_GLOBAL) |
47 initialized = true; |
48 initialized = true; |
48 } |
49 } |
49 } |
50 } |
50 |
51 |
|
52 void remove() |
|
53 { |
|
54 if( initialized ) { |
|
55 #define DESTROY_GLOBAL(name) delete ((AtomicString*)&name##Event)->impl(); |
|
56 DOM_EVENT_NAMES_FOR_EACH(DESTROY_GLOBAL) |
|
57 AtomicString::remove(); |
|
58 |
|
59 initialized = false; |
|
60 } |
|
61 |
|
62 } //remove() |
|
63 |
51 } } |
64 } } |