Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(8)

Unified Diff: third_party/WebKit/Source/core/Init.cpp

Issue 1363653006: Reserve capacity for static strings HashMap. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/Init.cpp
diff --git a/third_party/WebKit/Source/core/Init.cpp b/third_party/WebKit/Source/core/Init.cpp
index 1576624f3cc92f5dd3eb838cbed00ca14ecfa38f..b2cde4e00e30110718a92e283674d663c222675f 100644
--- a/third_party/WebKit/Source/core/Init.cpp
+++ b/third_party/WebKit/Source/core/Init.cpp
@@ -76,6 +76,33 @@ void CoreInitializer::init()
{
ASSERT(!m_isInited);
m_isInited = true;
+ // Note: in order to add core static strings for a new module (1)
+ // the value of 'coreStaticStringsCount' must be updated with the
+ // added strings count, (2) if the added strings are quialified names
+ // the 'qualifiedNamesCount' must be updated as well, (3) the strings
+ // 'init()' function call must be added.
+ // 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.
+ const unsigned qualifiedNamesCount = HTMLNames::HTMLTagsCount + HTMLNames::HTMLAttrsCount
+ + MathMLNames::MathMLTagsCount + MathMLNames::MathMLAttrsCount
+ + SVGNames::SVGTagsCount + SVGNames::SVGAttrsCount
+ + XLinkNames::XLinkAttrsCount
+ + XMLNSNames::XMLNSAttrsCount
+ + XMLNames::XMLAttrsCount;
+
+ QualifiedName::initAndReserveCapacityForSize(qualifiedNamesCount);
+
+ const unsigned coreStaticStringsCount = qualifiedNamesCount
+ + EventNames::EventNamesCount
+ + EventTargetNames::EventTargetNamesCount
+ + EventTypeNames::EventTypeNamesCount
+ + FetchInitiatorTypeNames::FetchInitiatorTypeNamesCount
+ + FontFamilyNames::FontFamilyNamesCount
+ + HTMLTokenizerNames::HTMLTokenizerNamesCount
+ + InputTypeNames::InputTypeNamesCount
+ + MediaFeatureNames::MediaFeatureNamesCount
+ + MediaTypeNames::MediaTypeNamesCount;
+
+ StringImpl::reserveStaticStringsCapacityForSize(coreStaticStringsCount + StringImpl::allStaticStrings().size());
HTMLNames::init();
SVGNames::init();
@@ -103,7 +130,6 @@ void CoreInitializer::init()
StyleChangeExtraData::init();
- QualifiedName::init();
EventTracer::initialize();
KURL::initialize();
SecurityPolicy::init();
« no previous file with comments | « third_party/WebKit/Source/build/scripts/templates/MakeNames.h.tmpl ('k') | third_party/WebKit/Source/core/dom/QualifiedName.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698