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

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: Fixed the deduced string length (exclude NULL terminator) 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..02fe0998d9465bedaa3b57f248515915a9e55e77 100644
--- a/third_party/WebKit/Source/core/Init.cpp
+++ b/third_party/WebKit/Source/core/Init.cpp
@@ -58,7 +58,6 @@
#include "platform/weborigin/KURL.h"
#include "platform/weborigin/SecurityPolicy.h"
#include "wtf/Partitions.h"
-#include "wtf/text/StringStatics.h"
namespace blink {
@@ -76,6 +75,32 @@ 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(mikhail.pozdnyakov@intel.com): We should generate static strings initialization code.
+ const unsigned qualifiedNamesCount = HTMLNames::HTMLTagsCount + HTMLNames::HTMLAttrsCount
+ + MathMLNames::MathMLTagsCount + MathMLNames::MathMLAttrsCount
+ + SVGNames::SVGTagsCount + SVGNames::SVGAttrsCount
+ + XLinkNames::XLinkAttrsCount
+ + XMLNSNames::XMLNSAttrsCount
+ + XMLNames::XMLAttrsCount;
+
+ 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());
+ QualifiedName::initAndReserveCapacityForSize(qualifiedNamesCount);
HTMLNames::init();
SVGNames::init();
@@ -97,13 +122,8 @@ void CoreInitializer::init()
CSSPrimitiveValue::initUnitTable();
CSSParserTokenRange::initStaticEOFToken();
- // It would make logical sense to do this in WTF::initialize() but there are
- // ordering dependencies, e.g. about "xmlns".
- WTF::StringStatics::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