Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 69 return; | 69 return; |
| 70 isRegistered = true; | 70 isRegistered = true; |
| 71 | 71 |
| 72 Document::registerEventFactory(EventFactory::create()); | 72 Document::registerEventFactory(EventFactory::create()); |
| 73 } | 73 } |
| 74 | 74 |
| 75 void CoreInitializer::init() | 75 void CoreInitializer::init() |
| 76 { | 76 { |
| 77 ASSERT(!m_isInited); | 77 ASSERT(!m_isInited); |
| 78 m_isInited = true; | 78 m_isInited = true; |
| 79 // Note: in order to add core static strings for a new module (1) | |
| 80 // the value of 'coreStaticStringsCount' must be updated with the | |
| 81 // added strings count, (2) if the added strings are quialified names | |
| 82 // the 'qualifiedNamesCount' must be updated as well, (3) the strings | |
| 83 // 'init()' function call must be added. | |
| 84 // TODO: We should generate static strings initialization code. | |
|
tkent
2015/09/28 00:11:17
TODO needs your name.
TODO(mikhail.pozdnyakov@in
Mikhail
2015/09/28 08:39:34
Done.
| |
| 85 const unsigned qualifiedNamesCount = HTMLNames::HTMLTagsCount + HTMLNames::H TMLAttrsCount | |
| 86 + MathMLNames::MathMLTagsCount + MathMLNames::MathMLAttrsCount | |
| 87 + SVGNames::SVGTagsCount + SVGNames::SVGAttrsCount | |
| 88 + XLinkNames::XLinkAttrsCount | |
| 89 + XMLNSNames::XMLNSAttrsCount | |
| 90 + XMLNames::XMLAttrsCount; | |
| 91 | |
| 92 QualifiedName::initAndReserveCapacityForSize(qualifiedNamesCount); | |
| 93 | |
| 94 const unsigned coreStaticStringsCount = qualifiedNamesCount | |
| 95 + EventNames::EventNamesCount | |
| 96 + EventTargetNames::EventTargetNamesCount | |
| 97 + EventTypeNames::EventTypeNamesCount | |
| 98 + FetchInitiatorTypeNames::FetchInitiatorTypeNamesCount | |
| 99 + FontFamilyNames::FontFamilyNamesCount | |
| 100 + HTMLTokenizerNames::HTMLTokenizerNamesCount | |
| 101 + InputTypeNames::InputTypeNamesCount | |
| 102 + MediaFeatureNames::MediaFeatureNamesCount | |
| 103 + MediaTypeNames::MediaTypeNamesCount; | |
| 104 | |
| 105 StringImpl::reserveStaticStringsCapacityForSize(coreStaticStringsCount + Str ingImpl::allStaticStrings().size()); | |
| 79 | 106 |
| 80 HTMLNames::init(); | 107 HTMLNames::init(); |
| 81 SVGNames::init(); | 108 SVGNames::init(); |
| 82 XLinkNames::init(); | 109 XLinkNames::init(); |
| 83 MathMLNames::init(); | 110 MathMLNames::init(); |
| 84 XMLNSNames::init(); | 111 XMLNSNames::init(); |
| 85 XMLNames::init(); | 112 XMLNames::init(); |
| 86 | 113 |
| 87 EventNames::init(); | 114 EventNames::init(); |
| 88 EventTargetNames::init(); | 115 EventTargetNames::init(); |
| 89 EventTypeNames::init(); | 116 EventTypeNames::init(); |
| 90 FetchInitiatorTypeNames::init(); | 117 FetchInitiatorTypeNames::init(); |
| 91 FontFamilyNames::init(); | 118 FontFamilyNames::init(); |
| 92 HTMLTokenizerNames::init(); | 119 HTMLTokenizerNames::init(); |
| 93 InputTypeNames::init(); | 120 InputTypeNames::init(); |
| 94 MediaFeatureNames::init(); | 121 MediaFeatureNames::init(); |
| 95 MediaTypeNames::init(); | 122 MediaTypeNames::init(); |
| 96 | 123 |
| 97 CSSPrimitiveValue::initUnitTable(); | 124 CSSPrimitiveValue::initUnitTable(); |
| 98 CSSParserTokenRange::initStaticEOFToken(); | 125 CSSParserTokenRange::initStaticEOFToken(); |
| 99 | 126 |
| 100 // It would make logical sense to do this in WTF::initialize() but there are | 127 // It would make logical sense to do this in WTF::initialize() but there are |
| 101 // ordering dependencies, e.g. about "xmlns". | 128 // ordering dependencies, e.g. about "xmlns". |
| 102 WTF::StringStatics::init(); | 129 WTF::StringStatics::init(); |
|
tkent
2015/09/28 00:11:16
This needs to be called before QualifiedName::init
Mikhail
2015/09/28 08:39:34
Done.
| |
| 103 | 130 |
| 104 StyleChangeExtraData::init(); | 131 StyleChangeExtraData::init(); |
| 105 | 132 |
| 106 QualifiedName::init(); | |
| 107 EventTracer::initialize(); | 133 EventTracer::initialize(); |
| 108 KURL::initialize(); | 134 KURL::initialize(); |
| 109 SecurityPolicy::init(); | 135 SecurityPolicy::init(); |
| 110 | 136 |
| 111 registerEventFactory(); | 137 registerEventFactory(); |
| 112 | 138 |
| 113 StringImpl::freezeStaticStrings(); | 139 StringImpl::freezeStaticStrings(); |
| 114 | 140 |
| 115 // Creates HTMLParserThread::shared and ScriptStreamerThread::shared, but | 141 // Creates HTMLParserThread::shared and ScriptStreamerThread::shared, but |
| 116 // does not start the threads. | 142 // does not start the threads. |
| 117 HTMLParserThread::init(); | 143 HTMLParserThread::init(); |
| 118 ScriptStreamerThread::init(); | 144 ScriptStreamerThread::init(); |
| 119 } | 145 } |
| 120 | 146 |
| 121 void CoreInitializer::shutdown() | 147 void CoreInitializer::shutdown() |
| 122 { | 148 { |
| 123 // Make sure we stop the HTMLParserThread before Platform::current() is | 149 // Make sure we stop the HTMLParserThread before Platform::current() is |
| 124 // cleared. | 150 // cleared. |
| 125 HTMLParserThread::shutdown(); | 151 HTMLParserThread::shutdown(); |
| 126 } | 152 } |
| 127 | 153 |
| 128 } // namespace blink | 154 } // namespace blink |
| OLD | NEW |