Commit 5b638caa authored by Kent Tamura's avatar Kent Tamura Committed by Commit Bot

Fix coding style of files generated by make_names.py and make_qualified_names.py

This CL has no behavior changes.

Change-Id: I8d6f6c87fc92ef3924ca9406e519e60fc7ff0035
Reviewed-on: https://chromium-review.googlesource.com/c/1317417Reviewed-by: default avatarHitoshi Yoshida <peria@chromium.org>
Commit-Queue: Kent Tamura <tkent@chromium.org>
Cr-Commit-Position: refs/heads/master@{#605493}
parent 439d04ad
...@@ -10,16 +10,16 @@ ...@@ -10,16 +10,16 @@
namespace blink { namespace blink {
namespace {{namespace}} { namespace {{namespace}} {
void* {{suffix}}NamesStorage[k{{suffix}}NamesCount * ((sizeof(AtomicString) + sizeof(void *) - 1) / sizeof(void *))]; void* {{suffix|lower}}names_storage[k{{suffix}}NamesCount * ((sizeof(AtomicString) + sizeof(void *) - 1) / sizeof(void *))];
{% for entry in entries|sort(attribute='name', case_sensitive=True) %} {% for entry in entries|sort(attribute='name', case_sensitive=True) %}
const AtomicString& {{entry|symbol}} = reinterpret_cast<AtomicString*>(&{{suffix}}NamesStorage)[{{loop.index0}}]; const AtomicString& {{entry|symbol}} = reinterpret_cast<AtomicString*>(&{{suffix|lower}}names_storage)[{{loop.index0}}];
{% endfor %} {% endfor %}
void init{{suffix}}() { void Init{{suffix}}() {
static bool isLoaded = false; static bool is_loaded = false;
if (isLoaded) return; if (is_loaded) return;
isLoaded = true; is_loaded = true;
struct NameEntry { struct NameEntry {
const char* name; const char* name;
...@@ -33,10 +33,10 @@ void init{{suffix}}() { ...@@ -33,10 +33,10 @@ void init{{suffix}}() {
{% endfor %} {% endfor %}
}; };
for (size_t i = 0; i < arraysize(kNames); i++) { for (size_t i = 0; i < arraysize(kNames); ++i) {
StringImpl* stringImpl = StringImpl::CreateStatic(kNames[i].name, kNames[i].length, kNames[i].hash); StringImpl* impl = StringImpl::CreateStatic(kNames[i].name, kNames[i].length, kNames[i].hash);
void* address = reinterpret_cast<AtomicString*>(&{{suffix}}NamesStorage) + i; void* address = reinterpret_cast<AtomicString*>(&{{suffix|lower}}names_storage) + i;
new (address) AtomicString(stringImpl); new (address) AtomicString(impl);
} }
} }
......
...@@ -25,7 +25,7 @@ namespace {{namespace}} { ...@@ -25,7 +25,7 @@ namespace {{namespace}} {
constexpr unsigned k{{suffix}}NamesCount = {{entries|length}}; constexpr unsigned k{{suffix}}NamesCount = {{entries|length}};
{{symbol_export}}void init{{suffix}}(); {{symbol_export}}void Init{{suffix}}();
} // namespace {{namespace}} } // namespace {{namespace}}
} // namespace blink } // namespace blink
......
...@@ -13,59 +13,57 @@ ...@@ -13,59 +13,57 @@
namespace blink { namespace blink {
namespace {{cpp_namespace}} { namespace {{cpp_namespace}} {
using namespace blink;
DEFINE_GLOBAL(AtomicString, {{namespace_prefix}}NamespaceURI); DEFINE_GLOBAL(AtomicString, {{namespace_prefix}}NamespaceURI);
{% if tags %} {% if tags %}
// Tags // Tags
void* {{suffix}}TagStorage[kTagsCount * ((sizeof({{namespace}}QualifiedName) + sizeof(void *) - 1) / sizeof(void *))]; void* tag_storage[kTagsCount * ((sizeof({{namespace}}QualifiedName) + sizeof(void *) - 1) / sizeof(void *))];
{% for tag in tags|sort(attribute='name', case_sensitive=True) %} {% for tag in tags|sort(attribute='name', case_sensitive=True) %}
const {{namespace}}QualifiedName& {{tag|symbol}}Tag = reinterpret_cast<{{namespace}}QualifiedName*>(&{{suffix}}TagStorage)[{{loop.index0}}]; const {{namespace}}QualifiedName& {{tag|symbol}}Tag = reinterpret_cast<{{namespace}}QualifiedName*>(&tag_storage)[{{loop.index0}}];
{% endfor %} {% endfor %}
std::unique_ptr<const {{namespace}}QualifiedName*[]> GetTags() { std::unique_ptr<const {{namespace}}QualifiedName*[]> GetTags() {
auto tags = std::make_unique<const {{namespace}}QualifiedName*[]>(kTagsCount); auto tags = std::make_unique<const {{namespace}}QualifiedName*[]>(kTagsCount);
for (size_t i = 0; i < kTagsCount; i++) for (size_t i = 0; i < kTagsCount; ++i)
tags[i] = reinterpret_cast<{{namespace}}QualifiedName*>(&{{suffix}}TagStorage) + i; tags[i] = reinterpret_cast<{{namespace}}QualifiedName*>(&tag_storage) + i;
return tags; return tags;
} }
{% endif %} {% endif %}
// Attributes // Attributes
void* {{suffix}}AttrStorage[kAttrsCount * ((sizeof(QualifiedName) + sizeof(void *) - 1) / sizeof(void *))]; void* attr_storage[kAttrsCount * ((sizeof(QualifiedName) + sizeof(void *) - 1) / sizeof(void *))];
{% for attr in attrs|sort(attribute='name', case_sensitive=True) %} {% for attr in attrs|sort(attribute='name', case_sensitive=True) %}
const QualifiedName& {{attr|symbol}}Attr = reinterpret_cast<QualifiedName*>(&{{suffix}}AttrStorage)[{{loop.index0}}]; const QualifiedName& {{attr|symbol}}Attr = reinterpret_cast<QualifiedName*>(&attr_storage)[{{loop.index0}}];
{% endfor %} {% endfor %}
{% if namespace != 'HTML' %} {% if namespace != 'HTML' %}
std::unique_ptr<const QualifiedName*[]> GetAttrs() { std::unique_ptr<const QualifiedName*[]> GetAttrs() {
auto attrs = std::make_unique<const QualifiedName*[]>(kAttrsCount); auto attrs = std::make_unique<const QualifiedName*[]>(kAttrsCount);
for (size_t i = 0; i < kAttrsCount; i++) for (size_t i = 0; i < kAttrsCount; ++i)
attrs[i] = reinterpret_cast<QualifiedName*>(&{{suffix}}AttrStorage) + i; attrs[i] = reinterpret_cast<QualifiedName*>(&attr_storage) + i;
return attrs; return attrs;
} }
{% endif %} {% endif %}
void init() { void Init() {
struct NameEntry { struct NameEntry {
const char* name; const char* name;
unsigned hash; unsigned hash;
unsigned char length; unsigned char length;
unsigned char isTag; unsigned char is_tag;
unsigned char isAttr; unsigned char is_attr;
}; };
// Namespace
// Use placement new to initialize the globals. // Use placement new to initialize the globals.
AtomicString {{namespace_prefix}}NS("{{namespace_uri}}"); AtomicString ns_uri("{{namespace_uri}}");
new ((void*)&{{namespace_prefix}}NamespaceURI) AtomicString(ns_uri);
// Namespace
new ((void*)&{{namespace_prefix}}NamespaceURI) AtomicString({{namespace_prefix}}NS);
{% set tagnames = tags|map(attribute='name')|list() %} {% set tagnames = tags|map(attribute='name')|list() %}
{% set attrnames = attrs|map(attribute='name')|list() %} {% set attrnames = attrs|map(attribute='name')|list() %}
static const NameEntry kNames[] = { static const NameEntry kNames[] = {
...@@ -78,25 +76,25 @@ void init() { ...@@ -78,25 +76,25 @@ void init() {
size_t tag_i = 0; size_t tag_i = 0;
{% endif %} {% endif %}
size_t attr_i = 0; size_t attr_i = 0;
for (size_t i = 0; i < arraysize(kNames); i++) { for (size_t i = 0; i < arraysize(kNames); ++i) {
StringImpl* stringImpl = StringImpl::CreateStatic(kNames[i].name, kNames[i].length, kNames[i].hash); StringImpl* impl = StringImpl::CreateStatic(kNames[i].name, kNames[i].length, kNames[i].hash);
{% if tags %} {% if tags %}
if (kNames[i].isTag) { if (kNames[i].is_tag) {
void* address = reinterpret_cast<{{namespace}}QualifiedName*>(&{{suffix}}TagStorage) + tag_i; void* address = reinterpret_cast<{{namespace}}QualifiedName*>(&tag_storage) + tag_i;
QualifiedName::CreateStatic(address, stringImpl, {{namespace_prefix}}NS); QualifiedName::CreateStatic(address, impl, ns_uri);
tag_i++; ++tag_i;
} }
if (!kNames[i].isAttr) if (!kNames[i].is_attr)
continue; continue;
{% endif %} {% endif %}
void* address = reinterpret_cast<QualifiedName*>(&{{suffix}}AttrStorage) + attr_i; void* address = reinterpret_cast<QualifiedName*>(&attr_storage) + attr_i;
{% if use_namespace_for_attrs %} {% if use_namespace_for_attrs %}
QualifiedName::CreateStatic(address, stringImpl, {{namespace_prefix}}NS); QualifiedName::CreateStatic(address, impl, ns_uri);
{% else %} {% else %}
QualifiedName::CreateStatic(address, stringImpl); QualifiedName::CreateStatic(address, impl);
{% endif %} {% endif %}
attr_i++; ++attr_i;
} }
{% if tags %} {% if tags %}
DCHECK_EQ(tag_i, kTagsCount); DCHECK_EQ(tag_i, kTagsCount);
......
...@@ -6,11 +6,12 @@ ...@@ -6,11 +6,12 @@
#ifndef {{header_guard}} #ifndef {{header_guard}}
#define {{header_guard}} #define {{header_guard}}
#include <memory>
{% if export == 'CORE_EXPORT' %} {% if export == 'CORE_EXPORT' %}
#include "third_party/blink/renderer/core/core_export.h" #include "third_party/blink/renderer/core/core_export.h"
{% endif %} {% endif %}
#include "third_party/blink/renderer/core/dom/qualified_name.h" #include "third_party/blink/renderer/core/dom/qualified_name.h"
#include <memory>
namespace blink { namespace blink {
...@@ -42,7 +43,7 @@ constexpr unsigned kAttrsCount = {{attrs|count}}; ...@@ -42,7 +43,7 @@ constexpr unsigned kAttrsCount = {{attrs|count}};
std::unique_ptr<const QualifiedName*[]> GetAttrs(); std::unique_ptr<const QualifiedName*[]> GetAttrs();
{% endif %} {% endif %}
void init(); void Init();
} // namespace {{cpp_namespace}} } // namespace {{cpp_namespace}}
} // namespace blink } // namespace blink
......
...@@ -110,25 +110,25 @@ void CoreInitializer::Initialize() { ...@@ -110,25 +110,25 @@ void CoreInitializer::Initialize() {
AtomicStringTable::Instance().ReserveCapacity(kCoreStaticStringsCount); AtomicStringTable::Instance().ReserveCapacity(kCoreStaticStringsCount);
html_names::init(); html_names::Init();
mathml_names::init(); mathml_names::Init();
svg_names::init(); svg_names::Init();
xlink_names::init(); xlink_names::Init();
xml_names::init(); xml_names::Init();
xmlns_names::init(); xmlns_names::Init();
event_interface_names::init(); event_interface_names::Init();
event_target_names::init(); event_target_names::Init();
event_type_names::init(); event_type_names::Init();
fetch_initiator_type_names::init(); fetch_initiator_type_names::Init();
font_family_names::init(); font_family_names::Init();
html_tokenizer_names::init(); html_tokenizer_names::Init();
http_names::init(); http_names::Init();
input_mode_names::init(); input_mode_names::Init();
input_type_names::init(); input_type_names::Init();
media_feature_names::init(); media_feature_names::Init();
media_type_names::init(); media_type_names::Init();
performance_entry_names::init(); performance_entry_names::Init();
MediaQueryEvaluator::Init(); MediaQueryEvaluator::Init();
CSSParserTokenRange::InitStaticEOFToken(); CSSParserTokenRange::InitStaticEOFToken();
......
...@@ -103,11 +103,11 @@ void ModulesInitializer::Initialize() { ...@@ -103,11 +103,11 @@ void ModulesInitializer::Initialize() {
event_target_names::kModulesNamesCount + indexed_db_names::kNamesCount; event_target_names::kModulesNamesCount + indexed_db_names::kNamesCount;
StringImpl::ReserveStaticStringsCapacityForSize(kModulesStaticStringsCount); StringImpl::ReserveStaticStringsCapacityForSize(kModulesStaticStringsCount);
event_interface_names::initModules(); event_interface_names::InitModules();
event_target_names::initModules(); event_target_names::InitModules();
Document::RegisterEventFactory(EventModulesFactory::Create()); Document::RegisterEventFactory(EventModulesFactory::Create());
ModuleBindingsInitializer::Init(); ModuleBindingsInitializer::Init();
indexed_db_names::init(); indexed_db_names::Init();
AXObjectCache::Init(AXObjectCacheImpl::Create); AXObjectCache::Init(AXObjectCacheImpl::Create);
DraggedIsolatedFileSystem::Init( DraggedIsolatedFileSystem::Init(
DraggedIsolatedFileSystemImpl::PrepareForDataObject); DraggedIsolatedFileSystemImpl::PrepareForDataObject);
......
...@@ -195,10 +195,10 @@ void Platform::InitializeCommon(Platform* platform, ...@@ -195,10 +195,10 @@ void Platform::InitializeCommon(Platform* platform,
ThreadState::AttachMainThread(); ThreadState::AttachMainThread();
// FontFamilyNames are used by platform/fonts and are initialized by core. // font_family_names are used by platform/fonts and are initialized by core.
// In case core is not available (like on PPAPI plugins), we need to init // In case core is not available (like on PPAPI plugins), we need to init
// them here. // them here.
font_family_names::init(); font_family_names::Init();
InitializePlatformLanguage(); InitializePlatformLanguage();
DCHECK(!g_gc_task_runner); DCHECK(!g_gc_task_runner);
......
...@@ -39,8 +39,7 @@ TEST(FontCacheAndroid, genericFamilyNameForScript) { ...@@ -39,8 +39,7 @@ TEST(FontCacheAndroid, genericFamilyNameForScript) {
FontDescription chinese; FontDescription chinese;
chinese.SetLocale(LayoutLocale::Get("zh")); chinese.SetLocale(LayoutLocale::Get("zh"));
if (font_family_names::kWebkitStandard.IsEmpty()) font_family_names::Init();
font_family_names::init();
// For non-CJK, getGenericFamilyNameForScript should return the given // For non-CJK, getGenericFamilyNameForScript should return the given
// familyName. // familyName.
......
...@@ -186,11 +186,11 @@ ScopedUnittestsEnvironmentSetup::ScopedUnittestsEnvironmentSetup(int argc, ...@@ -186,11 +186,11 @@ ScopedUnittestsEnvironmentSetup::ScopedUnittestsEnvironmentSetup(int argc,
ThreadState::AttachMainThread(); ThreadState::AttachMainThread();
ThreadState::Current()->RegisterTraceDOMWrappers(nullptr, nullptr, nullptr, ThreadState::Current()->RegisterTraceDOMWrappers(nullptr, nullptr, nullptr,
nullptr); nullptr);
http_names::init(); http_names::Init();
fetch_initiator_type_names::init(); fetch_initiator_type_names::Init();
InitializePlatformLanguage(); InitializePlatformLanguage();
font_family_names::init(); font_family_names::Init();
WebRuntimeFeatures::EnableExperimentalFeatures(true); WebRuntimeFeatures::EnableExperimentalFeatures(true);
WebRuntimeFeatures::EnableTestOnlyFeatures(true); WebRuntimeFeatures::EnableTestOnlyFeatures(true);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment