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

Side by Side Diff: third_party/WebKit/Source/build/scripts/templates/MakeNames.cpp.tmpl

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, 2 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 unified diff | Download patch
« no previous file with comments | « no previous file | third_party/WebKit/Source/build/scripts/templates/MakeNames.h.tmpl » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 {% from "macros.tmpl" import license %} 1 {% from "macros.tmpl" import license %}
2 {{ license() }} 2 {{ license() }}
3 3
4 #include "config.h" 4 #include "config.h"
5 5
6 #include "{{namespace}}{{suffix}}Names.h" 6 #include "{{namespace}}{{suffix}}Names.h"
7 7
8 #include "wtf/StdLibExtras.h" 8 #include "wtf/StdLibExtras.h"
9 9
10 // Generated from: 10 // Generated from:
11 {% for entry in in_files|sort %} 11 {% for entry in in_files|sort %}
12 // - {{entry}} 12 // - {{entry}}
13 {% endfor %} 13 {% endfor %}
14 14
15 namespace blink { 15 namespace blink {
16 namespace {{namespace}}Names { 16 namespace {{namespace}}Names {
17 17
18 using namespace WTF; 18 using namespace WTF;
19 19
20 const int k{{suffix}}NameCount = {{entries|length}}; 20 void* {{suffix}}NamesStorage[{{namespace}}{{suffix}}NamesCount * ((sizeof(Atomic String) + sizeof(void *) - 1) / sizeof(void *))];
21
22 void* {{suffix}}NamesStorage[k{{suffix}}NameCount * ((sizeof(AtomicString) + siz eof(void *) - 1) / sizeof(void *))];
23 21
24 {% for entry in entries|sort(attribute='name', case_sensitive=True) %} 22 {% for entry in entries|sort(attribute='name', case_sensitive=True) %}
25 {% filter enable_conditional(entry.Conditional) %} 23 {% filter enable_conditional(entry.Conditional) %}
26 const AtomicString& {{entry|symbol}} = reinterpret_cast<AtomicString*>(&{{suffix }}NamesStorage)[{{loop.index0}}]; 24 const AtomicString& {{entry|symbol}} = reinterpret_cast<AtomicString*>(&{{suffix }}NamesStorage)[{{loop.index0}}];
27 {% endfilter %} 25 {% endfilter %}
28 {% endfor %} 26 {% endfor %}
29 27
30 void init{{suffix}}() 28 void init{{suffix}}()
31 { 29 {
32 struct NameEntry { 30 struct NameEntry {
(...skipping 10 matching lines...) Expand all
43 41
44 for (size_t i = 0; i < WTF_ARRAY_LENGTH(kNames); i++) { 42 for (size_t i = 0; i < WTF_ARRAY_LENGTH(kNames); i++) {
45 StringImpl* stringImpl = StringImpl::createStatic(kNames[i].name, kNames [i].length, kNames[i].hash); 43 StringImpl* stringImpl = StringImpl::createStatic(kNames[i].name, kNames [i].length, kNames[i].hash);
46 void* address = reinterpret_cast<AtomicString*>(&{{suffix}}NamesStorage) + i; 44 void* address = reinterpret_cast<AtomicString*>(&{{suffix}}NamesStorage) + i;
47 new (address) AtomicString(stringImpl); 45 new (address) AtomicString(stringImpl);
48 } 46 }
49 } 47 }
50 48
51 } // {{namespace}}Names 49 } // {{namespace}}Names
52 } // namespace blink 50 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/build/scripts/templates/MakeNames.h.tmpl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698